diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 119 | ||||
-rw-r--r-- | src/gui/kernel/qevent.h | 27 | ||||
-rw-r--r-- | src/gui/kernel/qevent_p.h | 51 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 18 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qguivariant.cpp | 11 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.h | 4 |
8 files changed, 49 insertions, 189 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 7ac5538d6e..266eb143e5 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2784,19 +2784,14 @@ QShowEvent::~QShowEvent() \note This class is currently supported for Mac OS X only. */ -QFileOpenEventPrivate::~QFileOpenEventPrivate() -{ -} - /*! \internal Constructs a file open event for the given \a file. */ QFileOpenEvent::QFileOpenEvent(const QString &file) - : QEvent(FileOpen), f(file) + : QEvent(FileOpen), f(file), m_url(QUrl::fromLocalFile(file)) { - d = reinterpret_cast<QEventPrivate *>(new QFileOpenEventPrivate(QUrl::fromLocalFile(file))); } /*! @@ -2805,10 +2800,8 @@ QFileOpenEvent::QFileOpenEvent(const QString &file) Constructs a file open event for the given \a url. */ QFileOpenEvent::QFileOpenEvent(const QUrl &url) - : QEvent(FileOpen) + : QEvent(FileOpen), f(url.toLocalFile()), m_url(url) { - d = reinterpret_cast<QEventPrivate *>(new QFileOpenEventPrivate(url)); - f = url.toLocalFile(); } @@ -2816,7 +2809,6 @@ QFileOpenEvent::QFileOpenEvent(const QUrl &url) */ QFileOpenEvent::~QFileOpenEvent() { - delete reinterpret_cast<QFileOpenEventPrivate *>(d); } /*! @@ -2832,10 +2824,6 @@ QFileOpenEvent::~QFileOpenEvent() \since 4.6 */ -QUrl QFileOpenEvent::url() const -{ - return reinterpret_cast<const QFileOpenEventPrivate *>(d)->url; -} /*! \fn bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const @@ -3263,25 +3251,16 @@ QDebug operator<<(QDebug dbg, const QEvent *e) { /*! \internal */ -QWindowStateChangeEvent::QWindowStateChangeEvent(Qt::WindowStates s) - : QEvent(WindowStateChange), ostate(s) -{ -} - -/*! \internal - */ QWindowStateChangeEvent::QWindowStateChangeEvent(Qt::WindowStates s, bool isOverride) - : QEvent(WindowStateChange), ostate(s) + : QEvent(WindowStateChange), ostate(s), m_override(isOverride) { - if (isOverride) - d = (QEventPrivate*)(this); } /*! \internal */ bool QWindowStateChangeEvent::isOverride() const { - return (d != 0); + return m_override; } /*! \internal @@ -4037,10 +4016,8 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags) The \a startPos is the position of a touch or mouse event that started the scrolling. */ QScrollPrepareEvent::QScrollPrepareEvent(const QPointF &startPos) - : QEvent(QEvent::ScrollPrepare) + : QEvent(QEvent::ScrollPrepare), m_target(0), m_startPos(startPos) { - d = reinterpret_cast<QEventPrivate *>(new QScrollPrepareEventPrivate()); - d_func()->startPos = startPos; } /*! @@ -4048,7 +4025,6 @@ QScrollPrepareEvent::QScrollPrepareEvent(const QPointF &startPos) */ QScrollPrepareEvent::~QScrollPrepareEvent() { - delete reinterpret_cast<QScrollPrepareEventPrivate *>(d); } /*! @@ -4056,7 +4032,7 @@ QScrollPrepareEvent::~QScrollPrepareEvent() */ QPointF QScrollPrepareEvent::startPos() const { - return d_func()->startPos; + return m_startPos; } /*! @@ -4066,7 +4042,7 @@ QPointF QScrollPrepareEvent::startPos() const */ QSizeF QScrollPrepareEvent::viewportSize() const { - return d_func()->viewportSize; + return m_viewportSize; } /*! @@ -4074,7 +4050,7 @@ QSizeF QScrollPrepareEvent::viewportSize() const */ QRectF QScrollPrepareEvent::contentPosRange() const { - return d_func()->contentPosRange; + return m_contentPosRange; } /*! @@ -4082,7 +4058,7 @@ QRectF QScrollPrepareEvent::contentPosRange() const */ QPointF QScrollPrepareEvent::contentPos() const { - return d_func()->contentPos; + return m_contentPos; } @@ -4093,7 +4069,7 @@ QPointF QScrollPrepareEvent::contentPos() const */ void QScrollPrepareEvent::setViewportSize(const QSizeF &size) { - d_func()->viewportSize = size; + m_viewportSize = size; } /*! @@ -4103,7 +4079,7 @@ void QScrollPrepareEvent::setViewportSize(const QSizeF &size) */ void QScrollPrepareEvent::setContentPosRange(const QRectF &rect) { - d_func()->contentPosRange = rect; + m_contentPosRange = rect; } /*! @@ -4113,27 +4089,11 @@ void QScrollPrepareEvent::setContentPosRange(const QRectF &rect) */ void QScrollPrepareEvent::setContentPos(const QPointF &pos) { - d_func()->contentPos = pos; + m_contentPos = pos; } /*! - \internal -*/ -QScrollPrepareEventPrivate *QScrollPrepareEvent::d_func() -{ - return reinterpret_cast<QScrollPrepareEventPrivate *>(d); -} - -/*! - \internal -*/ -const QScrollPrepareEventPrivate *QScrollPrepareEvent::d_func() const -{ - return reinterpret_cast<const QScrollPrepareEventPrivate *>(d); -} - -/*! \class QScrollEvent \since 4.8 \ingroup events @@ -4170,12 +4130,8 @@ const QScrollPrepareEventPrivate *QScrollPrepareEvent::d_func() const event is the first one, the last one or some event in between. */ QScrollEvent::QScrollEvent(const QPointF &contentPos, const QPointF &overshootDistance, ScrollState scrollState) - : QEvent(QEvent::Scroll) + : QEvent(QEvent::Scroll), m_contentPos(contentPos), m_overshoot(overshootDistance), m_state(scrollState) { - d = reinterpret_cast<QEventPrivate *>(new QScrollEventPrivate()); - d_func()->contentPos = contentPos; - d_func()->overshoot= overshootDistance; - d_func()->state = scrollState; } /*! @@ -4183,7 +4139,6 @@ QScrollEvent::QScrollEvent(const QPointF &contentPos, const QPointF &overshootDi */ QScrollEvent::~QScrollEvent() { - delete reinterpret_cast<QScrollEventPrivate *>(d); } /*! @@ -4191,7 +4146,7 @@ QScrollEvent::~QScrollEvent() */ QPointF QScrollEvent::contentPos() const { - return d_func()->contentPos; + return m_contentPos; } /*! @@ -4202,7 +4157,7 @@ QPointF QScrollEvent::contentPos() const */ QPointF QScrollEvent::overshootDistance() const { - return d_func()->overshoot; + return m_overshoot; } /*! @@ -4215,23 +4170,7 @@ QPointF QScrollEvent::overshootDistance() const */ QScrollEvent::ScrollState QScrollEvent::scrollState() const { - return d_func()->state; -} - -/*! - \internal -*/ -QScrollEventPrivate *QScrollEvent::d_func() -{ - return reinterpret_cast<QScrollEventPrivate *>(d); -} - -/*! - \internal -*/ -const QScrollEventPrivate *QScrollEvent::d_func() const -{ - return reinterpret_cast<const QScrollEventPrivate *>(d); + return m_state; } /*! @@ -4239,11 +4178,8 @@ const QScrollEventPrivate *QScrollEvent::d_func() const \a orientation is the new orientation of the screen. */ QScreenOrientationChangeEvent::QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation screenOrientation) - : QEvent(QEvent::OrientationChange) + : QEvent(QEvent::OrientationChange), m_screen(screen), m_orientation(screenOrientation) { - d = reinterpret_cast<QEventPrivate *>(new QScreenOrientationChangeEventPrivate()); - d_func()->screen = screen; - d_func()->orientation = screenOrientation; } /*! @@ -4251,7 +4187,6 @@ QScreenOrientationChangeEvent::QScreenOrientationChangeEvent(QScreen *screen, Qt */ QScreenOrientationChangeEvent::~QScreenOrientationChangeEvent() { - delete reinterpret_cast<QScrollEventPrivate *>(d); } /*! @@ -4259,7 +4194,7 @@ QScreenOrientationChangeEvent::~QScreenOrientationChangeEvent() */ QScreen *QScreenOrientationChangeEvent::screen() const { - return d_func()->screen; + return m_screen; } /*! @@ -4267,23 +4202,7 @@ QScreen *QScreenOrientationChangeEvent::screen() const */ Qt::ScreenOrientation QScreenOrientationChangeEvent::orientation() const { - return d_func()->orientation; -} - -/*! - \internal -*/ -QScreenOrientationChangeEventPrivate *QScreenOrientationChangeEvent::d_func() -{ - return reinterpret_cast<QScreenOrientationChangeEventPrivate *>(d); -} - -/*! - \internal -*/ -const QScreenOrientationChangeEventPrivate *QScreenOrientationChangeEvent::d_func() const -{ - return reinterpret_cast<const QScreenOrientationChangeEventPrivate *>(d); + return m_orientation; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index f611fe4ab7..96e630ed0a 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -53,6 +53,7 @@ #include <QtCore/qmap.h> #include <QtCore/qvector.h> #include <QtCore/qset.h> +#include <QtCore/qurl.h> #include <QtCore/qfile.h> #include <QtGui/qvector2d.h> #include <QtGui/qtouchdevice.h> @@ -647,10 +648,11 @@ public: ~QFileOpenEvent(); inline QString file() const { return f; } - QUrl url() const; + QUrl url() const { return m_url; } bool openFile(QFile &file, QIODevice::OpenMode flags) const; private: QString f; + QUrl m_url; }; #ifndef QT_NO_TOOLBAR @@ -686,8 +688,7 @@ protected: class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent { public: - explicit QWindowStateChangeEvent(Qt::WindowStates aOldState); - QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride); + explicit QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride = false); ~QWindowStateChangeEvent(); inline Qt::WindowStates oldState() const { return ostate; } @@ -695,6 +696,7 @@ public: private: Qt::WindowStates ostate; + bool m_override; }; #ifndef QT_NO_DEBUG_STREAM @@ -837,7 +839,6 @@ protected: Q_DECLARE_TYPEINFO(QTouchEvent::TouchPoint, Q_MOVABLE_TYPE); Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchEvent::TouchPoint::InfoFlags) -class QScrollPrepareEventPrivate; class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent { public: @@ -855,12 +856,14 @@ public: void setContentPos(const QPointF &pos); private: - QScrollPrepareEventPrivate *d_func(); - const QScrollPrepareEventPrivate *d_func() const; + QObject* m_target; + QPointF m_startPos; + QSizeF m_viewportSize; + QRectF m_contentPosRange; + QPointF m_contentPos; }; -class QScrollEventPrivate; class Q_GUI_EXPORT QScrollEvent : public QEvent { public: @@ -879,11 +882,11 @@ public: ScrollState scrollState() const; private: - QScrollEventPrivate *d_func(); - const QScrollEventPrivate *d_func() const; + QPointF m_contentPos; + QPointF m_overshoot; + QScrollEvent::ScrollState m_state; }; -class QScreenOrientationChangeEventPrivate; class Q_GUI_EXPORT QScreenOrientationChangeEvent : public QEvent { public: @@ -894,8 +897,8 @@ public: Qt::ScreenOrientation orientation() const; private: - QScreenOrientationChangeEventPrivate *d_func(); - const QScreenOrientationChangeEventPrivate *d_func() const; + QScreen *m_screen; + Qt::ScreenOrientation m_orientation; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index 18a13b73f5..4bf7dda8d2 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -92,57 +92,6 @@ public: QVector<QPointF> rawScreenPositions; }; -class QFileOpenEventPrivate -{ -public: - inline QFileOpenEventPrivate(const QUrl &url) - : url(url) - { - } - ~QFileOpenEventPrivate(); - - QUrl url; -}; - - -class QScrollPrepareEventPrivate -{ -public: - inline QScrollPrepareEventPrivate() - : target(0) - { - } - - QObject* target; - QPointF startPos; - QSizeF viewportSize; - QRectF contentPosRange; - QPointF contentPos; -}; - -class QScrollEventPrivate -{ -public: - inline QScrollEventPrivate() - { - } - - QPointF contentPos; - QPointF overshoot; - QScrollEvent::ScrollState state; -}; - -class QScreenOrientationChangeEventPrivate -{ -public: - inline QScreenOrientationChangeEventPrivate() - { - } - - QScreen *screen; - Qt::ScreenOrientation orientation; -}; - QT_END_NAMESPACE #endif // QEVENT_P_H diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index e7c2b60305..8fd4d4a2b3 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2154,12 +2154,20 @@ bool QGuiApplication::desktopSettingsAware() return QGuiApplicationPrivate::obey_desktop_settings; } -QInputMethod *QGuiApplication::inputMethod() const +/*! + returns the input method. + + The input method returns properties about the state and position of + the virtual keyboard. It also provides information about the position of the + current focused input element. + + \sa QInputPanel + */ +QInputMethod *QGuiApplication::inputMethod() { - Q_D(const QGuiApplication); - if (!d->inputMethod) - const_cast<QGuiApplicationPrivate *>(d)->inputMethod = new QInputMethod(); - return d->inputMethod; + if (!qGuiApp->d_func()->inputMethod) + qGuiApp->d_func()->inputMethod = new QInputMethod(); + return qGuiApp->d_func()->inputMethod; } /*! diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index a741d13eb3..9aad39ed47 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -133,7 +133,7 @@ public: #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED QInputPanel *inputPanel() const { return inputMethod(); } #endif - QInputMethod *inputMethod() const; + static QInputMethod *inputMethod(); static QPlatformNativeInterface *platformNativeInterface(); diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index 436688a295..9d1294d588 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -101,22 +101,13 @@ namespace { struct GuiTypesFilter { template<typename T> struct Acceptor { - static const bool IsAccepted = QTypeModuleInfo<T>::IsGui && QtMetaTypePrivate::TypeDefinition<T>::IsAvailable; + static const bool IsAccepted = QModulesPrivate::QTypeModuleInfo<T>::IsGui && QtMetaTypePrivate::TypeDefinition<T>::IsAvailable; }; }; static void construct(QVariant::Private *x, const void *copy) { const int type = x->type; - if (Q_UNLIKELY(type == 62)) { - // small 'trick' to let a QVariant(Qt::blue) create a variant - // of type QColor - // TODO Get rid of this hack. - x->type = QVariant::Color; - QColor color(*reinterpret_cast<const Qt::GlobalColor *>(copy)); - v_construct<QColor>(x, &color); - return; - } QVariantConstructor<GuiTypesFilter> constructor(x, copy); QMetaTypeSwitcher::switcher<void>(constructor, type, 0); } diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index fd271e6d6e..2117835609 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -264,12 +264,6 @@ void QWindow::setVisible(bool visible) } } -/*! - \fn bool QWindow::visible() const - Returns true if the window is set to visible. - \obsolete -*/ - bool QWindow::isVisible() const { Q_D(const QWindow); diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index c2c81fd2d7..e99c062158 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -102,10 +102,6 @@ public: void setSurfaceType(SurfaceType surfaceType); SurfaceType surfaceType() const; -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED inline bool visible() const { return isVisible(); } -#endif - bool isVisible() const; void create(); |