CMakeLists.txt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
examples/mainwindow/mainwindow.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
examples/mainwindow/mainwindow.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/CMakeLists.txt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/core/CMakeLists.txt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/core/style/styleagent.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
CMakeLists.txt
@@ -14,6 +14,7 @@ option(QWINDOWKIT_ENABLE_QT_WINDOW_CONTEXT "Enable Qt Window Context anyway" OFF) option(QWINDOWKIT_ENABLE_WINDOWS_SYSTEM_BORDERS "Enable system borders on Windows" ON) option(QWINDOWKIT_ENABLE_STYLE_AGENT "Enable building style agent" ON) # ---------------------------------- # CMake Settings examples/mainwindow/mainwindow.cpp
@@ -14,7 +14,6 @@ # include <QtWidgets/QActionGroup> #endif #include <QWKCore/styleagent.h> #include <QWKWidgets/widgetwindowagent.h> #include <widgetframe/windowbar.h> @@ -37,7 +36,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { installWindowAgent(); installStyleAgent(); auto clockWidget = new ClockWidget(); clockWidget->setObjectName(QStringLiteral("clock-widget")); @@ -288,14 +286,6 @@ }); connect(windowBar, &QWK::WindowBar::closeRequested, this, &QWidget::close); #endif } void MainWindow::installStyleAgent() { styleAgent = new QWK::StyleAgent(this); connect(styleAgent, &QWK::StyleAgent::systemThemeChanged, this, [this]() { qDebug() << "System style changed:" << styleAgent->systemTheme(); // }); } void MainWindow::loadStyleSheet(Theme theme) { examples/mainwindow/mainwindow.h
@@ -28,13 +28,11 @@ private: void installWindowAgent(); void installStyleAgent(); void loadStyleSheet(Theme theme); Theme currentTheme{}; QWK::WidgetWindowAgent *windowAgent; QWK::StyleAgent *styleAgent; }; #endif // MAINWINDOW_H src/CMakeLists.txt
@@ -17,6 +17,9 @@ qm_add_definition(QWINDOWKIT_ENABLE_QT_WINDOW_CONTEXT CONDITION QWINDOWKIT_ENABLE_QT_WINDOW_CONTEXT ) qm_add_definition(QWINDOWKIT_ENABLE_STYLE_AGENT CONDITION QWINDOWKIT_ENABLE_STYLE_AGENT ) qm_add_definition(QWINDOWKIT_ENABLE_WINDOWS_SYSTEM_BORDERS CONDITION QWINDOWKIT_ENABLE_WINDOWS_SYSTEM_BORDERS ) src/core/CMakeLists.txt
@@ -65,7 +65,9 @@ endif() endif() if(TRUE) set(_sync_include_options) if(QWINDOWKIT_ENABLE_STYLE_AGENT) list(APPEND _src style/styleagent.h style/styleagent_p.h @@ -79,6 +81,8 @@ else() list(APPEND _src style/styleagent_linux.cpp) endif() else() list(APPEND _sync_include_options EXCLUDE "style/\\.+") endif() qwk_add_library(${PROJECT_NAME} AUTOGEN @@ -89,6 +93,7 @@ QT_INCLUDE_PRIVATE Core Gui INCLUDE_PRIVATE kernel contexts shared PREFIX QWK_CORE SYNC_INCLUDE_OPTIONS ${_sync_include_options} ) set_target_properties(${PROJECT_NAME} PROPERTIES src/core/style/styleagent.cpp
@@ -8,6 +8,10 @@ /*! \class StyleAgent \brief StyleAgent provides some features related to system theme. Qt6.6 started to support system theme detection, this class is intended as an auxiliary support for lower versions of Qt. If your Qt already supports it, it is recommended that you don't include this class in your build system. */ StyleAgentPrivate::StyleAgentPrivate() {