diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-11-27 18:28:12 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-11-27 18:28:12 +0100 |
commit | ce6990c3e742e0833df0561246554cf07a888efb (patch) | |
tree | 412380582040f5bb314eb90ae029b41a883aa439 /src/gui/kernel | |
parent | 09e674849a40f5eb7e9f95fd2a952c621aec86d1 (diff) | |
parent | fa9bde7d3a12ede956339c570f7b32f95d231e57 (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: Id20053d261b4fbbcc0ac8ba49dd3ef2253fa4b95
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 14 | ||||
-rw-r--r-- | src/gui/kernel/qplatforminputcontext.cpp | 11 | ||||
-rw-r--r-- | src/gui/kernel/qplatforminputcontext.h | 5 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qshapedpixmapdndwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qsurfaceformat.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qsurfaceformat.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 9 | ||||
-rw-r--r-- | src/gui/kernel/qwindow_p.h | 1 |
10 files changed, 48 insertions, 4 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index a0b6256e72..9eefa968ad 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -207,7 +207,9 @@ QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton but Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) : QInputEvent(type, modifiers), l(localPos), w(localPos), b(button), mouseState(buttons), caps(0) { +#ifndef QT_NO_CURSOR s = QCursor::pos(); +#endif } @@ -1594,7 +1596,9 @@ QContextMenuEvent::~QContextMenuEvent() QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos) : QInputEvent(ContextMenu), p(pos), reas(reason) { +#ifndef QT_NO_CURSOR gp = QCursor::pos(); +#endif } /*! diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index e421f79e91..ded3788dbf 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -869,7 +869,7 @@ QWindowList QGuiApplication::topLevelWindows() /*! Returns the primary (or default) screen of the application. - This will be the screen where QWindows are shown, unless otherwise specified. + This will be the screen where QWindows are initially shown, unless otherwise specified. */ QScreen *QGuiApplication::primaryScreen() { @@ -3386,15 +3386,21 @@ void QGuiApplicationPrivate::_q_updateFocusObject(QObject *object) { Q_Q(QGuiApplication); + QPlatformInputContext *inputContext = platformIntegration()->inputContext(); bool enabled = false; - if (object) { - QInputMethodQueryEvent query(Qt::ImEnabled); + if (object && inputContext) { + QInputMethodQueryEvent query(Qt::ImEnabled | Qt::ImHints); QGuiApplication::sendEvent(object, &query); enabled = query.value(Qt::ImEnabled).toBool(); + if (enabled) { + static const bool supportsHiddenText = inputContext->hasCapability(QPlatformInputContext::HiddenTextCapability); + const Qt::InputMethodHints hints = static_cast<Qt::InputMethodHints>(query.value(Qt::ImHints).toInt()); + if ((hints & Qt::ImhHiddenText) && !supportsHiddenText) + enabled = false; + } } QPlatformInputContextPrivate::setInputMethodAccepted(enabled); - QPlatformInputContext *inputContext = platformIntegration()->inputContext(); if (inputContext) inputContext->setFocusObject(object); emit q->focusObjectChanged(object); diff --git a/src/gui/kernel/qplatforminputcontext.cpp b/src/gui/kernel/qplatforminputcontext.cpp index 71dd609868..5937c65cc7 100644 --- a/src/gui/kernel/qplatforminputcontext.cpp +++ b/src/gui/kernel/qplatforminputcontext.cpp @@ -92,6 +92,17 @@ bool QPlatformInputContext::isValid() const } /*! + Returns whether the implementation supports \a capability. + \internal + \since 5.4 + */ +bool QPlatformInputContext::hasCapability(Capability capability) const +{ + Q_UNUSED(capability) + return true; +} + +/*! Method to be called when input method needs to be reset. Called by QInputMethod::reset(). No further QInputMethodEvents should be sent as response. */ diff --git a/src/gui/kernel/qplatforminputcontext.h b/src/gui/kernel/qplatforminputcontext.h index 7dd89ecd00..0c8953f89c 100644 --- a/src/gui/kernel/qplatforminputcontext.h +++ b/src/gui/kernel/qplatforminputcontext.h @@ -55,10 +55,15 @@ class Q_GUI_EXPORT QPlatformInputContext : public QObject Q_DECLARE_PRIVATE(QPlatformInputContext) public: + enum Capability { + HiddenTextCapability = 0x1 + }; + QPlatformInputContext(); virtual ~QPlatformInputContext(); virtual bool isValid() const; + virtual bool hasCapability(Capability capability) const; virtual void reset(); virtual void commit(); diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index c6e5cfb9d6..167bd44f0e 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -526,12 +526,14 @@ static inline const QScreen *effectiveScreen(const QWindow *window) if (!screen) return QGuiApplication::primaryScreen(); const QList<QScreen *> siblings = screen->virtualSiblings(); +#ifndef QT_NO_CURSOR if (siblings.size() > 1) { const QPoint referencePoint = window->transientParent() ? window->transientParent()->geometry().center() : QCursor::pos(); foreach (const QScreen *sibling, siblings) if (sibling->geometry().contains(referencePoint)) return sibling; } +#endif return screen; } diff --git a/src/gui/kernel/qshapedpixmapdndwindow.cpp b/src/gui/kernel/qshapedpixmapdndwindow.cpp index af60b36647..c8e9c2544d 100644 --- a/src/gui/kernel/qshapedpixmapdndwindow.cpp +++ b/src/gui/kernel/qshapedpixmapdndwindow.cpp @@ -88,12 +88,14 @@ void QShapedPixmapWindow::setHotspot(const QPoint &hotspot) void QShapedPixmapWindow::updateGeometry() { +#ifndef QT_NO_CURSOR QRect rect(QCursor::pos() - m_hotSpot, m_pixmap.size()); if (m_pixmap.isNull()) m_backingStore->resize(QSize(1,1)); else if (m_backingStore->size() != m_pixmap.size()) m_backingStore->resize(m_pixmap.size()); setGeometry(rect); +#endif } void QShapedPixmapWindow::exposeEvent(QExposeEvent *) diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 8049e303a7..b7f8e375a4 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -308,6 +308,7 @@ void QSurfaceFormat::setSamples(int numSamples) } } +#if QT_DEPRECATED_SINCE(5, 2) /*! \obsolete \overload @@ -343,6 +344,7 @@ bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOptions opt) const { return d->opts & opt; } +#endif // QT_DEPRECATED_SINCE(5, 2) /*! \since 5.3 diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h index 797331e5a7..b33f4d1f6b 100644 --- a/src/gui/kernel/qsurfaceformat.h +++ b/src/gui/kernel/qsurfaceformat.h @@ -119,8 +119,10 @@ public: bool stereo() const; void setStereo(bool enable); +#if QT_DEPRECATED_SINCE(5, 2) QT_DEPRECATED void setOption(QSurfaceFormat::FormatOptions opt); QT_DEPRECATED bool testOption(QSurfaceFormat::FormatOptions opt) const; +#endif void setOptions(QSurfaceFormat::FormatOptions options); void setOption(FormatOption option, bool on = true); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index fa99390af0..b9dba10f22 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -416,6 +416,15 @@ void QWindowPrivate::clearFocusObject() { } +// Allows for manipulating the suggested geometry before a resize/move +// event in derived classes for platforms that support it, for example to +// implement heightForWidth(). +QRectF QWindowPrivate::closestAcceptableGeometry(const QRectF &rect) const +{ + Q_UNUSED(rect) + return QRectF(); +} + /*! Sets the \a surfaceType of the window. diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index 40f23b1c36..c496d7716b 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -136,6 +136,7 @@ public: void emitScreenChangedRecursion(QScreen *newScreen); virtual void clearFocusObject(); + virtual QRectF closestAcceptableGeometry(const QRectF &rect) const; bool isPopup() const { return (windowFlags & Qt::WindowType_Mask) == Qt::Popup; } |