Initial support for Qt 6

This commit is contained in:
Martin Brodbeck 2021-09-21 14:33:22 +02:00
parent 453fd8cdb5
commit 77ecb98f47
2 changed files with 4 additions and 5 deletions

View file

@ -8,11 +8,10 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
# Find the QtWidgets library # Find the QtWidgets library
find_package(Qt5Widgets CONFIG REQUIRED) find_package(Qt6 COMPONENTS Widgets Network PrintSupport CONFIG REQUIRED)
find_package(Qt5PrintSupport CONFIG REQUIRED)
# For SingleApplication: # For SingleApplication:
find_package(Qt5Network CONFIG REQUIRED) #find_package(Qt5Network CONFIG REQUIRED)
set(QAPPLICATION_CLASS QApplication) set(QAPPLICATION_CLASS QApplication)
add_compile_definitions(QAPPLICATION_CLASS=${QAPPLICATION_CLASS}) add_compile_definitions(QAPPLICATION_CLASS=${QAPPLICATION_CLASS})
@ -40,7 +39,7 @@ set(GUI_SOURCES
add_executable(kima2 ${GUI_SOURCES} kima2.rc) add_executable(kima2 ${GUI_SOURCES} kima2.rc)
target_include_directories(kima2 PRIVATE ${PROJECT_BINARY_DIR}) target_include_directories(kima2 PRIVATE ${PROJECT_BINARY_DIR})
target_include_directories(kima2 PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git) target_include_directories(kima2 PRIVATE ${PROJECT_SOURCE_DIR}/subprojects/singleapplication/singleapplication.git)
target_link_libraries(kima2 core printer Qt5::Widgets Qt5::PrintSupport Qt5::Network stdc++fs) target_link_libraries(kima2 core printer Qt::Core Qt::PrintSupport Qt::Network stdc++fs)
if(WIN32) if(WIN32)
set_target_properties(kima2 PROPERTIES LINK_FLAGS "-mwindows") set_target_properties(kima2 PROPERTIES LINK_FLAGS "-mwindows")
endif(WIN32) endif(WIN32)

View file

@ -96,7 +96,7 @@ MainWindow::MainWindow()
connect(ui_.aboutQtAction, &QAction::triggered, this, &MainWindow::onAboutQt); connect(ui_.aboutQtAction, &QAction::triggered, this, &MainWindow::onAboutQt);
connect(ui_.aboutAction, &QAction::triggered, this, &MainWindow::onAbout); connect(ui_.aboutAction, &QAction::triggered, this, &MainWindow::onAbout);
connect(ui_.openManualAction, &QAction::triggered, this, []() { connect(ui_.openManualAction, &QAction::triggered, this, []() {
auto locations = QStandardPaths::standardLocations(QStandardPaths::DataLocation); auto locations = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
for (auto location : locations) { for (auto location : locations) {
if (QFile::exists(location + QString("/Benutzerhandbuch.pdf"))) { if (QFile::exists(location + QString("/Benutzerhandbuch.pdf"))) {
QDesktopServices::openUrl( QDesktopServices::openUrl(