summaryrefslogtreecommitdiffstats
path: root/examples/corelib
diff options
context:
space:
mode:
authorRym Bouabid <rym.bouabid@qt.io>2023-09-20 17:44:57 +0200
committerRym Bouabid <rym.bouabid@qt.io>2023-10-02 19:08:42 +0200
commitaa9529408041ab16bb920840d78b3f41c759a2f8 (patch)
tree245ffb6cdf5b2c05419f72110c656b89ab83f093 /examples/corelib
parentfa54471050da82867ccd965977d72b3d6b14f4f5 (diff)
Revamp Queued Custom Type Ex: Fix includes
Fix includes order and add the needed ones to avoid transitive includes. Remove QT_{BEGIN,END}_NAMESPACE because these are private Qt macros that should not be used in the examples. Task-number: QTBUG-117147 Pick-to: 6.6 6.5 Change-Id: I6caa0a59f2ab4dfec6fb558a0896c27b05b6a5db Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'examples/corelib')
-rw-r--r--examples/corelib/threads/queuedcustomtype/main.cpp11
-rw-r--r--examples/corelib/threads/queuedcustomtype/renderthread.cpp2
-rw-r--r--examples/corelib/threads/queuedcustomtype/renderthread.h3
-rw-r--r--examples/corelib/threads/queuedcustomtype/window.cpp11
-rw-r--r--examples/corelib/threads/queuedcustomtype/window.h11
5 files changed, 28 insertions, 10 deletions
diff --git a/examples/corelib/threads/queuedcustomtype/main.cpp b/examples/corelib/threads/queuedcustomtype/main.cpp
index 0cf019990a..28e7687f02 100644
--- a/examples/corelib/threads/queuedcustomtype/main.cpp
+++ b/examples/corelib/threads/queuedcustomtype/main.cpp
@@ -1,12 +1,17 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <QApplication>
-#include <QPainter>
-#include <QTime>
#include "block.h"
#include "window.h"
+#include <QApplication>
+#include <QBrush>
+#include <QImage>
+#include <QPainter>
+#include <QPen>
+#include <QPointF>
+#include <QRect>
+
QImage createImage(int width, int height)
{
QImage image(width, height, QImage::Format_RGB16);
diff --git a/examples/corelib/threads/queuedcustomtype/renderthread.cpp b/examples/corelib/threads/queuedcustomtype/renderthread.cpp
index d7b2172608..deb518e2b1 100644
--- a/examples/corelib/threads/queuedcustomtype/renderthread.cpp
+++ b/examples/corelib/threads/queuedcustomtype/renderthread.cpp
@@ -1,9 +1,11 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include "block.h"
#include "renderthread.h"
#include <QRandomGenerator>
+#include <QRgb>
RenderThread::RenderThread(QObject *parent)
: QThread(parent)
diff --git a/examples/corelib/threads/queuedcustomtype/renderthread.h b/examples/corelib/threads/queuedcustomtype/renderthread.h
index afbc70ec75..2946f1ee33 100644
--- a/examples/corelib/threads/queuedcustomtype/renderthread.h
+++ b/examples/corelib/threads/queuedcustomtype/renderthread.h
@@ -7,7 +7,8 @@
#include <QImage>
#include <QMutex>
#include <QThread>
-#include "block.h"
+
+class Block;
//! [RenderThread class definition]
class RenderThread : public QThread
diff --git a/examples/corelib/threads/queuedcustomtype/window.cpp b/examples/corelib/threads/queuedcustomtype/window.cpp
index 1adfe7ed38..a91b2e6b8d 100644
--- a/examples/corelib/threads/queuedcustomtype/window.cpp
+++ b/examples/corelib/threads/queuedcustomtype/window.cpp
@@ -1,8 +1,17 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#include "block.h"
+#include "renderthread.h"
#include "window.h"
-#include <QtWidgets>
+
+#include <QFileDialog>
+#include <QGuiApplication>
+#include <QHBoxLayout>
+#include <QImageReader>
+#include <QPainter>
+#include <QScreen>
+#include <QVBoxLayout>
//! [Window constructor start]
Window::Window(QWidget *parent)
diff --git a/examples/corelib/threads/queuedcustomtype/window.h b/examples/corelib/threads/queuedcustomtype/window.h
index b1ab4f6c24..a4f995696e 100644
--- a/examples/corelib/threads/queuedcustomtype/window.h
+++ b/examples/corelib/threads/queuedcustomtype/window.h
@@ -4,13 +4,14 @@
#ifndef WINDOW_H
#define WINDOW_H
+#include <QImage>
+#include <QLabel>
+#include <QPixmap>
+#include <QPushButton>
#include <QWidget>
-#include "renderthread.h"
-QT_BEGIN_NAMESPACE
-class QLabel;
-class QPushButton;
-QT_END_NAMESPACE
+class Block;
+class RenderThread;
//! [Window class definition]
class Window : public QWidget