From 83710cb96187d635be1be95ac1a2652c28d695cd Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 周二, 12 12月 2023 00:24:14 +0800
Subject: [PATCH] Add example icon

---
 examples/qml/CMakeLists.txt           |   12 ++----------
 src/core/windowitemdelegate_p.h       |    2 +-
 examples/mainwindow/CMakeLists.txt    |   12 ++----------
 src/core/kernel/nativeeventfilter.cpp |    2 +-
 qmsetup                               |    2 +-
 src/CMakeLists.txt                    |    4 ++--
 examples/shared/resources/example.ico |    0 
 examples/CMakeLists.txt               |   14 ++++++++++++++
 8 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index b48fa8b..db45e1a 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,4 +1,18 @@
+set(QWK_EXAMPLES_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+
+macro(qwk_add_example _target)
+    set(CMAKE_AUTOMOC ON)
+    set(CMAKE_AUTOUIC ON)
+    set(CMAKE_AUTORCC ON)
+
+    add_executable(${_target})
+    qm_configure_target(${_target} ${ARGN})
+    qm_add_win_rc(${_target} ICON ../shared/resources/example.ico)
+    qm_add_win_manifest(${_target})
+endmacro()
+
 add_subdirectory(shared)
 
 add_subdirectory(mainwindow)
+
 add_subdirectory(qml)
\ No newline at end of file
diff --git a/examples/mainwindow/CMakeLists.txt b/examples/mainwindow/CMakeLists.txt
index af9c769..6137ab3 100644
--- a/examples/mainwindow/CMakeLists.txt
+++ b/examples/mainwindow/CMakeLists.txt
@@ -1,17 +1,9 @@
 project(QWKExample_MainWindow)
 
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-set(CMAKE_AUTORCC ON)
-
 file(GLOB _src *.h *.cpp)
 
-add_executable(${PROJECT_NAME})
-
-qm_configure_target(${PROJECT_NAME}
+qwk_add_example(${PROJECT_NAME}
     SOURCES ${_src}
     QT_LINKS Core Gui Widgets
     LINKS QWKWidgets WidgetFrame
-)
-
-qm_add_win_manifest(${PROJECT_NAME})
\ No newline at end of file
+)
\ No newline at end of file
diff --git a/examples/qml/CMakeLists.txt b/examples/qml/CMakeLists.txt
index c638a6a..ed78439 100644
--- a/examples/qml/CMakeLists.txt
+++ b/examples/qml/CMakeLists.txt
@@ -1,17 +1,9 @@
 project(QWKExample_QML)
 
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-set(CMAKE_AUTORCC ON)
-
 file(GLOB _src *.h *.cpp *.qrc)
 
-add_executable(${PROJECT_NAME})
-
-qm_configure_target(${PROJECT_NAME}
+qwk_add_example(${PROJECT_NAME}
     SOURCES ${_src}
     QT_LINKS Core Gui Qml Quick
     LINKS QWKQuick
-)
-
-qm_add_win_manifest(${PROJECT_NAME})
\ No newline at end of file
+)
\ No newline at end of file
diff --git a/examples/shared/resources/example.ico b/examples/shared/resources/example.ico
new file mode 100644
index 0000000..316795d
--- /dev/null
+++ b/examples/shared/resources/example.ico
Binary files differ
diff --git a/qmsetup b/qmsetup
index c8d69a4..622dd3b 160000
--- a/qmsetup
+++ b/qmsetup
@@ -1 +1 @@
-Subproject commit c8d69a4895784220061c3cf8be5f092da2ac013e
+Subproject commit 622dd3b8688eaa140c1631ac94862f5ef723c73a
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 52c5b95..616d783 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -27,7 +27,7 @@
 # ----------------------------------
 # CMake API
 # ----------------------------------
-function(qwk_add_library _target)
+macro(qwk_add_library _target)
     set(options AUTOGEN NO_SYNC_INCLUDE NO_WIN_RC)
     set(oneValueArgs SYNC_INCLUDE_PREFIX PREFIX)
     set(multiValueArgs SYNC_INCLUDE_OPTIONS)
@@ -115,7 +115,7 @@
             "$<BUILD_INTERFACE:${QWINDOWKIT_GENERATED_INCLUDE_DIR}>"
         )
     endif()
-endfunction()
+endmacro()
 
 # ----------------------------------
 # Main Project
diff --git a/src/core/kernel/nativeeventfilter.cpp b/src/core/kernel/nativeeventfilter.cpp
index 44a1337..446388f 100644
--- a/src/core/kernel/nativeeventfilter.cpp
+++ b/src/core/kernel/nativeeventfilter.cpp
@@ -14,7 +14,7 @@
         }
 
         ~MasterNativeEventFilter() override {
-            qApp->removeNativeEventFilter(this);
+            // The base class removes automatically
         }
 
         bool nativeEventFilter(const QByteArray &eventType, void *message,
diff --git a/src/core/windowitemdelegate_p.h b/src/core/windowitemdelegate_p.h
index 67bd19b..584e3ff 100644
--- a/src/core/windowitemdelegate_p.h
+++ b/src/core/windowitemdelegate_p.h
@@ -30,7 +30,7 @@
         virtual void resetQtGrabbedControl() const;
 
     private:
-        Q_DISABLE_COPY_MOVE(WindowItemDelegate)
+        Q_DISABLE_COPY(WindowItemDelegate)
     };
 
 }

--
Gitblit v1.9.1