diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-11 08:24:34 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-11 08:25:04 +0100 |
commit | d456f87ece0323982b7601047712545ab95426ad (patch) | |
tree | 46b90468b01144615f280620d73763fc189d25ac /src/gui/kernel | |
parent | cc2938b5b6aa07210b04bd48ad8a2830701a06e5 (diff) | |
parent | 4fc070a4192d5b914b6f814a8dcab3f552d9abac (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
src/corelib/io/qfilesystemwatcher_win.cpp
src/corelib/plugin/plugin.pri
src/plugins/platforms/cocoa/qcocoaaccessibility.mm
tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
Change-Id: Id6824631252609a75eff8b68792e4d10095c8fc1
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 30 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 2 |
4 files changed, 30 insertions, 12 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index f98b4236fe..53599a3a37 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -244,11 +244,13 @@ static inline void clearFontUnlocked() QGuiApplicationPrivate::app_font = 0; } +// Using aggregate initialization instead of ctor so we can have a POD global static +#define Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER { Qt::TopLeftCorner, -1, -1, -1, -1 } + // Geometry specification for top level windows following the convention of the // -geometry command line arguments in X11 (see XParseGeometry). struct QWindowGeometrySpecification { - QWindowGeometrySpecification() : corner(Qt::TopLeftCorner), xOffset(-1), yOffset(-1), width(-1), height(-1) {} static QWindowGeometrySpecification fromArgument(const QByteArray &a); void applyTo(QWindow *window) const; @@ -285,7 +287,7 @@ static inline int nextGeometryToken(const QByteArray &a, int &pos, char *op) QWindowGeometrySpecification QWindowGeometrySpecification::fromArgument(const QByteArray &a) { - QWindowGeometrySpecification result; + QWindowGeometrySpecification result = Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER; int pos = 0; for (int i = 0; i < 4; ++i) { char op; @@ -342,7 +344,7 @@ void QWindowGeometrySpecification::applyTo(QWindow *window) const } } -static QWindowGeometrySpecification windowGeometrySpecification; +static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER; /*! \class QGuiApplication diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 38cc9506ee..c23dbbb3be 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1267,7 +1267,28 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat if ((key & Qt::KeypadModifier) == Qt::KeypadModifier) addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Num") : QString::fromLatin1("Num"), format); + QString p = keyName(key, format); +#if defined(Q_OS_OSX) + if (nativeText) + s += p; + else +#endif + addKey(s, p, format); + return s; +} + +/*! + \internal + Returns the text representation of the key \a key, which can be used i.e. + when the sequence is serialized. This does not take modifiers into account + (see encodeString() for a version that does). + + This static method is used by encodeString() and by the D-Bus menu exporter. +*/ +QString QKeySequencePrivate::keyName(int key, QKeySequence::SequenceFormat format) +{ + bool nativeText = (format == QKeySequence::NativeText); key &= ~(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier); QString p; @@ -1318,14 +1339,7 @@ NonSymbol: } } } - -#if defined(Q_OS_MACX) - if (nativeText) - s += p; - else -#endif - addKey(s, p, format); - return s; + return p; } /*! Matches the sequence with \a seq. Returns ExactMatch if diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h index 492546616b..eeea0f5772 100644 --- a/src/gui/kernel/qkeysequence_p.h +++ b/src/gui/kernel/qkeysequence_p.h @@ -81,6 +81,8 @@ public: QAtomicInt ref; int key[MaxKeyCount]; static QString encodeString(int key, QKeySequence::SequenceFormat format); + // used in dbusmenu + Q_GUI_EXPORT static QString keyName(int key, QKeySequence::SequenceFormat format); static int decodeString(const QString &keyStr, QKeySequence::SequenceFormat format); }; #endif // QT_NO_SHORTCUT diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index e7f7f230f1..c8cf7ddb91 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -983,7 +983,7 @@ void QWindow::setMask(const QRegion ®ion) Q_D(QWindow); if (!d->platformWindow) return; - d->platformWindow->setMask(region); + d->platformWindow->setMask(QHighDpi::toNativeLocalRegion(region, this)); d->mask = region; } |