From 3bb0003d5043f142fd7a5c04b48bb78675481053 Mon Sep 17 00:00:00 2001 From: dsm <41967334+dsm@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:20:08 +0300 Subject: [PATCH 1/2] add app icon using cmake and rc file. it also adds app icon to qucs.exe --- qucs/CMakeLists.txt | 6 ++++-- qucs/dialogs/aboutdialog.cpp | 2 +- qucs/qucs.cpp | 2 +- qucs/qucs.qrc | 1 + qucs/qucs_icon.rc | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 qucs/qucs_icon.rc diff --git a/qucs/CMakeLists.txt b/qucs/CMakeLists.txt index 989dd514d..d78e779c3 100755 --- a/qucs/CMakeLists.txt +++ b/qucs/CMakeLists.txt @@ -257,7 +257,7 @@ IF(APPLE) #SET(RESOURCES_SRCS ${RESOURCES_SRCS} ${LANG_SRCS}) ENDIF(APPLE) - +set(app_icon_resource_windows "${CMAKE_CURRENT_SOURCE_DIR}/qucs_icon.rc") # # CMake's way of creating an executable # @@ -265,7 +265,9 @@ ADD_EXECUTABLE( ${QUCS_NAME} MACOSX_BUNDLE WIN32 ${QUCS_HDRS} ${QUCS_SRCS} ${QUCS_MOC_SRCS} - ${RESOURCES_SRCS} ) + ${RESOURCES_SRCS} + ${app_icon_resource_windows} + ) # # Tell CMake which libraries we need to link our executable against. diff --git a/qucs/dialogs/aboutdialog.cpp b/qucs/dialogs/aboutdialog.cpp index 0538b15a9..cec145366 100644 --- a/qucs/dialogs/aboutdialog.cpp +++ b/qucs/dialogs/aboutdialog.cpp @@ -124,7 +124,7 @@ AboutDialog::AboutDialog(QWidget *parent) //all->setSpacing(0); QLabel *iconLabel = new QLabel(); - iconLabel->setPixmap(QPixmap(QString(":/bitmaps/hicolor/128x128/apps/qucs.png"))); + iconLabel->setPixmap(QPixmap(QString(":/bitmaps/hicolor/scalable/apps/qucs.svg"))); QWidget *hbox = new QWidget(); QHBoxLayout *hl = new QHBoxLayout(hbox); diff --git a/qucs/qucs.cpp b/qucs/qucs.cpp index e39dfe846..cd45cf19b 100644 --- a/qucs/qucs.cpp +++ b/qucs/qucs.cpp @@ -265,7 +265,7 @@ void QucsApp::initView() // set application icon // APPLE sets the QApplication icon with Info.plist #ifndef __APPLE__ - setWindowIcon (QPixmap(":/bitmaps/big.qucs.xpm")); + //setWindowIcon (QPixmap(QString(":/bitmaps/hicolor/scalable/apps/qucs.svg"))); #else // setUnifiedTitleAndToolBarOnMac(true); setStyleSheet("QToolButton { padding: 0px; }"); diff --git a/qucs/qucs.qrc b/qucs/qucs.qrc index abe1764ce..d3a25130e 100644 --- a/qucs/qucs.qrc +++ b/qucs/qucs.qrc @@ -7,6 +7,7 @@ bitmaps/tiny.button.qucs.xpm bitmaps/tiny.qucs.xpm bitmaps/hicolor/128x128/apps/qucs.png + bitmaps/hicolor/scalable/apps/qucs.svg bitmaps/svg/filenew.svg bitmaps/svg/textnew.svg bitmaps/svg/symnew.svg diff --git a/qucs/qucs_icon.rc b/qucs/qucs_icon.rc new file mode 100644 index 000000000..55e5dba84 --- /dev/null +++ b/qucs/qucs_icon.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "bitmaps/qucs.ico" \ No newline at end of file From 6a26ae980d0a1df25b273ee047d0a4803863b911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20=C5=9E=C3=BCkr=C3=BC=20Demir?= <41967334+dsm@users.noreply.github.com> Date: Thu, 5 Sep 2024 18:08:30 +0300 Subject: [PATCH 2/2] set windows icon using qucs.svg --- qucs/qucs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qucs/qucs.cpp b/qucs/qucs.cpp index cd45cf19b..f1b89ab37 100644 --- a/qucs/qucs.cpp +++ b/qucs/qucs.cpp @@ -265,7 +265,7 @@ void QucsApp::initView() // set application icon // APPLE sets the QApplication icon with Info.plist #ifndef __APPLE__ - //setWindowIcon (QPixmap(QString(":/bitmaps/hicolor/scalable/apps/qucs.svg"))); + setWindowIcon (QPixmap(QString(":/bitmaps/hicolor/scalable/apps/qucs.svg"))); #else // setUnifiedTitleAndToolBarOnMac(true); setStyleSheet("QToolButton { padding: 0px; }");