aboutsummaryrefslogtreecommitdiffstats
path: root/examples/scriptableapplication
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-29 08:27:34 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-29 08:56:55 +0000
commitfb077477391b7108a489c54739777dd0cf62d250 (patch)
treed497acc3b9a2cae933e36b236f334e0683807de9 /examples/scriptableapplication
parentd6c80243dddccb68da95fb7061c33d5af706ae38 (diff)
Fix the C++ - based examples to work
Adapt CMakeList.txt, fix includes. Change-Id: Idc9636bee798c4a025b70f91b8379a9b9c79a82c Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'examples/scriptableapplication')
-rw-r--r--examples/scriptableapplication/CMakeLists.txt14
-rw-r--r--examples/scriptableapplication/mainwindow.cpp2
-rw-r--r--examples/scriptableapplication/pythonutils.h4
3 files changed, 11 insertions, 9 deletions
diff --git a/examples/scriptableapplication/CMakeLists.txt b/examples/scriptableapplication/CMakeLists.txt
index d80664f53..2ccb9897d 100644
--- a/examples/scriptableapplication/CMakeLists.txt
+++ b/examples/scriptableapplication/CMakeLists.txt
@@ -12,7 +12,9 @@ project(scriptableapplication)
set(CMAKE_CXX_STANDARD 11)
# Find required Qt packages.
-find_package(Qt5 5.12 REQUIRED COMPONENTS Core Gui Widgets)
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
# Use provided python interpreter if given.
if(NOT python_interpreter)
@@ -63,9 +65,9 @@ endif()
# Get all relevant Qt include dirs, to pass them on to shiboken.
-get_property(QT_CORE_INCLUDE_DIRS TARGET Qt5::Core PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
-get_property(QT_GUI_INCLUDE_DIRS TARGET Qt5::Gui PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
-get_property(QT_WIDGETS_INCLUDE_DIRS TARGET Qt5::Widgets PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+get_property(QT_CORE_INCLUDE_DIRS TARGET Qt6::Core PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+get_property(QT_GUI_INCLUDE_DIRS TARGET Qt6::Gui PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+get_property(QT_WIDGETS_INCLUDE_DIRS TARGET Qt6::Widgets PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
set(QT_INCLUDE_DIRS ${QT_CORE_INCLUDE_DIRS} ${QT_GUI_INCLUDE_DIRS} ${QT_WIDGETS_INCLUDE_DIRS})
set(INCLUDES "")
foreach(INCLUDE_DIR ${QT_INCLUDE_DIRS})
@@ -73,7 +75,7 @@ foreach(INCLUDE_DIR ${QT_INCLUDE_DIRS})
endforeach()
# On macOS, check if Qt is a framework build. This affects how include paths should be handled.
-get_target_property(QtCore_is_framework Qt5::Core FRAMEWORK)
+get_target_property(QtCore_is_framework Qt6::Core FRAMEWORK)
if (QtCore_is_framework)
get_target_property(qt_core_library_location Qt5::Core LOCATION)
get_filename_component(qt_core_library_location_dir "${qt_core_library_location}" DIRECTORY)
@@ -157,7 +159,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${PYSIDE2_INCLUDE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${PYSIDE2_ADDITIONAL_INCLUDES})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR})
-target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets)
+target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets)
target_link_libraries(${PROJECT_NAME} PRIVATE ${SHIBOKEN6_MODULE_SHARED_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PRIVATE ${PYSIDE2_SHARED_LIBRARIES})
diff --git a/examples/scriptableapplication/mainwindow.cpp b/examples/scriptableapplication/mainwindow.cpp
index ed12f94b1..315ea227e 100644
--- a/examples/scriptableapplication/mainwindow.cpp
+++ b/examples/scriptableapplication/mainwindow.cpp
@@ -51,7 +51,6 @@
#include "mainwindow.h"
#include "pythonutils.h"
-#include <QtGui.QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
@@ -60,6 +59,7 @@
#include <QtWidgets/QToolBar>
#include <QtWidgets/QVBoxLayout>
+#include <QtGui/QAction>
#include <QtGui/QFontDatabase>
#include <QtGui/QIcon>
diff --git a/examples/scriptableapplication/pythonutils.h b/examples/scriptableapplication/pythonutils.h
index 21aef194e..942dee508 100644
--- a/examples/scriptableapplication/pythonutils.h
+++ b/examples/scriptableapplication/pythonutils.h
@@ -51,9 +51,9 @@
#ifndef PYTHONUTILS_H
#define PYTHONUTILS_H
+#include <QtCore/QStringList>
+
class QObject;
-class QString;
-class QStringList;
namespace PythonUtils {