diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-04-10 12:48:01 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-04-10 15:31:45 +0200 |
commit | 143c4d3e13a430b951f4f4f8c28db14303f80605 (patch) | |
tree | 2b89637b93fc7d81c674106008566010f986d67c /src/gui/kernel | |
parent | a7ed81b557d593a8ddb43b71bf4bbf3b44ead070 (diff) | |
parent | e5337ad1b1fb02873ce7b5ca8db45f6fd8063352 (diff) |
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
configure
src/widgets/styles/qwindowsxpstyle.cpp
tests/auto/gui/kernel/qwindow/qwindow.pro
tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/kernel.pri | 1 | ||||
-rw-r--r-- | src/gui/kernel/qcursor.cpp | 17 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 62 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 6 | ||||
-rw-r--r-- | src/gui/kernel/qinputmethod.cpp | 19 | ||||
-rw-r--r-- | src/gui/kernel/qinputmethod_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qpalette.h | 6 | ||||
-rw-r--r-- | src/gui/kernel/qplatforminputcontext_qpa.cpp | 26 | ||||
-rw-r--r-- | src/gui/kernel/qplatforminputcontext_qpa.h | 14 | ||||
-rw-r--r-- | src/gui/kernel/qplatforminputcontext_qpa_p.h | 67 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration_qpa.cpp | 3 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration_qpa.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qplatformsharedgraphicscache_qpa.h | 7 | ||||
-rw-r--r-- | src/gui/kernel/qstylehints.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qstylehints.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 29 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.h | 2 |
18 files changed, 238 insertions, 33 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 06773f58b5..b0fe871741 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -15,6 +15,7 @@ HEADERS += \ kernel/qplatformscreen_qpa.h \ kernel/qplatformscreen_qpa_p.h \ kernel/qplatforminputcontext_qpa.h \ + kernel/qplatforminputcontext_qpa_p.h \ kernel/qplatformintegrationfactory_qpa_p.h \ kernel/qplatformintegrationplugin_qpa.h \ kernel/qplatformtheme_qpa.h\ diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index 95b2b4a28e..476d3a449b 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -205,6 +205,13 @@ QT_BEGIN_NAMESPACE You can call QWidget::mapFromGlobal() to translate it to widget coordinates. + \note The position is queried from the windowing system. If mouse events are generated + via other means (e.g., via QWindowSystemInterface in a unit test), those fake mouse + moves will not be reflected in the returned value. + + \note On platforms where there is no windowing system or cursors are not available, the returned + position is based on the mouse move events generated via QWindowSystemInterface. + \sa setPos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal(), QGuiApplication::primaryScreen() */ @@ -218,6 +225,16 @@ QT_BEGIN_NAMESPACE You can call QWidget::mapToGlobal() to translate widget coordinates to global screen coordinates. + \note Calling this function results in changing the cursor position through the windowing + system. The windowing system will typically respond by sending mouse events to the application's + window. This means that the usage of this function should be avoided in unit tests and + everywhere where fake mouse events are being injected via QWindowSystemInterface because the + windowing system's mouse state (with regards to buttons for example) may not match the state in + the application-generated events. + + \note On platforms where there is no windowing system or cursors are not available, this + function may do nothing. + \sa pos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal() */ diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 5c419a79dd..6a93ef4d09 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -52,6 +52,7 @@ #include "qplatformintegration_qpa.h" #include <QtCore/QAbstractEventDispatcher> +#include <QtCore/QVariant> #include <QtCore/private/qcoreapplication_p.h> #include <QtCore/private/qabstracteventdispatcher_p.h> #include <QtCore/qmutex.h> @@ -61,13 +62,15 @@ #include <qpalette.h> #include <qscreen.h> #include <private/qscreen_p.h> +#include <private/qdrawhelper_p.h> #include <QtGui/QPlatformIntegration> #include <QtGui/QGenericPluginFactory> #include <QtGui/qstylehints.h> #include <QtGui/qinputpanel.h> #include <QtGui/qplatformtheme_qpa.h> - +#include <QtGui/qplatforminputcontext_qpa.h> +#include <private/qplatforminputcontext_qpa_p.h> #include <QWindowSystemInterface> #include "private/qwindowsysteminterface_qpa_p.h" @@ -142,6 +145,8 @@ static QBasicMutex applicationFontMutex; QFont *QGuiApplicationPrivate::app_font = 0; bool QGuiApplicationPrivate::obey_desktop_settings = true; +static qreal fontSmoothingGamma = 1.7; + extern void qRegisterGuiVariant(); extern void qInitDrawhelperAsm(); extern void qInitImageConversions(); @@ -575,13 +580,13 @@ static void init_platform(const QString &pluginArgument, const QString &platform nativeInterface->setProperty(name.constData(), value); } } + fontSmoothingGamma = QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::FontSmoothingGamma).toReal(); } static void init_plugins(const QList<QByteArray> &pluginList) { for (int i = 0; i < pluginList.count(); ++i) { QByteArray pluginSpec = pluginList.at(i); - qDebug() << "init_plugins" << i << pluginSpec; int colonPos = pluginSpec.indexOf(':'); QObject *plugin; if (colonPos < 0) @@ -589,7 +594,6 @@ static void init_plugins(const QList<QByteArray> &pluginList) else plugin = QGenericPluginFactory::create(QLatin1String(pluginSpec.mid(0, colonPos)), QLatin1String(pluginSpec.mid(colonPos+1))); - qDebug() << " created" << plugin; if (plugin) QGuiApplicationPrivate::generic_plugin_list.append(plugin); } @@ -597,12 +601,10 @@ static void init_plugins(const QList<QByteArray> &pluginList) void QGuiApplicationPrivate::createPlatformIntegration() { - Q_Q(QGuiApplication); - // Use the Qt menus by default. Platform plugins that // want to enable a native menu implementation can clear // this flag. - q->setAttribute(Qt::AA_DontUseNativeMenuBar, true); + QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); // Load the platform integration QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH")); @@ -706,6 +708,10 @@ void QGuiApplicationPrivate::init() argc = j; } + // Load environment exported generic plugins + foreach (const QByteArray &plugin, qgetenv("QT_QPA_GENERIC_PLUGINS").split(',')) + pluginList << plugin; + if (platform_integration == 0) createPlatformIntegration(); @@ -761,6 +767,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate() delete platform_theme; delete platform_integration; platform_integration = 0; + delete m_gammaTables.load(); } #if 0 @@ -1168,7 +1175,7 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate QFocusEvent focusOut(QEvent::FocusOut); QCoreApplication::sendSpontaneousEvent(previous, &focusOut); QObject::disconnect(previous, SIGNAL(focusObjectChanged(QObject*)), - qApp, SIGNAL(focusObjectChanged(QObject*))); + qApp, SLOT(q_updateFocusObject(QObject*))); } else { QEvent appActivate(QEvent::ApplicationActivate); qApp->sendSpontaneousEvent(qApp, &appActivate); @@ -1178,17 +1185,18 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate QFocusEvent focusIn(QEvent::FocusIn); QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn); QObject::connect(QGuiApplicationPrivate::focus_window, SIGNAL(focusObjectChanged(QObject*)), - qApp, SIGNAL(focusObjectChanged(QObject*))); + qApp, SLOT(q_updateFocusObject(QObject*))); } else { QEvent appActivate(QEvent::ApplicationDeactivate); qApp->sendSpontaneousEvent(qApp, &appActivate); } - if (self) + if (self) { self->notifyActiveWindowChange(previous); - if (previousFocusObject != qApp->focusObject()) - emit qApp->focusObjectChanged(qApp->focusObject()); + if (previousFocusObject != qApp->focusObject()) + self->q_updateFocusObject(qApp->focusObject()); + } } void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse) @@ -2160,4 +2168,36 @@ void QGuiApplicationPrivate::notifyThemeChanged() } } +const QDrawHelperGammaTables *QGuiApplicationPrivate::gammaTables() +{ + QDrawHelperGammaTables *result = m_gammaTables.load(); + if (!result){ + QDrawHelperGammaTables *tables = new QDrawHelperGammaTables(fontSmoothingGamma); + if (!m_gammaTables.testAndSetRelease(0, tables)) + delete tables; + result = m_gammaTables.load(); + } + return result; +} + +void QGuiApplicationPrivate::q_updateFocusObject(QObject *object) +{ + Q_Q(QGuiApplication); + + bool enabled = false; + if (object) { + QInputMethodQueryEvent query(Qt::ImEnabled); + QGuiApplication::sendEvent(object, &query); + enabled = query.value(Qt::ImEnabled).toBool(); + } + + QPlatformInputContextPrivate::setInputMethodAccepted(enabled); + QPlatformInputContext *inputContext = platformIntegration()->inputContext(); + if (inputContext) + inputContext->setFocusObject(object); + emit q->focusObjectChanged(object); +} + +#include "moc_qguiapplication.cpp" + QT_END_NAMESPACE diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index cc7dea422f..b58720db13 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -155,6 +155,8 @@ private: Q_DISABLE_COPY(QGuiApplication) Q_DECLARE_PRIVATE(QGuiApplication) + Q_PRIVATE_SLOT(d_func(), void q_updateFocusObject(QObject *object)) + #ifndef QT_NO_GESTURES friend class QGestureManager; #endif diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 6792e9382c..352917f2db 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE class QPlatformIntegration; class QPlatformTheme; +struct QDrawHelperGammaTables; class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate { @@ -141,6 +142,8 @@ public: QPixmap getPixmapCursor(Qt::CursorShape cshape); + void q_updateFocusObject(QObject *object); + static QGuiApplicationPrivate *instance() { return self; } static QString *platform_name; @@ -200,6 +203,8 @@ public: }; QHash<QWindow *, SynthesizedMouseData> synthesizedMousePoints; + const QDrawHelperGammaTables *gammaTables(); + protected: virtual void notifyThemeChanged(); @@ -209,6 +214,7 @@ private: static QGuiApplicationPrivate *self; static QTouchDevice *m_fakeTouchDevice; static int m_fakeMouseSourcePointId; + QAtomicPointer<QDrawHelperGammaTables> m_gammaTables; }; Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k); diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp index 23ab8535a0..c443a47cac 100644 --- a/src/gui/kernel/qinputmethod.cpp +++ b/src/gui/kernel/qinputmethod.cpp @@ -43,6 +43,7 @@ #include <private/qinputmethod_p.h> #include <qguiapplication.h> #include <qtimer.h> +#include <private/qplatforminputcontext_qpa_p.h> QT_BEGIN_NAMESPACE @@ -72,7 +73,7 @@ QInputMethod::~QInputMethod() information like virtual keyboard visibility and keyboard dimensions. Qt Quick also provides access to QInputMethod in QML through \l{QmlGlobalQtObject}{Qt global object} - as \c Qt.application.inputPanel property. + as \c Qt.inputMethod property. */ /*! @@ -295,8 +296,12 @@ void QInputMethod::update(Qt::InputMethodQueries queries) { Q_D(QInputMethod); - if (queries & Qt::ImEnabled) - d->q_checkFocusObject(qApp->focusObject()); + if (queries & Qt::ImEnabled) { + QObject *focus = qApp->focusObject(); + bool enabled = d->objectAcceptsInputMethod(focus); + setInputItem(enabled ? focus : 0); + QPlatformInputContextPrivate::setInputMethodAccepted(enabled); + } QPlatformInputContext *ic = d->platformInputContext(); if (ic) @@ -361,14 +366,20 @@ void QInputMethodPrivate::q_connectFocusObject() void QInputMethodPrivate::q_checkFocusObject(QObject *object) { Q_Q(QInputMethod); + bool enabled = objectAcceptsInputMethod(object); + q->setInputItem(enabled ? object : 0); +} +bool QInputMethodPrivate::objectAcceptsInputMethod(QObject *object) +{ bool enabled = false; if (object) { QInputMethodQueryEvent query(Qt::ImEnabled); QGuiApplication::sendEvent(object, &query); enabled = query.value(Qt::ImEnabled).toBool(); } - q->setInputItem(enabled ? object : 0); + + return enabled; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h index 8a17c85990..34a0430f10 100644 --- a/src/gui/kernel/qinputmethod_p.h +++ b/src/gui/kernel/qinputmethod_p.h @@ -71,6 +71,7 @@ public: } void q_connectFocusObject(); void q_checkFocusObject(QObject *object); + bool objectAcceptsInputMethod(QObject *object); QTransform inputItemTransform; QWeakPointer<QObject> inputItem; diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h index ca619a89b4..96295ab5db 100644 --- a/src/gui/kernel/qpalette.h +++ b/src/gui/kernel/qpalette.h @@ -86,12 +86,12 @@ public: enum ColorRole { WindowText, Button, Light, Midlight, Dark, Mid, Text, BrightText, ButtonText, Base, Window, Shadow, Highlight, HighlightedText, - Link, LinkVisited, // ### Qt 5: remove + Link, LinkVisited, AlternateBase, - NoRole, // ### Qt 5: value should be 0 or -1 + NoRole, ToolTipBase, ToolTipText, NColorRoles = ToolTipText + 1, - Foreground = WindowText, Background = Window // ### Qt 5: remove + Foreground = WindowText, Background = Window }; inline ColorGroup currentColorGroup() const { return static_cast<ColorGroup>(current_group); } diff --git a/src/gui/kernel/qplatforminputcontext_qpa.cpp b/src/gui/kernel/qplatforminputcontext_qpa.cpp index ee18f3ebd1..8612b4b42f 100644 --- a/src/gui/kernel/qplatforminputcontext_qpa.cpp +++ b/src/gui/kernel/qplatforminputcontext_qpa.cpp @@ -43,6 +43,7 @@ #include <qguiapplication.h> #include <QRect> #include "private/qkeymapper_p.h" +#include "private/qplatforminputcontext_qpa_p.h" QT_BEGIN_NAMESPACE @@ -75,6 +76,7 @@ QT_BEGIN_NAMESPACE \internal */ QPlatformInputContext::QPlatformInputContext() + : QObject(*(new QPlatformInputContextPrivate)) { } @@ -228,5 +230,29 @@ void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDir emit qApp->inputMethod()->inputDirectionChanged(newDirection); } +/*! + This virtual method gets called to notify updated focus to \a object. + \warning Input methods must not call this function directly. + */ +void QPlatformInputContext::setFocusObject(QObject *object) +{ + Q_UNUSED(object) +} + +/*! + Returns true if current focus object supports input method events. + */ +bool QPlatformInputContext::inputMethodAccepted() const +{ + return QPlatformInputContextPrivate::s_inputMethodAccepted; +} + +bool QPlatformInputContextPrivate::s_inputMethodAccepted = false; + +void QPlatformInputContextPrivate::setInputMethodAccepted(bool accepted) +{ + QPlatformInputContextPrivate::s_inputMethodAccepted = accepted; +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatforminputcontext_qpa.h b/src/gui/kernel/qplatforminputcontext_qpa.h index c7d823d662..5e8060c6e0 100644 --- a/src/gui/kernel/qplatforminputcontext_qpa.h +++ b/src/gui/kernel/qplatforminputcontext_qpa.h @@ -48,13 +48,13 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE - -class QWindow; -class QMouseEvent; +class QPlatformInputContextPrivate; class Q_GUI_EXPORT QPlatformInputContext : public QObject { Q_OBJECT + Q_DECLARE_PRIVATE(QPlatformInputContext) + public: QPlatformInputContext(); virtual ~QPlatformInputContext(); @@ -81,6 +81,14 @@ public: void emitLocaleChanged(); virtual Qt::LayoutDirection inputDirection() const; void emitInputDirectionChanged(Qt::LayoutDirection newDirection); + + virtual void setFocusObject(QObject *object); + bool inputMethodAccepted() const; + +private: + friend class QGuiApplication; + friend class QGuiApplicationPrivate; + friend class QInputMethod; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatforminputcontext_qpa_p.h b/src/gui/kernel/qplatforminputcontext_qpa_p.h new file mode 100644 index 0000000000..dc12d26ffc --- /dev/null +++ b/src/gui/kernel/qplatforminputcontext_qpa_p.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINPUTCONTEXT_P_H +#define QPLATFORMINPUTCONTEXT_P_H + +#include <private/qobject_p.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QPlatformInputContextPrivate: public QObjectPrivate +{ +public: + QPlatformInputContextPrivate() {} + ~QPlatformInputContextPrivate() {} + + static void setInputMethodAccepted(bool accepted); + static bool inputMethodAccepted(); + + static bool s_inputMethodAccepted; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 6879f0517e..5269d8fb24 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -247,6 +247,7 @@ QPlatformSharedGraphicsCache *QPlatformIntegration::createPlatformSharedGraphics */ QPaintEngine *QPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDevice) const { + Q_UNUSED(paintDevice) return 0; } @@ -293,6 +294,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const return false; case PasswordMaskDelay: return 0; + case FontSmoothingGamma: + return qreal(1.7); } return 0; diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 68dfc21833..fe40fd3dad 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -122,7 +122,8 @@ public: StartDragTime, KeyboardAutoRepeatRate, ShowIsFullScreen, - PasswordMaskDelay + PasswordMaskDelay, + FontSmoothingGamma }; virtual QVariant styleHint(StyleHint hint) const; diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h index f8ee201d85..8a92dbdd31 100644 --- a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h +++ b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h @@ -76,17 +76,18 @@ public: const QVector<QImage> &items) = 0; Q_INVOKABLE virtual void releaseItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) = 0; - virtual void serializeBuffer(void *bufferId, QByteArray *serializedData, int *fileDescriptor) const = 0; virtual uint textureIdForBuffer(void *bufferId) = 0; virtual void referenceBuffer(void *bufferId) = 0; virtual bool dereferenceBuffer(void *bufferId) = 0; + virtual QSize sizeOfBuffer(void *bufferId) = 0; + virtual void *eglImageForBuffer(void *bufferId) = 0; Q_SIGNALS: void itemsMissing(const QByteArray &cacheId, const QVector<quint32> &itemIds); - void itemsAvailable(const QByteArray &cacheId, void *bufferId, const QSize &bufferSize, + void itemsAvailable(const QByteArray &cacheId, void *bufferId, const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer); void itemsInvalidated(const QByteArray &cacheId, const QVector<quint32> &itemIds); - void itemsUpdated(const QByteArray &cacheId, void *bufferId, const QSize &bufferSize, + void itemsUpdated(const QByteArray &cacheId, void *bufferId, const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer); }; diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index 4970f6a26b..9384d34097 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -101,4 +101,9 @@ int QStyleHints::passwordMaskDelay() const return hint(QPlatformIntegration::PasswordMaskDelay).toInt(); } +qreal QStyleHints::fontSmoothingGamma() const +{ + return hint(QPlatformIntegration::FontSmoothingGamma).toReal(); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h index ae51ebc052..301b51868f 100644 --- a/src/gui/kernel/qstylehints.h +++ b/src/gui/kernel/qstylehints.h @@ -63,6 +63,7 @@ public: int cursorFlashTime() const; bool showIsFullScreen() const; int passwordMaskDelay() const; + qreal fontSmoothingGamma() const; private: friend class QGuiApplication; diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 85f619db31..d65998ce49 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -375,6 +375,8 @@ bool QWindow::isTopLevel() const Returns whether the window is modal. A modal window prevents other windows from getting any input. + + \sa QWindow::windowModality */ bool QWindow::isModal() const { @@ -382,26 +384,37 @@ bool QWindow::isModal() const return d->modality != Qt::NonModal; } -/*! - Returns the window's modality. +/*! \property QWindow::windowModality + \brief the modality of the window + + A modal window prevents other windows from receiving input events. Qt + supports two types of modality: Qt::WindowModal and Qt::ApplicationModal. - \sa setWindowModality() + By default, this property is Qt::NonModal + + \sa Qt::WindowModality */ + Qt::WindowModality QWindow::windowModality() const { Q_D(const QWindow); return d->modality; } -/*! - Sets the window's modality to \a windowModality. -*/ -void QWindow::setWindowModality(Qt::WindowModality windowModality) +void QWindow::setWindowModality(Qt::WindowModality modality) { Q_D(QWindow); - d->modality = windowModality; + if (d->modality == modality) + return; + d->modality = modality; + emit windowModalityChanged(modality); } +/*! \fn void QWindow::windowModalityChanged(Qt::WindowModality windowModality) + + This signal is emitted when the Qwindow::windowModality property changes to \a windowModality. +*/ + /*! Sets the window's surface \a format. diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 62ddb66a75..5cf6b413ba 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -85,6 +85,7 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface Q_DECLARE_PRIVATE(QWindow) Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) + Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality NOTIFY windowModalityChanged) Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged) Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged) Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged) @@ -255,6 +256,7 @@ public Q_SLOTS: Q_SIGNALS: void backBufferReady(); void screenChanged(QScreen *screen); + void windowModalityChanged(Qt::WindowModality windowModality); void xChanged(int arg); void yChanged(int arg); |