diff --git a/CMakeLists.txt b/CMakeLists.txt index 05fbc35..0e7c50f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,13 +92,17 @@ set(UI_FILES ui/groupSelectionDialog.ui ) +set(APP_ICON "${CMAKE_CURRENT_SOURCE_DIR}/app_Logo.rc") +set(RESOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/resource/PowerModeler.qrc") + if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(PowerModeler MANUAL_FINALIZATION ${H_HEADER_FILES} ${CPP_SOURCE_FILES} ${UI_FILES} - resource/PowerModeler.qrc + ${APP_ICON} + ${RESOURCE_FILES} ) # Define target properties for Android with Qt 6 as: # set_property(TARGET PowerModeler APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR @@ -110,7 +114,7 @@ else() ${H_HEADER_FILES} ${CPP_SOURCE_FILES} ${UI_FILES} - resource/PowerModeler.qrc + ${RESOURCE_FILES} ) # Define properties for Android with Qt 5 after find_package() calls as: # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") @@ -119,7 +123,7 @@ else() ${H_HEADER_FILES} ${CPP_SOURCE_FILES} ${UI_FILES} - resource/PowerModeler.qrc + ${RESOURCE_FILES} ) endif() endif() diff --git a/app_Logo.rc b/app_Logo.rc new file mode 100644 index 0000000..e681731 --- /dev/null +++ b/app_Logo.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON "logo.ico" \ No newline at end of file diff --git a/logo.ico b/logo.ico new file mode 100644 index 0000000..7e22406 Binary files /dev/null and b/logo.ico differ diff --git a/resource/PowerModeler.qrc b/resource/PowerModeler.qrc index fdf2764..46ae8c5 100644 --- a/resource/PowerModeler.qrc +++ b/resource/PowerModeler.qrc @@ -1,5 +1,6 @@ + images/appIcon.png images/icon_ellipsis.png images/icon_file.png images/icon_multiple-choice.png diff --git a/resource/images/appIcon.png b/resource/images/appIcon.png new file mode 100644 index 0000000..a9fbe11 Binary files /dev/null and b/resource/images/appIcon.png differ diff --git a/source/main.cpp b/source/main.cpp index 96c734c..7f354b3 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -8,10 +8,12 @@ int main(int argc, char *argv[]) { qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "0"); // Wayland 下启用装饰 QApplication a(argc, argv); + //a.setWindowIcon(QIcon(":/img/images/appIcon.ico")); //a.setStyle(QStyleFactory::create("Fusion")); LOG_INFO("Application", "------------------------------------------------Application start------------------------------------------------"); MainWindow w; + w.setWindowIcon(QIcon(":/img/images/appIcon.ico")); w.show(); return a.exec(); diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui index 780c1bc..1d346f4 100644 --- a/ui/mainwindow.ui +++ b/ui/mainwindow.ui @@ -15,7 +15,7 @@ - :/img/images/icon_database.png:/img/images/icon_database.png + :/img/images/appIcon.png:/img/images/appIcon.png QWidget