From da4de6b6e361879993f834ed4c157d5bdba2c050 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 16 May 2023 10:44:34 +0200 Subject: [PATCH] Polish forward decl in vulkan and opengl examples Pick-to: 6.5 Change-Id: I9f05aedc7649ab7e248b7332c04a6664e85182d8 Reviewed-by: Laszlo Agocs Reviewed-by: Andy Nichols --- examples/opengl/hellogl2/window.h | 6 ++---- examples/opengl/hellogles3/glwindow.h | 12 ++++-------- examples/opengl/openglwindow/openglwindow.h | 8 +++----- examples/vulkan/hellovulkancubes/mainwindow.h | 10 ++++------ .../vulkan/hellovulkanwidget/hellovulkanwidget.h | 10 ++++------ 5 files changed, 17 insertions(+), 29 deletions(-) diff --git a/examples/opengl/hellogl2/window.h b/examples/opengl/hellogl2/window.h index f9e0607903..2099bc119a 100644 --- a/examples/opengl/hellogl2/window.h +++ b/examples/opengl/hellogl2/window.h @@ -6,10 +6,8 @@ #include -QT_BEGIN_NAMESPACE -class QSlider; -class QPushButton; -QT_END_NAMESPACE +QT_FORWARD_DECLARE_CLASS(QSlider) +QT_FORWARD_DECLARE_CLASS(QPushButton) class GLWidget; class MainWindow; diff --git a/examples/opengl/hellogles3/glwindow.h b/examples/opengl/hellogles3/glwindow.h index fc2a0e487e..54bc531af8 100644 --- a/examples/opengl/hellogles3/glwindow.h +++ b/examples/opengl/hellogles3/glwindow.h @@ -9,14 +9,10 @@ #include #include "../hellogl2/logo.h" -QT_BEGIN_NAMESPACE - -class QOpenGLTexture; -class QOpenGLShaderProgram; -class QOpenGLBuffer; -class QOpenGLVertexArrayObject; - -QT_END_NAMESPACE +QT_FORWARD_DECLARE_CLASS(QOpenGLTexture) +QT_FORWARD_DECLARE_CLASS(QOpenGLShaderProgram) +QT_FORWARD_DECLARE_CLASS(QOpenGLBuffer) +QT_FORWARD_DECLARE_CLASS(QOpenGLVertexArrayObject) class GLWindow : public QOpenGLWindow { diff --git a/examples/opengl/openglwindow/openglwindow.h b/examples/opengl/openglwindow/openglwindow.h index 579f9eede4..41bcbab9c4 100644 --- a/examples/opengl/openglwindow/openglwindow.h +++ b/examples/opengl/openglwindow/openglwindow.h @@ -7,11 +7,9 @@ #include #include -QT_BEGIN_NAMESPACE -class QPainter; -class QOpenGLContext; -class QOpenGLPaintDevice; -QT_END_NAMESPACE +QT_FORWARD_DECLARE_CLASS(QPainter) +QT_FORWARD_DECLARE_CLASS(QOpenGLContext) +QT_FORWARD_DECLARE_CLASS(QOpenGLPaintDevice) //! [1] class OpenGLWindow : public QWindow, protected QOpenGLFunctions diff --git a/examples/vulkan/hellovulkancubes/mainwindow.h b/examples/vulkan/hellovulkancubes/mainwindow.h index 2e931c1a52..8ecb0002e7 100644 --- a/examples/vulkan/hellovulkancubes/mainwindow.h +++ b/examples/vulkan/hellovulkancubes/mainwindow.h @@ -6,12 +6,10 @@ #include -QT_BEGIN_NAMESPACE -class QLCDNumber; -class QLabel; -class QPushButton; -class QCheckBox; -QT_END_NAMESPACE +QT_FORWARD_DECLARE_CLASS(QLCDNumber) +QT_FORWARD_DECLARE_CLASS(QLabel) +QT_FORWARD_DECLARE_CLASS(QPushButton) +QT_FORWARD_DECLARE_CLASS(QCheckBox) class VulkanWindow; diff --git a/examples/vulkan/hellovulkanwidget/hellovulkanwidget.h b/examples/vulkan/hellovulkanwidget/hellovulkanwidget.h index d545e68172..cbebe17f64 100644 --- a/examples/vulkan/hellovulkanwidget/hellovulkanwidget.h +++ b/examples/vulkan/hellovulkanwidget/hellovulkanwidget.h @@ -7,13 +7,11 @@ #include "../shared/trianglerenderer.h" #include -class VulkanWindow; +QT_FORWARD_DECLARE_CLASS(QTabWidget) +QT_FORWARD_DECLARE_CLASS(QPlainTextEdit) +QT_FORWARD_DECLARE_CLASS(QLCDNumber) -QT_BEGIN_NAMESPACE -class QTabWidget; -class QPlainTextEdit; -class QLCDNumber; -QT_END_NAMESPACE +class VulkanWindow; class MainWindow : public QWidget {