diff options
Diffstat (limited to 'src/gui/kernel')
61 files changed, 238 insertions, 155 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 3c1b6b4e48..525871c89b 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -10,27 +10,27 @@ HEADERS += \ kernel/qgenericplugin_qpa.h \ kernel/qwindowsysteminterface_qpa.h \ kernel/qwindowsysteminterface_qpa_p.h \ - kernel/qplatformintegration_qpa.h \ - kernel/qplatformdrag_qpa.h \ - 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\ - kernel/qplatformthemefactory_qpa_p.h \ - kernel/qplatformthemeplugin_qpa.h \ - kernel/qplatformwindow_qpa.h \ - kernel/qplatformcursor_qpa.h \ - kernel/qplatformclipboard_qpa.h \ - kernel/qplatformnativeinterface_qpa.h \ + kernel/qplatformintegration.h \ + kernel/qplatformdrag.h \ + kernel/qplatformscreen.h \ + kernel/qplatformscreen_p.h \ + kernel/qplatforminputcontext.h \ + kernel/qplatforminputcontext_p.h \ + kernel/qplatformintegrationfactory_p.h \ + kernel/qplatformintegrationplugin.h \ + kernel/qplatformtheme.h\ + kernel/qplatformthemefactory_p.h \ + kernel/qplatformthemeplugin.h \ + kernel/qplatformwindow.h \ + kernel/qplatformcursor.h \ + kernel/qplatformclipboard.h \ + kernel/qplatformnativeinterface.h \ kernel/qsurfaceformat.h \ kernel/qguiapplication.h \ kernel/qguiapplication_p.h \ kernel/qwindow_p.h \ kernel/qwindow.h \ - kernel/qplatformsurface_qpa.h \ + kernel/qplatformsurface.h \ kernel/qsurface.h \ kernel/qclipboard.h \ kernel/qcursor.h \ @@ -55,10 +55,10 @@ HEADERS += \ kernel/qstylehints.h \ kernel/qtouchdevice.h \ kernel/qtouchdevice_p.h \ - kernel/qplatformsharedgraphicscache_qpa.h \ - kernel/qplatformdialoghelper_qpa.h \ - kernel/qplatformservices_qpa.h \ - kernel/qplatformscreenpageflipper_qpa.h + kernel/qplatformsharedgraphicscache.h \ + kernel/qplatformdialoghelper.h \ + kernel/qplatformservices.h \ + kernel/qplatformscreenpageflipper.h SOURCES += \ kernel/qclipboard_qpa.cpp \ @@ -107,7 +107,7 @@ SOURCES += \ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { HEADERS += \ - kernel/qplatformopenglcontext_qpa.h \ + kernel/qplatformopenglcontext.h \ kernel/qopenglcontext.h \ kernel/qopenglcontext_p.h diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp index 187e09253e..284775c4e2 100644 --- a/src/gui/kernel/qclipboard_qpa.cpp +++ b/src/gui/kernel/qclipboard_qpa.cpp @@ -45,8 +45,8 @@ #include "qmimedata.h" #include "private/qguiapplication_p.h" -#include "qplatformclipboard_qpa.h" -#include "qplatformintegration_qpa.h" +#include <qpa/qplatformclipboard.h> +#include <qpa/qplatformintegration.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp index 1c719c839e..cc9163fbc0 100644 --- a/src/gui/kernel/qcursor_qpa.cpp +++ b/src/gui/kernel/qcursor_qpa.cpp @@ -42,7 +42,7 @@ #include <qcursor.h> #include <qscreen.h> #include <private/qcursor_p.h> -#include <qplatformcursor_qpa.h> +#include <qpa/qplatformcursor.h> #include <private/qguiapplication_p.h> #include <qbitmap.h> diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp index 1ed4a96192..8182719830 100644 --- a/src/gui/kernel/qdnd.cpp +++ b/src/gui/kernel/qdnd.cpp @@ -59,8 +59,8 @@ #include "qimagewriter.h" #include "qdebug.h" #include <ctype.h> -#include <qplatformintegration_qpa.h> -#include <qplatformdrag_qpa.h> +#include <qpa/qplatformintegration.h> +#include <qpa/qplatformdrag.h> #include <private/qguiapplication_p.h> diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp index d4a7a9c20e..90da16f868 100644 --- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp +++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp @@ -79,12 +79,12 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, */ QObject *QGenericPluginFactory::create(const QString& key, const QString &specification) { - QString driver = key.toLower(); + const QString driver = key.toLower(); #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) #ifndef QT_NO_LIBRARY - if (QGenericPluginFactoryInterface *factory = qobject_cast<QGenericPluginFactoryInterface*>(loader()->instance(driver))) - return factory->create(driver, specification); + if (QObject *object = qLoadPlugin1<QObject, QGenericPluginFactoryInterface>(loader(), driver, specification)) + return object; #endif #endif return 0; @@ -101,11 +101,14 @@ QStringList QGenericPluginFactory::keys() #if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) #ifndef QT_NO_LIBRARY - QStringList plugins = loader()->keys(); - for (int i = 0; i < plugins.size(); ++i) { - if (!list.contains(plugins.at(i))) - list += plugins.at(i); - } + typedef QMultiMap<int, QString> PluginKeyMap; + typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator; + + const PluginKeyMap keyMap = loader()->keyMap(); + const PluginKeyMapConstIterator cend = keyMap.constEnd(); + for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) + if (!list.contains(it.value())) + list += it.value(); #endif //QT_NO_LIBRARY #endif //QT_MAKEDLL return list; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index b63ed78c4b..bdffb985f7 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -42,14 +42,15 @@ #include "qguiapplication.h" #include "private/qguiapplication_p.h" -#include "private/qplatformintegrationfactory_qpa_p.h" +#include <qpa/qplatformintegrationfactory_p.h> #include "private/qevent_p.h" #include "qfont.h" -#include "qplatformfontdatabase_qpa.h" -#include "qplatformwindow_qpa.h" -#include "qplatformnativeinterface_qpa.h" -#include "qplatformtheme_qpa.h" -#include "qplatformintegration_qpa.h" +#include <qpa/qplatformfontdatabase.h> +#include <qpa/qplatformwindow.h> +#include <qpa/qplatformnativeinterface.h> +#include <qpa/qplatformtheme.h> +#include <qpa/qplatformintegration.h> +#include <qpa/qplatformdrag.h> #include <QtCore/QAbstractEventDispatcher> #include <QtCore/QVariant> @@ -64,14 +65,14 @@ #include <private/qscreen_p.h> #include <private/qdrawhelper_p.h> -#include <QtGui/QPlatformIntegration> +#include <qpa/qplatformintegration.h> #include <QtGui/QGenericPluginFactory> #include <QtGui/qstylehints.h> #include <QtGui/qinputpanel.h> #include <QtGui/qpixmapcache.h> -#include <QtGui/qplatformtheme_qpa.h> -#include <QtGui/qplatforminputcontext_qpa.h> -#include <private/qplatforminputcontext_qpa_p.h> +#include <qpa/qplatformtheme.h> +#include <qpa/qplatforminputcontext.h> +#include <qpa/qplatforminputcontext_p.h> #include <QWindowSystemInterface> #include "private/qwindowsysteminterface_qpa_p.h" @@ -79,11 +80,11 @@ #include "private/qcursor_p.h" #include "private/qdnd_p.h" -#include <private/qplatformthemefactory_qpa_p.h> -#include "qplatformdrag_qpa.h" +#include <qpa/qplatformthemefactory_p.h> +#include <qpa/qplatformdrag.h> #ifndef QT_NO_CURSOR -#include "qplatformcursor_qpa.h" +#include <qpa/qplatformcursor.h> #endif #include <QtGui/QPixmap> @@ -1090,6 +1091,10 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv QGuiApplicationPrivate::reportLogicalDotsPerInchChange( static_cast<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *>(e)); break; + case QWindowSystemInterfacePrivate::ScreenRefreshRate: + QGuiApplicationPrivate::reportRefreshRateChange( + static_cast<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *>(e)); + break; case QWindowSystemInterfacePrivate::ThemeChange: QGuiApplicationPrivate::processThemeChanged( static_cast<QWindowSystemInterfacePrivate::ThemeChangeEvent *>(e)); @@ -1750,6 +1755,21 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch()); } +void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e) +{ + // This operation only makes sense after the QGuiApplication constructor runs + if (QCoreApplication::startingUp()) + return; + + if (!e->screen) + return; + + QScreen *s = e->screen.data(); + s->d_func()->refreshRate = e->rate; + + emit s->refreshRateChanged(s->refreshRate()); +} + void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e) { if (!e->exposed) diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 78641de55b..b7b8afc7ad 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -53,14 +53,13 @@ #include "private/qwindowsysteminterface_qpa_p.h" #include "private/qshortcutmap_p.h" -#include "qplatformdrag_qpa.h" - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QPlatformIntegration; class QPlatformTheme; +class QPlatformDragQtResponse; struct QDrawHelperGammaTables; class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate @@ -117,6 +116,7 @@ public: static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e); static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e); static void reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e); + static void reportRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e); static void processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce); static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e); diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp index 0e0bc7237a..a699938dc6 100644 --- a/src/gui/kernel/qinputmethod.cpp +++ b/src/gui/kernel/qinputmethod.cpp @@ -43,7 +43,7 @@ #include <private/qinputmethod_p.h> #include <qguiapplication.h> #include <qtimer.h> -#include <private/qplatforminputcontext_qpa_p.h> +#include <qpa/qplatforminputcontext_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h index 1e55b00318..ad3d2141c1 100644 --- a/src/gui/kernel/qinputmethod_p.h +++ b/src/gui/kernel/qinputmethod_p.h @@ -46,8 +46,8 @@ #include <private/qobject_p.h> #include <QtCore/QWeakPointer> #include <QTransform> -#include <qplatforminputcontext_qpa.h> -#include <qplatformintegration_qpa.h> +#include <qpa/qplatforminputcontext.h> +#include <qpa/qplatformintegration.h> #include <private/qguiapplication_p.h> QT_BEGIN_HEADER diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index d03294f246..f94c6d541e 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -41,7 +41,7 @@ #include "qkeysequence.h" #include "qkeysequence_p.h" -#include "qplatformtheme_qpa.h" +#include <qpa/qplatformtheme.h> #include "private/qguiapplication_p.h" #ifndef QT_NO_SHORTCUT @@ -246,6 +246,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni \row \li Refresh \li F5 \li F5 \li F5 \li Ctrl+R, F5 \row \li ZoomIn \li Ctrl+Plus \li Ctrl+Plus \li Ctrl+Plus \li Ctrl+Plus \row \li ZoomOut \li Ctrl+Minus \li Ctrl+Minus \li Ctrl+Minus \li Ctrl+Minus + \row \li FullScreen \li F11, Alt+Enter \li Ctrl+Meta+F \li F11, Ctrl+Shift+F \li Ctrl+F11 \row \li Print \li Ctrl+P \li Ctrl+P \li Ctrl+P \li Ctrl+P \row \li AddTab \li Ctrl+T \li Ctrl+T \li Ctrl+Shift+N, Ctrl+T \li Ctrl+T \row \li NextChild \li Ctrl+Tab, Forward, Ctrl+F6 \li Ctrl+}, Forward, Ctrl+Tab \li Ctrl+Tab, Forward, Ctrl+Comma \li Ctrl+Tab, Forward @@ -638,8 +639,9 @@ static const struct { { 0, 0 } }; -//Table of key bindings. It must be sorted on key sequence. -//A priority of 1 indicates that this is the primary key binding when multiple are defined. +// Table of key bindings. It must be sorted on key sequence: +// The integer value of VK_KEY | Modifier Keys (e.g., VK_META, and etc.) +// A priority of 1 indicates that this is the primary key binding when multiple are defined. enum KeyPlatform { KB_Win = (1 << QPlatformTheme::WindowsKeyboardScheme), @@ -671,6 +673,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::FindNext, 0, Qt::Key_F3, KB_X11}, {QKeySequence::FindNext, 1, Qt::Key_F3, KB_Win}, {QKeySequence::Refresh, 0, Qt::Key_F5, KB_Win | KB_X11}, + {QKeySequence::FullScreen, 1, Qt::Key_F11, KB_Win | KB_KDE}, {QKeySequence::Undo, 0, Qt::Key_F14, KB_X11}, //Undo on sun keyboards {QKeySequence::Copy, 0, Qt::Key_F16, KB_X11}, //Copy on sun keyboards {QKeySequence::Paste, 0, Qt::Key_F18, KB_X11}, //Paste on sun keyboards @@ -749,6 +752,8 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, KB_Win}, {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, KB_Mac}, {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_F6, KB_Win}, + {QKeySequence::FullScreen, 1, Qt::CTRL | Qt::Key_F11, KB_Gnome}, + {QKeySequence::FullScreen, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F, KB_KDE}, {QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Gnome | KB_Mac}, {QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Win}, {QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, KB_KDE}, @@ -769,6 +774,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, KB_Win}, {QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, KB_Win}, {QKeySequence::DeleteStartOfWord, 0, Qt::ALT | Qt::Key_Backspace, KB_Mac}, + {QKeySequence::FullScreen, 0, Qt::ALT | Qt::Key_Enter, KB_Win}, {QKeySequence::DeleteEndOfWord, 0, Qt::ALT | Qt::Key_Delete, KB_Mac}, {QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, KB_Win | KB_X11}, {QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, KB_Mac}, @@ -797,7 +803,8 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, KB_Mac}, {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, KB_Mac}, {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, KB_Mac}, - {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, KB_Mac} + {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, KB_Mac}, + {QKeySequence::FullScreen, 1, Qt::META | Qt::CTRL | Qt::Key_F, KB_Mac} }; const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate::keyBindings)/(sizeof(QKeyBinding)); @@ -879,6 +886,7 @@ const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate \value WhatsThis Activate "what's this". \value ZoomIn Zoom in. \value ZoomOut Zoom out. + \value FullScreen Toggle the window state to/from full screen. */ /*! diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h index c926e8de1a..4cae253b50 100644 --- a/src/gui/kernel/qkeysequence.h +++ b/src/gui/kernel/qkeysequence.h @@ -137,7 +137,8 @@ public: InsertLineSeparator, SaveAs, Preferences, - Quit + Quit, + FullScreen }; enum SequenceFormat { diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 4668f9e750..b99a4dbd04 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qplatformopenglcontext_qpa.h" -#include "qplatformintegration_qpa.h" +#include <qpa/qplatformopenglcontext.h> +#include <qpa/qplatformintegration.h> #include "qopenglcontext.h" #include "qopenglcontext_p.h" #include "qwindow.h" diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard.h index 95c8103b7e..95c8103b7e 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.h +++ b/src/gui/kernel/qplatformclipboard.h diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp index 7273450077..5a29606391 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.cpp +++ b/src/gui/kernel/qplatformclipboard_qpa.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qplatformclipboard_qpa.h" +#include "qplatformclipboard.h" #ifndef QT_NO_CLIPBOARD diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor.h index fb3e4604d2..1f339c86b7 100644 --- a/src/gui/kernel/qplatformcursor_qpa.h +++ b/src/gui/kernel/qplatformcursor.h @@ -57,7 +57,7 @@ #include <QtGui/QMouseEvent> #include <QtCore/QWeakPointer> #include <QtCore/QObject> -#include <QtGui/QPlatformScreen> +#include <qpa/qplatformscreen.h> #include <QtGui/QCursor> QT_BEGIN_HEADER diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp index 5ea080c40a..40b7967af7 100644 --- a/src/gui/kernel/qplatformcursor_qpa.cpp +++ b/src/gui/kernel/qplatformcursor_qpa.cpp @@ -38,13 +38,13 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qplatformcursor_qpa.h" +#include "qplatformcursor.h" #include <QPainter> #include <QBitmap> #include <QGuiApplication> #include <QScreen> -#include <QPlatformScreen> +#include <qpa/qplatformscreen.h> #include <private/qguiapplication_p.h> #include <QDebug> diff --git a/src/gui/kernel/qplatformdialoghelper_qpa.h b/src/gui/kernel/qplatformdialoghelper.h index 5cd3ab055b..5966a241ea 100644 --- a/src/gui/kernel/qplatformdialoghelper_qpa.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -90,26 +90,20 @@ public: virtual QVariant styleHint(StyleHint hint) const; - virtual void platformNativeDialogModalHelp() = 0; - virtual void _q_platformRunNativeAppModalPanel() = 0; + virtual void exec_sys() = 0; virtual void deleteNativeDialog_sys() = 0; + virtual bool show_sys(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) = 0; virtual void hide_sys() = 0; - virtual DialogCode dialogResultCode_sys() = 0; - static QVariant defaultStyleHint(QPlatformDialogHelper::StyleHint hint); Q_SIGNALS: - void launchNativeAppModalPanel(); void accept(); void reject(); - -protected Q_SLOTS: - void emitLaunchNativeAppModalPanel(); }; class Q_GUI_EXPORT QColorDialogOptions diff --git a/src/gui/kernel/qplatformdialoghelper_qpa.cpp b/src/gui/kernel/qplatformdialoghelper_qpa.cpp index f2114d17e0..f00437f69b 100644 --- a/src/gui/kernel/qplatformdialoghelper_qpa.cpp +++ b/src/gui/kernel/qplatformdialoghelper_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformdialoghelper_qpa.h" +#include "qplatformdialoghelper.h" #include <QtCore/QVariant> #include <QtCore/QSharedData> @@ -94,11 +94,6 @@ QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHi return QVariant(); } -void QPlatformDialogHelper::emitLaunchNativeAppModalPanel() -{ - emit launchNativeAppModalPanel(); -} - // Font dialog class QFontDialogOptionsPrivate : public QSharedData diff --git a/src/gui/kernel/qplatformdrag_qpa.h b/src/gui/kernel/qplatformdrag.h index 14282c5a21..14282c5a21 100644 --- a/src/gui/kernel/qplatformdrag_qpa.h +++ b/src/gui/kernel/qplatformdrag.h diff --git a/src/gui/kernel/qplatformdrag_qpa.cpp b/src/gui/kernel/qplatformdrag_qpa.cpp index d9fc3a2ab8..8367ad8e06 100644 --- a/src/gui/kernel/qplatformdrag_qpa.cpp +++ b/src/gui/kernel/qplatformdrag_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformdrag_qpa.h" +#include "qplatformdrag.h" #include <QtGui/private/qdnd_p.h> #include <QtGui/QKeyEvent> diff --git a/src/gui/kernel/qplatforminputcontext_qpa.h b/src/gui/kernel/qplatforminputcontext.h index 696146b859..696146b859 100644 --- a/src/gui/kernel/qplatforminputcontext_qpa.h +++ b/src/gui/kernel/qplatforminputcontext.h diff --git a/src/gui/kernel/qplatforminputcontext_qpa_p.h b/src/gui/kernel/qplatforminputcontext_p.h index dc12d26ffc..dc12d26ffc 100644 --- a/src/gui/kernel/qplatforminputcontext_qpa_p.h +++ b/src/gui/kernel/qplatforminputcontext_p.h diff --git a/src/gui/kernel/qplatforminputcontext_qpa.cpp b/src/gui/kernel/qplatforminputcontext_qpa.cpp index 53839088c5..0a8633b61d 100644 --- a/src/gui/kernel/qplatforminputcontext_qpa.cpp +++ b/src/gui/kernel/qplatforminputcontext_qpa.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include <qplatforminputcontext_qpa.h> +#include "qplatforminputcontext.h" #include <qguiapplication.h> #include <QRect> #include "private/qkeymapper_p.h" -#include "private/qplatforminputcontext_qpa_p.h" +#include <qpa/qplatforminputcontext_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration.h index a44f4343ef..fb62dafc5c 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration.h @@ -54,7 +54,7 @@ // #include <QtGui/qwindowdefs.h> -#include <QtGui/qplatformscreen_qpa.h> +#include <qpa/qplatformscreen.h> #include <QtGui/qsurfaceformat.h> QT_BEGIN_HEADER diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 5269d8fb24..8e4ed05576 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -39,15 +39,15 @@ ** ****************************************************************************/ -#include "qplatformintegration_qpa.h" +#include "qplatformintegration.h" -#include <QtGui/QPlatformFontDatabase> -#include <QtGui/QPlatformClipboard> -#include <QtGui/QPlatformAccessibility> -#include <QtGui/QPlatformTheme> +#include <qpa/qplatformfontdatabase.h> +#include <qpa/qplatformclipboard.h> +#include <qpa/qplatformaccessibility.h> +#include <qpa/qplatformtheme.h> #include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qpixmap_raster_p.h> -#include <QtGui/private/qplatformscreen_qpa_p.h> +#include <qpa/qplatformscreen_p.h> #include <private/qdnd_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h b/src/gui/kernel/qplatformintegrationfactory_p.h index 4aae7898fa..4aae7898fa 100644 --- a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h +++ b/src/gui/kernel/qplatformintegrationfactory_p.h diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp index a84c243355..3b05742f09 100644 --- a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp +++ b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp @@ -39,10 +39,11 @@ ** ****************************************************************************/ -#include "qplatformintegrationfactory_qpa_p.h" -#include <QPlatformIntegrationPlugin> +#include <qpa/qplatformintegrationfactory_p.h> +#include <qpa/qplatformintegrationplugin.h> #include "private/qfactoryloader_p.h" #include "qmutex.h" +#include "qdir.h" #include "qguiapplication.h" #include "qdebug.h" @@ -58,26 +59,20 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key, const QString &platformPluginPath) { - QPlatformIntegration *ret = 0; QStringList paramList = key.split(QLatin1Char(':')); - QString platform = paramList.takeFirst().toLower(); + const QString platform = paramList.takeFirst().toLower(); #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) // Try loading the plugin from platformPluginPath first: if (!platformPluginPath.isEmpty()) { QCoreApplication::addLibraryPath(platformPluginPath); - if (QPlatformIntegrationFactoryInterface *factory = - qobject_cast<QPlatformIntegrationFactoryInterface*>(directLoader()->instance(platform))) - ret = factory->create(key, paramList); - - if (ret) + if (QPlatformIntegration *ret = qLoadPlugin1<QPlatformIntegration, QPlatformIntegrationFactoryInterface >(directLoader(), platform, paramList)) return ret; } - if (QPlatformIntegrationFactoryInterface *factory = qobject_cast<QPlatformIntegrationFactoryInterface*>(loader()->instance(platform))) - ret = factory->create(platform, paramList); + if (QPlatformIntegration *ret = qLoadPlugin1<QPlatformIntegration, QPlatformIntegrationFactoryInterface >(loader(), platform, paramList)) + return ret; #endif - - return ret; + return 0; } /*! @@ -86,23 +81,28 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key, co \sa create() */ + QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath) { #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QStringList list; - if (!platformPluginPath.isEmpty()) { QCoreApplication::addLibraryPath(platformPluginPath); - foreach (const QString &key, directLoader()->keys()) { - list += key + QString(QLatin1String(" (from %1)")).arg(platformPluginPath); + list = directLoader()->keyMap().values(); + if (!list.isEmpty()) { + const QString postFix = QStringLiteral(" (from ") + + QDir::toNativeSeparators(platformPluginPath) + + QLatin1Char(')'); + const QStringList::iterator end = list.end(); + for (QStringList::iterator it = list.begin(); it != end; ++it) + (*it).append(postFix); } } - - list += loader()->keys(); + list.append(loader()->keyMap().values()); + return list; #else - QStringList list; + return QStringList(); #endif - return list; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.h b/src/gui/kernel/qplatformintegrationplugin.h index d70569cbba..d70569cbba 100644 --- a/src/gui/kernel/qplatformintegrationplugin_qpa.h +++ b/src/gui/kernel/qplatformintegrationplugin.h diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp index 7bd1caa1d3..d4debd1f3a 100644 --- a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp +++ b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformintegrationplugin_qpa.h" +#include "qplatformintegrationplugin.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface.h index 918ba4a9b8..918ba4a9b8 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.h +++ b/src/gui/kernel/qplatformnativeinterface.h diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp index c17eee4415..f0bd3f0658 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformnativeinterface_qpa.h" +#include "qplatformnativeinterface.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.h b/src/gui/kernel/qplatformopenglcontext.h index ddcb87ad5a..ddcb87ad5a 100644 --- a/src/gui/kernel/qplatformopenglcontext_qpa.h +++ b/src/gui/kernel/qplatformopenglcontext.h diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.cpp b/src/gui/kernel/qplatformopenglcontext_qpa.cpp index 33adc26482..d38a5864d6 100644 --- a/src/gui/kernel/qplatformopenglcontext_qpa.cpp +++ b/src/gui/kernel/qplatformopenglcontext_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformopenglcontext_qpa.h" +#include "qplatformopenglcontext.h" #include <QOpenGLFunctions> diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen.h index 71d734867e..1743024d91 100644 --- a/src/gui/kernel/qplatformscreen_qpa.h +++ b/src/gui/kernel/qplatformscreen.h @@ -63,7 +63,7 @@ #include <QtGui/qcursor.h> #include <QtGui/qimage.h> #include <QtGui/qwindowdefs.h> -#include <QtGui/qplatformpixmap_qpa.h> +#include <qpa/qplatformpixmap.h> QT_BEGIN_HEADER @@ -101,6 +101,8 @@ public: virtual QSizeF physicalSize() const; virtual QDpi logicalDpi() const; + virtual qreal refreshRate() const; + virtual Qt::ScreenOrientation orientation() const; virtual QWindow *topLevelAt(const QPoint &point) const; diff --git a/src/gui/kernel/qplatformscreen_qpa_p.h b/src/gui/kernel/qplatformscreen_p.h index ced66be8d7..ced66be8d7 100644 --- a/src/gui/kernel/qplatformscreen_qpa_p.h +++ b/src/gui/kernel/qplatformscreen_p.h diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp index 022f198073..1fd96a80a5 100644 --- a/src/gui/kernel/qplatformscreen_qpa.cpp +++ b/src/gui/kernel/qplatformscreen_qpa.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#include "qplatformscreen_qpa.h" +#include "qplatformscreen.h" #include <QtGui/qguiapplication.h> -#include <QtGui/qplatformcursor_qpa.h> +#include <qpa/qplatformcursor.h> #include <QtGui/private/qguiapplication_p.h> -#include <QtGui/private/qplatformscreen_qpa_p.h> -#include <QtGui/qplatformintegration_qpa.h> +#include <qpa/qplatformscreen_p.h> +#include <qpa/qplatformintegration.h> #include <QtGui/qscreen.h> #include <QtGui/qwindow.h> @@ -123,8 +123,8 @@ QScreen *QPlatformScreen::screen() const /*! Reimplement this function in subclass to return the physical size of the - screen. The physical size represents the actual physical dimensions of - the display. + screen, in millimeters. The physical size represents the actual physical + dimensions of the display. The default implementation takes the pixel size of the screen, considers a resolution of 100 dots per inch, and returns the calculated physical size. @@ -161,6 +161,17 @@ QDpi QPlatformScreen::logicalDpi() const } /*! + Reimplement this function in subclass to return the vertical refresh rate + of the screen, in Hz. + + The default returns 60, a sensible default for modern displays. +*/ +qreal QPlatformScreen::refreshRate() const +{ + return 60; +} + +/*! Reimplement this function in subclass to return the current orientation of the screen, for example based on accelerometer data to determine the device orientation. diff --git a/src/gui/kernel/qplatformscreenpageflipper_qpa.h b/src/gui/kernel/qplatformscreenpageflipper.h index 116d2dbf82..116d2dbf82 100644 --- a/src/gui/kernel/qplatformscreenpageflipper_qpa.h +++ b/src/gui/kernel/qplatformscreenpageflipper.h diff --git a/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp b/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp index b912c6055e..babecb061f 100644 --- a/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp +++ b/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformscreenpageflipper_qpa.h" +#include "qplatformscreenpageflipper.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformservices_qpa.h b/src/gui/kernel/qplatformservices.h index c9bfe020ab..c9bfe020ab 100644 --- a/src/gui/kernel/qplatformservices_qpa.h +++ b/src/gui/kernel/qplatformservices.h diff --git a/src/gui/kernel/qplatformservices_qpa.cpp b/src/gui/kernel/qplatformservices_qpa.cpp index 7993a82f4e..dac9e64e40 100644 --- a/src/gui/kernel/qplatformservices_qpa.cpp +++ b/src/gui/kernel/qplatformservices_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformservices_qpa.h" +#include "qplatformservices.h" #include <QtCore/QUrl> #include <QtCore/QString> diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h b/src/gui/kernel/qplatformsharedgraphicscache.h index 679b8ab7de..679b8ab7de 100644 --- a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h +++ b/src/gui/kernel/qplatformsharedgraphicscache.h diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp b/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp index 539bb1458f..a3bb8da358 100644 --- a/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp +++ b/src/gui/kernel/qplatformsharedgraphicscache_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformsharedgraphicscache_qpa.h" +#include "qplatformsharedgraphicscache.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformsurface_qpa.h b/src/gui/kernel/qplatformsurface.h index f64a697fc5..f64a697fc5 100644 --- a/src/gui/kernel/qplatformsurface_qpa.h +++ b/src/gui/kernel/qplatformsurface.h diff --git a/src/gui/kernel/qplatformsurface_qpa.cpp b/src/gui/kernel/qplatformsurface_qpa.cpp index 1f752fe3e2..50cdd68ab6 100644 --- a/src/gui/kernel/qplatformsurface_qpa.cpp +++ b/src/gui/kernel/qplatformsurface_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformsurface_qpa.h" +#include "qplatformsurface.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformtheme_qpa.h b/src/gui/kernel/qplatformtheme.h index 8d936e8267..f4406ffabc 100644 --- a/src/gui/kernel/qplatformtheme_qpa.h +++ b/src/gui/kernel/qplatformtheme.h @@ -86,7 +86,8 @@ public: DialogButtonBoxLayout, DialogButtonBoxButtonsHaveIcons, UseFullScreenForPopupMenu, - KeyboardScheme + KeyboardScheme, + UiEffects }; enum DialogType { @@ -149,6 +150,17 @@ public: CdeKeyboardScheme }; + enum UiEffect + { + GeneralUiEffect = 0x1, + AnimateMenuUiEffect = 0x2, + FadeMenuUiEffect = 0x4, + AnimateComboUiEffect = 0x8, + AnimateTooltipUiEffect = 0x10, + FadeTooltipUiEffect = 0x20, + AnimateToolBoxUiEffect = 0x40 + }; + virtual ~QPlatformTheme(); virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const; diff --git a/src/gui/kernel/qplatformtheme_qpa.cpp b/src/gui/kernel/qplatformtheme_qpa.cpp index c6314825d7..c9ffbe248f 100644 --- a/src/gui/kernel/qplatformtheme_qpa.cpp +++ b/src/gui/kernel/qplatformtheme_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformtheme_qpa.h" +#include "qplatformtheme.h" #include <QtCore/QVariant> #include <QtCore/QStringList> @@ -99,6 +99,8 @@ QT_BEGIN_NAMESPACE \value KeyboardScheme (int) An integer value (enum KeyboardSchemes) specifying the keyboard scheme. + \value UiEffects (int) A flag value consisting of UiEffect values specifying the enabled UI animations. + \sa themeHint(), QStyle::pixelMetric() */ @@ -175,6 +177,8 @@ QVariant QPlatformTheme::themeHint(ThemeHint hint) const return QVariant(-1); case KeyboardScheme: return QVariant(int(WindowsKeyboardScheme)); + case UiEffects: + return QVariant(int(0)); } return QVariant(); } diff --git a/src/gui/kernel/qplatformthemefactory_qpa_p.h b/src/gui/kernel/qplatformthemefactory_p.h index 4d659812dc..4d659812dc 100644 --- a/src/gui/kernel/qplatformthemefactory_qpa_p.h +++ b/src/gui/kernel/qplatformthemefactory_p.h diff --git a/src/gui/kernel/qplatformthemefactory_qpa.cpp b/src/gui/kernel/qplatformthemefactory_qpa.cpp index c023a73e7e..c809a7fba3 100644 --- a/src/gui/kernel/qplatformthemefactory_qpa.cpp +++ b/src/gui/kernel/qplatformthemefactory_qpa.cpp @@ -39,8 +39,9 @@ ** ****************************************************************************/ -#include "qplatformthemefactory_qpa_p.h" -#include <QPlatformThemePlugin> +#include <qpa/qplatformthemefactory_p.h> +#include <qpa/qplatformthemeplugin.h> +#include <QDir> #include "private/qfactoryloader_p.h" #include "qmutex.h" @@ -58,26 +59,20 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString &platformPluginPath) { - QPlatformTheme *ret = 0; QStringList paramList = key.split(QLatin1Char(':')); - QString platform = paramList.takeFirst().toLower(); + const QString platform = paramList.takeFirst().toLower(); #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) // Try loading the plugin from platformPluginPath first: if (!platformPluginPath.isEmpty()) { QCoreApplication::addLibraryPath(platformPluginPath); - if (QPlatformThemeFactoryInterface *factory = - qobject_cast<QPlatformThemeFactoryInterface*>(directLoader()->instance(platform))) - ret = factory->create(key, paramList); - - if (ret) + if (QPlatformTheme *ret = qLoadPlugin1<QPlatformTheme, QPlatformThemeFactoryInterface>(directLoader(), platform, paramList)) return ret; } - if (QPlatformThemeFactoryInterface *factory = qobject_cast<QPlatformThemeFactoryInterface*>(loader()->instance(platform))) - ret = factory->create(platform, paramList); + if (QPlatformTheme *ret = qLoadPlugin1<QPlatformTheme, QPlatformThemeFactoryInterface>(loader(), platform, paramList)) + return ret; #endif - - return ret; + return 0; } /*! @@ -93,16 +88,21 @@ QStringList QPlatformThemeFactory::keys(const QString &platformPluginPath) if (!platformPluginPath.isEmpty()) { QCoreApplication::addLibraryPath(platformPluginPath); - foreach (const QString &key, directLoader()->keys()) { - list += key + QString(QLatin1String(" (from %1)")).arg(platformPluginPath); + list += directLoader()->keyMap().values(); + if (!list.isEmpty()) { + const QString postFix = QStringLiteral(" (from ") + + QDir::toNativeSeparators(platformPluginPath) + + QLatin1Char(')'); + const QStringList::iterator end = list.end(); + for (QStringList::iterator it = list.begin(); it != end; ++it) + (*it).append(postFix); } } - - list += loader()->keys(); + list += loader()->keyMap().values(); + return list; #else - QStringList list; + return QStringList(); #endif - return list; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.h b/src/gui/kernel/qplatformthemeplugin.h index 3ce7cc5b02..3ce7cc5b02 100644 --- a/src/gui/kernel/qplatformthemeplugin_qpa.h +++ b/src/gui/kernel/qplatformthemeplugin.h diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.cpp b/src/gui/kernel/qplatformthemeplugin_qpa.cpp index da2743d6e3..be18716b28 100644 --- a/src/gui/kernel/qplatformthemeplugin_qpa.cpp +++ b/src/gui/kernel/qplatformthemeplugin_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformthemeplugin_qpa.h" +#include "qplatformthemeplugin.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow.h index 729f35e025..0b4c675e56 100644 --- a/src/gui/kernel/qplatformwindow_qpa.h +++ b/src/gui/kernel/qplatformwindow.h @@ -58,8 +58,8 @@ #include <QtCore/qstring.h> #include <QtGui/qwindowdefs.h> #include <QtGui/qwindow.h> -#include <QtGui/qplatformopenglcontext_qpa.h> -#include <QtGui/qplatformsurface_qpa.h> +#include <qpa/qplatformopenglcontext.h> +#include <qpa/qplatformsurface.h> QT_BEGIN_HEADER diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp index b507eb4fdd..20817361f8 100644 --- a/src/gui/kernel/qplatformwindow_qpa.cpp +++ b/src/gui/kernel/qplatformwindow_qpa.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qplatformwindow_qpa.h" +#include "qplatformwindow.h" #include <QtGui/qwindowsysteminterface_qpa.h> #include <QtGui/qwindow.h> diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 3546ce01dd..2e0df43e66 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -42,7 +42,7 @@ #include "qscreen.h" #include "qscreen_p.h" #include "qpixmap.h" -#include "qplatformscreen_qpa.h" +#include <qpa/qplatformscreen.h> #include <QtCore/private/qobject_p.h> @@ -364,6 +364,16 @@ Qt::ScreenOrientation QScreen::orientation() const } /*! + \property QScreen::refreshRate + \brief the approximate vertical refresh rate of the screen in Hz +*/ +qreal QScreen::refreshRate() const +{ + Q_D(const QScreen); + return d->refreshRate; +} + +/*! \property QScreen::primaryOrientation \brief the primary screen orientation diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h index f69e04a595..17f3cd3d43 100644 --- a/src/gui/kernel/qscreen.h +++ b/src/gui/kernel/qscreen.h @@ -83,6 +83,7 @@ class Q_GUI_EXPORT QScreen : public QObject Q_PROPERTY(QRect availableGeometry READ availableGeometry NOTIFY availableGeometryChanged) Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ orientation NOTIFY primaryOrientationChanged) Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged) + Q_PROPERTY(qreal refreshRate READ refreshRate NOTIFY refreshRateChanged) public: QPlatformScreen *handle() const; @@ -127,6 +128,8 @@ public: QPixmap grabWindow(WId window, int x, int y, int w, int h); + qreal refreshRate() const; + Q_SIGNALS: void sizeChanged(const QSize &size); void geometryChanged(const QRect &geometry); @@ -140,6 +143,7 @@ Q_SIGNALS: void availableGeometryChanged(const QRect &rect); void primaryOrientationChanged(Qt::ScreenOrientation orientation); void orientationChanged(Qt::ScreenOrientation orientation); + void refreshRateChanged(qreal refreshRate); private: explicit QScreen(QPlatformScreen *screen); diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h index c6bf37e87a..b0e1b8671a 100644 --- a/src/gui/kernel/qscreen_p.h +++ b/src/gui/kernel/qscreen_p.h @@ -43,7 +43,7 @@ #define QSCREEN_P_H #include <QtGui/qscreen.h> -#include <QtGui/qplatformscreen_qpa.h> +#include <qpa/qplatformscreen.h> #include <QtCore/private/qobject_p.h> @@ -63,6 +63,7 @@ public: geometry = screen->geometry(); availableGeometry = screen->availableGeometry(); logicalDpi = screen->logicalDpi(); + refreshRate = screen->refreshRate(); updatePrimaryOrientation(); } @@ -74,6 +75,7 @@ public: QRect geometry; QRect availableGeometry; QDpi logicalDpi; + qreal refreshRate; QPlatformScreen *platformScreen; }; diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index 9384d34097..a98e5fbd76 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include <qstylehints.h> -#include <qplatformintegration_qpa.h> +#include <qpa/qplatformintegration.h> #include <private/qguiapplication_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 8b37fce50c..6183b3f6ac 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -41,11 +41,11 @@ #include "qwindow.h" -#include "qplatformwindow_qpa.h" -#include "qplatformintegration_qpa.h" +#include <qpa/qplatformwindow.h> +#include <qpa/qplatformintegration.h> #include "qsurfaceformat.h" #ifndef QT_NO_OPENGL -#include "qplatformopenglcontext_qpa.h" +#include <qpa/qplatformopenglcontext.h> #include "qopenglcontext.h" #endif #include "qscreen.h" diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index 0afd903ead..92eaf90188 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -43,7 +43,7 @@ #define QWINDOW_P_H #include <QtGui/qwindow.h> -#include <QtGui/qplatformwindow_qpa.h> +#include <qpa/qplatformwindow.h> #include <QtCore/private/qobject_p.h> diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index a0b77b8208..c3136b0b0a 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -39,13 +39,13 @@ ** ****************************************************************************/ #include "qwindowsysteminterface_qpa.h" -#include "qplatformwindow_qpa.h" +#include <qpa/qplatformwindow.h> #include "qwindowsysteminterface_qpa_p.h" #include "private/qguiapplication_p.h" #include "private/qevent_p.h" #include "private/qtouchdevice_p.h" #include <QAbstractEventDispatcher> -#include <QPlatformDrag> +#include <qpa/qplatformdrag.h> #include <qdebug.h> QT_BEGIN_NAMESPACE @@ -434,6 +434,13 @@ void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *scree QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } +void QWindowSystemInterface::handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate) +{ + QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e = + new QWindowSystemInterfacePrivate::ScreenRefreshRateEvent(screen, newRefreshRate); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + void QWindowSystemInterface::handleThemeChange(QWindow *tlw) { QWindowSystemInterfacePrivate::ThemeChangeEvent *e = new QWindowSystemInterfacePrivate::ThemeChangeEvent(tlw); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 1fbf430bf9..7e0ebf0efc 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -144,6 +144,7 @@ public: static void handleScreenGeometryChange(QScreen *screen, const QRect &newGeometry); static void handleScreenAvailableGeometryChange(QScreen *screen, const QRect &newAvailableGeometry); static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY); + static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate); static void handleThemeChange(QWindow *tlw); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index d7be7699e9..c7ad197b3c 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -66,6 +66,7 @@ public: ScreenGeometry, ScreenAvailableGeometry, ScreenLogicalDotsPerInch, + ScreenRefreshRate, ThemeChange, Expose }; @@ -233,6 +234,14 @@ public: qreal dpiY; }; + class ScreenRefreshRateEvent : public WindowSystemEvent { + public: + ScreenRefreshRateEvent(QScreen *s, qreal r) + : WindowSystemEvent(ScreenRefreshRate), screen(s), rate(r) { } + QWeakPointer<QScreen> screen; + qreal rate; + }; + class ThemeChangeEvent : public WindowSystemEvent { public: explicit ThemeChangeEvent(QWindow * w) |