diff options
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qcoreevent.cpp | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreevent.h | 12 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 1bafb85c93..7491f8e539 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -302,10 +302,10 @@ QEvent::QEvent(Type type) } /*! + \fn QEvent::QEvent(const QEvent &other) \internal Copies the \a other event. */ -QEvent::QEvent(const QEvent &other) = default; /*! \internal @@ -334,13 +334,13 @@ QEvent::QEvent(const QEvent &other) = default; */ /*! + \fn QEvent &QEvent::operator=(const QEvent &other) \internal Attempts to copy the \a other event. Copying events is a bad idea, yet some Qt 4 code does it (notably, QApplication and the state machine). */ -QEvent &QEvent::operator=(const QEvent &other) = default; /*! Destroys the event. If it was \l{QCoreApplication::postEvent()}{posted}, diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 23503dee05..f6417438b1 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -46,12 +46,18 @@ QT_BEGIN_NAMESPACE +#define Q_EVENT_DISABLE_COPY(Class) \ +protected: \ + Class(const Class &) = default; \ + Class &operator=(const Class &other) = default class QEventPrivate; class Q_CORE_EXPORT QEvent // event base class { Q_GADGET QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) + + Q_EVENT_DISABLE_COPY(QEvent); public: enum Type { /* @@ -295,9 +301,7 @@ public: Q_ENUM(Type) explicit QEvent(Type type); - QEvent(const QEvent &other); virtual ~QEvent(); - QEvent &operator=(const QEvent &other); inline Type type() const { return static_cast<Type>(t); } inline bool spontaneous() const { return m_spont; } @@ -359,6 +363,7 @@ private: class Q_CORE_EXPORT QTimerEvent : public QEvent { + Q_EVENT_DISABLE_COPY(QTimerEvent); public: explicit QTimerEvent(int timerId); ~QTimerEvent(); @@ -374,6 +379,7 @@ class QObject; class Q_CORE_EXPORT QChildEvent : public QEvent { + Q_EVENT_DISABLE_COPY(QChildEvent); public: QChildEvent(Type type, QObject *child); ~QChildEvent(); @@ -390,6 +396,7 @@ protected: class Q_CORE_EXPORT QDynamicPropertyChangeEvent : public QEvent { + Q_EVENT_DISABLE_COPY(QDynamicPropertyChangeEvent); public: explicit QDynamicPropertyChangeEvent(const QByteArray &name); ~QDynamicPropertyChangeEvent(); @@ -404,6 +411,7 @@ private: class Q_CORE_EXPORT QDeferredDeleteEvent : public QEvent { + Q_EVENT_DISABLE_COPY(QDeferredDeleteEvent); public: explicit QDeferredDeleteEvent(); ~QDeferredDeleteEvent(); |