diff --git a/app/backend/systemproperties.cpp b/app/backend/systemproperties.cpp index 4a10e970..4c1593ee 100644 --- a/app/backend/systemproperties.cpp +++ b/app/backend/systemproperties.cpp @@ -2,6 +2,7 @@ #include "utils.h" #include +#include #include "streaming/session.h" #include "streaming/streamutils.h" @@ -17,6 +18,7 @@ SystemProperties::SystemProperties() hasDesktopEnvironment = WMUtils::isRunningDesktopEnvironment(); isRunningWayland = WMUtils::isRunningWayland(); isRunningXWayland = isRunningWayland && QGuiApplication::platformName() == "xcb"; + usesMaterial3Theme = QLibraryInfo::version() >= QVersionNumber(6, 5, 0); QString nativeArch = QSysInfo::currentCpuArchitecture(); #ifdef Q_OS_WIN32 diff --git a/app/backend/systemproperties.h b/app/backend/systemproperties.h index 39b1c330..894f4c69 100644 --- a/app/backend/systemproperties.h +++ b/app/backend/systemproperties.h @@ -26,6 +26,7 @@ public: Q_PROPERTY(QSize maximumResolution MEMBER maximumResolution CONSTANT) Q_PROPERTY(QString versionString MEMBER versionString CONSTANT) Q_PROPERTY(bool supportsHdr MEMBER supportsHdr CONSTANT) + Q_PROPERTY(bool usesMaterial3Theme MEMBER usesMaterial3Theme CONSTANT) Q_INVOKABLE void refreshDisplays(); Q_INVOKABLE QRect getNativeResolution(int displayIndex); @@ -54,5 +55,6 @@ private: QList monitorRefreshRates; QString versionString; bool supportsHdr; + bool usesMaterial3Theme; }; diff --git a/app/gui/AutoResizingComboBox.qml b/app/gui/AutoResizingComboBox.qml index 0fc64dc8..6b947818 100644 --- a/app/gui/AutoResizingComboBox.qml +++ b/app/gui/AutoResizingComboBox.qml @@ -2,6 +2,7 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import SdlGamepadKeyNavigation 1.0 +import SystemProperties 1.0 // https://stackoverflow.com/questions/45029968/how-do-i-set-the-combobox-width-to-fit-the-largest-item ComboBox { @@ -38,6 +39,12 @@ ComboBox { popup.onAboutToShow: { // Switch to normal navigation for combo boxes SdlGamepadKeyNavigation.setUiNavMode(false) + + // Override the popup color to improve contrast with the overridden + // Material 2 background color set in main.qml. + if (SystemProperties.usesMaterial3Theme) { + popup.background.color = "#424242" + } } popup.onAboutToHide: { diff --git a/app/gui/main.qml b/app/gui/main.qml index 423485cd..7f0a56a3 100644 --- a/app/gui/main.qml +++ b/app/gui/main.qml @@ -2,6 +2,7 @@ import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import QtQuick.Window 2.2 +import QtQuick.Controls.Material 2.2 import ComputerManager 1.0 import AutoUpdateChecker 1.0 @@ -22,6 +23,15 @@ ApplicationWindow { width: 1280 height: 600 + // Override the background color to Material 2 colors for Qt 6.5+ + // in order to improve contrast between GFE's placeholder box art + // and the background of the app grid. + Component.onCompleted: { + if (SystemProperties.usesMaterial3Theme) { + Material.background = "#303030" + } + } + visibility: { if (SystemProperties.hasDesktopEnvironment) { if (StreamingPreferences.uiDisplayMode == StreamingPreferences.UI_WINDOWED) return "Windowed"