QtGui: Use Q_DISABLE_COPY_MOVE for QPA interface classes

Introduce Q_DISABLE_COPY_MOVE or replace existing Q_DISABLE_COPY
and add default constructors where needed.

Change-Id: Ibd14ee9d1d69e64f6289efe789d4b64a3d6cb998
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Friedemann Kleint 2018-11-26 11:03:36 +01:00
parent ac7265e950
commit a0f3b2b503
10 changed files with 23 additions and 10 deletions

View File

@ -61,6 +61,9 @@ QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QPlatformClipboard class Q_GUI_EXPORT QPlatformClipboard
{ {
public: public:
Q_DISABLE_COPY_MOVE(QPlatformClipboard)
QPlatformClipboard() = default;
virtual ~QPlatformClipboard(); virtual ~QPlatformClipboard();
virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard);

View File

@ -78,6 +78,8 @@ private:
class Q_GUI_EXPORT QPlatformCursor : public QObject { class Q_GUI_EXPORT QPlatformCursor : public QObject {
public: public:
Q_DISABLE_COPY_MOVE(QPlatformCursor)
enum Capability { enum Capability {
OverrideCursor = 0x1 OverrideCursor = 0x1
}; };

View File

@ -91,6 +91,8 @@ class Q_GUI_EXPORT QPlatformDrag
{ {
Q_DECLARE_PRIVATE(QPlatformDrag) Q_DECLARE_PRIVATE(QPlatformDrag)
public: public:
Q_DISABLE_COPY_MOVE(QPlatformDrag)
QPlatformDrag(); QPlatformDrag();
virtual ~QPlatformDrag(); virtual ~QPlatformDrag();
@ -108,8 +110,6 @@ public:
private: private:
QPlatformDragPrivate *d_ptr; QPlatformDragPrivate *d_ptr;
Q_DISABLE_COPY(QPlatformDrag)
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -84,6 +84,8 @@ class QVulkanInstance;
class Q_GUI_EXPORT QPlatformIntegration class Q_GUI_EXPORT QPlatformIntegration
{ {
public: public:
Q_DISABLE_COPY_MOVE(QPlatformIntegration)
enum Capability { enum Capability {
ThreadedPixmaps = 1, ThreadedPixmaps = 1,
OpenGL, OpenGL,
@ -199,6 +201,8 @@ public:
#endif #endif
protected: protected:
QPlatformIntegration() = default;
void screenAdded(QPlatformScreen *screen, bool isPrimary = false); void screenAdded(QPlatformScreen *screen, bool isPrimary = false);
void destroyScreen(QPlatformScreen *screen); void destroyScreen(QPlatformScreen *screen);
void setPrimaryScreen(QPlatformScreen *newPrimary); void setPrimaryScreen(QPlatformScreen *newPrimary);

View File

@ -80,6 +80,8 @@ class Q_GUI_EXPORT QPlatformScreen
Q_DECLARE_PRIVATE(QPlatformScreen) Q_DECLARE_PRIVATE(QPlatformScreen)
public: public:
Q_DISABLE_COPY_MOVE(QPlatformScreen)
enum SubpixelAntialiasingType { // copied from qfontengine_p.h since we can't include private headers enum SubpixelAntialiasingType { // copied from qfontengine_p.h since we can't include private headers
Subpixel_None, Subpixel_None,
Subpixel_RGB, Subpixel_RGB,
@ -164,8 +166,6 @@ protected:
QScopedPointer<QPlatformScreenPrivate> d_ptr; QScopedPointer<QPlatformScreenPrivate> d_ptr;
private: private:
Q_DISABLE_COPY(QPlatformScreen)
friend class QScreenPrivate; friend class QScreenPrivate;
}; };

View File

@ -58,6 +58,8 @@ class QUrl;
class Q_GUI_EXPORT QPlatformServices class Q_GUI_EXPORT QPlatformServices
{ {
public: public:
Q_DISABLE_COPY_MOVE(QPlatformServices)
QPlatformServices(); QPlatformServices();
virtual ~QPlatformServices() { } virtual ~QPlatformServices() { }

View File

@ -64,6 +64,8 @@ QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QPlatformSessionManager class Q_GUI_EXPORT QPlatformSessionManager
{ {
public: public:
Q_DISABLE_COPY_MOVE(QPlatformSessionManager)
explicit QPlatformSessionManager(const QString &id, const QString &key); explicit QPlatformSessionManager(const QString &id, const QString &key);
virtual ~QPlatformSessionManager(); virtual ~QPlatformSessionManager();
@ -101,8 +103,6 @@ private:
QStringList m_restartCommand; QStringList m_restartCommand;
QStringList m_discardCommand; QStringList m_discardCommand;
QSessionManager::RestartHint m_restartHint; QSessionManager::RestartHint m_restartHint;
Q_DISABLE_COPY(QPlatformSessionManager)
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -65,6 +65,8 @@ class QDebug;
class Q_GUI_EXPORT QPlatformSurface class Q_GUI_EXPORT QPlatformSurface
{ {
public: public:
Q_DISABLE_COPY_MOVE(QPlatformSurface)
virtual ~QPlatformSurface(); virtual ~QPlatformSurface();
virtual QSurfaceFormat format() const = 0; virtual QSurfaceFormat format() const = 0;

View File

@ -76,6 +76,8 @@ class Q_GUI_EXPORT QPlatformTheme
{ {
Q_DECLARE_PRIVATE(QPlatformTheme) Q_DECLARE_PRIVATE(QPlatformTheme)
public: public:
Q_DISABLE_COPY_MOVE(QPlatformTheme)
enum ThemeHint { enum ThemeHint {
CursorFlashTime, CursorFlashTime,
KeyboardInputInterval, KeyboardInputInterval,
@ -324,8 +326,6 @@ public:
protected: protected:
explicit QPlatformTheme(QPlatformThemePrivate *priv); explicit QPlatformTheme(QPlatformThemePrivate *priv);
QScopedPointer<QPlatformThemePrivate> d_ptr; QScopedPointer<QPlatformThemePrivate> d_ptr;
private:
Q_DISABLE_COPY(QPlatformTheme)
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -71,6 +71,8 @@ class Q_GUI_EXPORT QPlatformWindow : public QPlatformSurface
{ {
Q_DECLARE_PRIVATE(QPlatformWindow) Q_DECLARE_PRIVATE(QPlatformWindow)
public: public:
Q_DISABLE_COPY_MOVE(QPlatformWindow)
explicit QPlatformWindow(QWindow *window); explicit QPlatformWindow(QWindow *window);
~QPlatformWindow() override; ~QPlatformWindow() override;
@ -164,8 +166,6 @@ protected:
static QSize constrainWindowSize(const QSize &size); static QSize constrainWindowSize(const QSize &size);
QScopedPointer<QPlatformWindowPrivate> d_ptr; QScopedPointer<QPlatformWindowPrivate> d_ptr;
private:
Q_DISABLE_COPY(QPlatformWindow)
}; };
QT_END_NAMESPACE QT_END_NAMESPACE