filesystemexplorer: Provide proper metadata for macOS

While at it, also remove hardcoded application version in main.cpp:
Qt can retrieve this from the application metdata.

Also use camel-case for the project name, according to
https://contribute.qt-project.org/quips/13

Pick-to: 6.10
Change-Id: If73fd741e330b66ae5367a61c65ccc65653cdab6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Kai Köhne 2025-07-13 16:09:48 +02:00
parent 161464abf6
commit 305d65ab87
3 changed files with 20 additions and 9 deletions

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(filesystemexplorer LANGUAGES CXX)
project(FileSystemExplorer VERSION 1.0 LANGUAGES CXX)
if (ANDROID OR IOS)
message(FATAL_ERROR "Platform is not supported")
@ -10,18 +10,13 @@ if (ANDROID OR IOS)
endif ()
find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickControls2 Svg)
qt_standard_project_setup(REQUIRES 6.8)
qt_add_executable(filesystemexplorer
main.cpp
)
set_target_properties(filesystemexplorer
PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
set_source_files_properties(qml/Colors.qml
PROPERTIES
QT_QML_SINGLETON_TYPE TRUE
@ -68,6 +63,23 @@ target_link_libraries(filesystemexplorer
Qt6::Svg
)
set_target_properties(filesystemexplorer
PROPERTIES
WIN32_EXECUTABLE TRUE
)
if (APPLE)
set_target_properties(filesystemexplorer PROPERTIES
OUTPUT_NAME "File System Explorer"
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_BUNDLE_NAME "File System Explorer"
MACOSX_BUNDLE_COPYRIGHT "Copyright (C) The Qt Company Ltd. and other contributors."
MACOSX_BUNDLE_GUI_IDENTIFIER "io.qt.examples.fsexplorer"
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
endif()
install(TARGETS filesystemexplorer
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

View File

@ -21,7 +21,7 @@ ApplicationWindow {
visible: true
color: Colors.background
flags: Qt.Window | Qt.FramelessWindowHint
title: qsTr("File System Explorer Example")
title: qsTr("File System Explorer")
function getInfoText() : string {
let out = root.currentFilePath

View File

@ -13,7 +13,6 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
QGuiApplication::setOrganizationName("QtProject");
QGuiApplication::setApplicationName("File System Explorer");
QGuiApplication::setApplicationVersion(QT_VERSION_STR);
QGuiApplication::setWindowIcon(QIcon(":/qt/qml/FileSystemModule/icons/app_icon.svg"));
// Setup the parser and parse the command-line arguments.