From 7dcbd519c418e8f48fb90c90e3b0224017296632 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 25 Nov 2014 09:49:07 +0100 Subject: don't use QCursor if QT_NO_CURSOR to support configure -no-feature-CURSOR Change-Id: I8e7f9a7f80d3d44a1f8e25b909d552351b5f37e4 Reviewed-by: Friedemann Kleint --- src/gui/kernel/qevent.cpp | 4 ++++ src/gui/kernel/qplatformwindow.cpp | 2 ++ src/gui/kernel/qshapedpixmapdndwindow.cpp | 2 ++ 3 files changed, 8 insertions(+) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index a8539e8013..a8c34a8871 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 } @@ -1545,7 +1547,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/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index bd5e21c485..754395592c 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 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 *) -- cgit v1.2.3 From c91c05b056c769c3df0d7634aed7d9bf2c0e550d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 17 Nov 2014 12:26:00 +0100 Subject: Add capabilities to QPlatformInputContext. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a capability enumeration to QPlatformInputContext and use that to turn off input methods for hidden text depending on platform support. Disable on Windows. Task-number: QTBUG-40691 Change-Id: I9909005de1f21316ec8f64e2729f1fffcd37c7c3 Reviewed-by: Lars Knoll Reviewed-by: Björn Breitmeyer Reviewed-by: Liang Qi --- src/gui/kernel/qguiapplication.cpp | 12 +++++++++--- src/gui/kernel/qplatforminputcontext.cpp | 11 +++++++++++ src/gui/kernel/qplatforminputcontext.h | 5 +++++ 3 files changed, 25 insertions(+), 3 deletions(-) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index fe92ead846..8983a6fbb2 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3400,15 +3400,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(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 @@ -91,6 +91,17 @@ bool QPlatformInputContext::isValid() const return false; } +/*! + 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(); -- cgit v1.2.3 From b9d98c10bdc3c8e6330e84cca48ea302e8cd61c3 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 25 Nov 2014 09:47:43 +0100 Subject: Deprecate implementations of functions deprecated in headers If you build with configure -DQT_NO_DEPRECATED this will avoid some build errors. Change-Id: If2b2e57b6919091f3f077ebc2aeca0c3fd2421aa Reviewed-by: Olivier Goffart Reviewed-by: Konstantin Ritt --- src/gui/kernel/qsurfaceformat.cpp | 2 ++ src/gui/kernel/qsurfaceformat.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src/gui/kernel') 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); -- cgit v1.2.3 From 8d2d4255c61fb1daf8335285306c40d704f18742 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 24 Nov 2014 13:54:56 +0100 Subject: Clarify QGuiApplication::primaryScreen Clarify that shown here refers to where they are shown initially. Change-Id: I962fd4b98d80fb1d43e086660fb74eea6b8f532a Reviewed-by: Laszlo Agocs --- src/gui/kernel/qguiapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 8983a6fbb2..e3f4794e6d 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -874,7 +874,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() { -- cgit v1.2.3 From cb679241b1df9117ef50664dcf5549341bac8c3e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 28 Oct 2014 14:20:46 +0100 Subject: Implement heightForWidth(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a virtual function QWindowPrivate::closestAcceptableGeometry() which is called from the platform plugin. Task-number: QTBUG-36220 Task-number: QTBUG-36318 Change-Id: I2b3d205e2c75f1d4dd2ba1d333b0d89bc0fcf13a Reviewed-by: Jan Arve Sæther --- src/gui/kernel/qwindow.cpp | 9 +++++++++ src/gui/kernel/qwindow_p.h | 1 + 2 files changed, 10 insertions(+) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index c6dd0955aa..c5d88b198b 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -411,6 +411,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 46dc2e463c..bc5dfa4876 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -132,6 +132,7 @@ public: void emitScreenChangedRecursion(QScreen *newScreen); virtual void clearFocusObject(); + virtual QRectF closestAcceptableGeometry(const QRectF &rect) const; QWindow::SurfaceType surfaceType; Qt::WindowFlags windowFlags; -- cgit v1.2.3