summaryrefslogtreecommitdiffstats
path: root/examples/widgets/painting/shared
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/painting/shared')
-rw-r--r--examples/widgets/painting/shared/CMakeLists.txt24
-rw-r--r--examples/widgets/painting/shared/arthurwidgets.cpp6
-rw-r--r--examples/widgets/painting/shared/hoverpoints.cpp4
-rw-r--r--examples/widgets/painting/shared/shared.pri1
4 files changed, 33 insertions, 2 deletions
diff --git a/examples/widgets/painting/shared/CMakeLists.txt b/examples/widgets/painting/shared/CMakeLists.txt
new file mode 100644
index 0000000000..4c7049e01d
--- /dev/null
+++ b/examples/widgets/painting/shared/CMakeLists.txt
@@ -0,0 +1,24 @@
+# special case: Entire file!
+
+# special case:
+add_library(painting_shared OBJECT)
+qt6_wrap_cpp(moc_files arthurwidgets.h hoverpoints.h) # no automoc for OBJECT libs:-/
+target_sources(painting_shared PRIVATE
+ arthurstyle.cpp arthurstyle.h
+ arthurwidgets.cpp arthurwidgets.h
+ hoverpoints.cpp hoverpoints.h
+ ${moc_files}
+)
+target_link_libraries(painting_shared PUBLIC Qt::Widgets)
+target_include_directories(painting_shared PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
+
+## Scopes:
+#####################################################################
+
+if (TARGET Qt::OpenGL OR QT_FEATURE_opengles2)
+ target_compile_definitions(painting_shared PRIVATE QT_OPENGL_SUPPORT)
+ target_link_libraries(painting_shared PRIVATE
+ Qt::OpenGL
+ Qt::Widgets
+ )
+endif()
diff --git a/examples/widgets/painting/shared/arthurwidgets.cpp b/examples/widgets/painting/shared/arthurwidgets.cpp
index 40d712c9e3..e24130e464 100644
--- a/examples/widgets/painting/shared/arthurwidgets.cpp
+++ b/examples/widgets/painting/shared/arthurwidgets.cpp
@@ -62,8 +62,10 @@
#include <QRegularExpression>
#include <QOffscreenSurface>
#include <QOpenGLContext>
-#include <QOpenGLPaintDevice>
-#include <QOpenGLWindow>
+#if QT_CONFIG(opengl)
+#include <QtOpenGL/QOpenGLPaintDevice>
+#include <QtOpenGL/QOpenGLWindow>
+#endif
extern QPixmap cached(const QString &img);
diff --git a/examples/widgets/painting/shared/hoverpoints.cpp b/examples/widgets/painting/shared/hoverpoints.cpp
index 2bf3963e9e..f834f315f9 100644
--- a/examples/widgets/painting/shared/hoverpoints.cpp
+++ b/examples/widgets/painting/shared/hoverpoints.cpp
@@ -53,6 +53,10 @@
#include <algorithm>
+#if QT_CONFIG(opengl)
+#include <QtOpenGL/QOpenGLWindow>
+#endif
+
#define printf
HoverPoints::HoverPoints(QWidget *widget, PointShape shape)
diff --git a/examples/widgets/painting/shared/shared.pri b/examples/widgets/painting/shared/shared.pri
index cb08b00348..7e2b4df8cb 100644
--- a/examples/widgets/painting/shared/shared.pri
+++ b/examples/widgets/painting/shared/shared.pri
@@ -1,6 +1,7 @@
INCLUDEPATH += $$PWD
qtConfig(opengl) {
+ QT += opengl
SOURCES += $$PWD/fbopaintdevice.cpp
HEADERS += $$PWD/fbopaintdevice.h
}