add application file icon for macos
@@ -41,6 +41,16 @@ set(RESOURCE_FILES
|
|||||||
resources/qt_res.rc
|
resources/qt_res.rc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# The MACOSX_BUNDLE_ICON_FILE variable is added to the Info.plist
|
||||||
|
# generated by CMake. This variable contains the .icns file name,
|
||||||
|
# without the path.
|
||||||
|
set(MACOSX_BUNDLE_ICON_FILE ifcosLogo.icns)
|
||||||
|
|
||||||
|
# The following tells CMake where to find and install the file itself.
|
||||||
|
set(app_icon_macos "resources/ifcosLogo.icns")
|
||||||
|
set_source_files_properties(${app_icon_macos} PROPERTIES
|
||||||
|
MACOSX_PACKAGE_LOCATION "Resources")
|
||||||
|
|
||||||
add_executable(${targetName}
|
add_executable(${targetName}
|
||||||
IfcViewerWidget.h
|
IfcViewerWidget.h
|
||||||
IfcViewerWidget.cpp
|
IfcViewerWidget.cpp
|
||||||
@@ -50,6 +60,7 @@ add_executable(${targetName}
|
|||||||
MainWindow.cpp
|
MainWindow.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
${RESOURCE_FILES}
|
${RESOURCE_FILES}
|
||||||
|
${app_icon_macos}
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(${targetName} PROPERTIES
|
set_target_properties(${targetName} PROPERTIES
|
||||||
|
|||||||
@@ -6,11 +6,14 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// Set the icon in the window title-bar
|
// Set the icon in the window title-bar on mswindows
|
||||||
|
// and dock icon on macos.
|
||||||
// "icon" alias defined in .qrc file
|
// "icon" alias defined in .qrc file
|
||||||
// (.rc file sets the file icon on mswindows)
|
|
||||||
QIcon appIcon(":/icon");
|
QIcon appIcon(":/icon");
|
||||||
app.setWindowIcon(appIcon);
|
app.setWindowIcon(appIcon);
|
||||||
|
// File icon set with:
|
||||||
|
// mswindows - .rc file
|
||||||
|
// macos - .icns file (using CMake)
|
||||||
|
|
||||||
MainWindow window;
|
MainWindow window;
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 377 B |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 439 B |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 710 B |
|
After Width: | Height: | Size: 740 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.4 KiB |