summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorKari Oikarinen <kari.oikarinen@qt.io>2020-01-15 19:08:18 +0200
committerKari Oikarinen <kari.oikarinen@qt.io>2020-01-15 19:08:18 +0200
commit4f55c4181682538e6b1ac2609d907889ca14a02e (patch)
treeac5f33586e3b3b8acab4a95efe1e16978a3e37b2 /src/gui/kernel
parent457ab46936f4c90099a0f1b16abaff5312037fdb (diff)
parent7a59d6f138ff8799170cc03d709525ab965d703a (diff)
Merge 5.14 into 5.14.1
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qevent.cpp28
-rw-r--r--src/gui/kernel/qguiapplication.cpp43
-rw-r--r--src/gui/kernel/qguiapplication_p.h2
-rw-r--r--src/gui/kernel/qinputdevicemanager_p_p.h2
4 files changed, 57 insertions, 18 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index f555f4dc05..0706ae3e90 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -667,9 +667,9 @@ QHoverEvent::~QHoverEvent()
if that widget does not handle the event they are sent to the
focus widget. Wheel events are generated for both mouse wheels
and trackpad scroll gestures. There are two ways to read the
- wheel event delta: angleDelta() returns the delta in wheel
- degrees. This value is always provided. pixelDelta() returns
- the delta in screen pixels and is available on platforms that
+ wheel event delta: angleDelta() returns the deltas in wheel
+ degrees. These values are always provided. pixelDelta() returns
+ the deltas in screen pixels, and is available on platforms that
have high-resolution trackpads, such as \macos. If that is the
case, source() will return Qt::MouseEventSynthesizedBySystem.
@@ -852,7 +852,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
by \a globalPos.
\a pixelDelta contains the scrolling distance in pixels on screen, while
- \a angleDelta contains the wheel rotation distance. \a pixelDelta is
+ \a angleDelta contains the wheel rotation angle. \a pixelDelta is
optional and can be null.
The mouse and keyboard states at the time of the event are specified by
@@ -914,10 +914,16 @@ QWheelEvent::~QWheelEvent()
/*!
\fn QPoint QWheelEvent::angleDelta() const
- Returns the distance that the wheel is rotated, in eighths of a
- degree. A positive value indicates that the wheel was rotated
- forwards away from the user; a negative value indicates that the
- wheel was rotated backwards toward the user.
+ Returns the relative amount that the wheel was rotated, in eighths of a
+ degree. A positive value indicates that the wheel was rotated forwards away
+ from the user; a negative value indicates that the wheel was rotated
+ backwards toward the user. \c angleDelta().y() provides the angle through
+ which the common vertical mouse wheel was rotated since the previous event.
+ \c angleDelta().x() provides the angle through which the horizontal mouse
+ wheel was rotated, if the mouse has a horizontal wheel; otherwise it stays
+ at zero. Some mice allow the user to tilt the wheel to perform horizontal
+ scrolling, and some touchpads support a horizontal scrolling gesture; that
+ will also appear in \c angleDelta().x().
Most mouse types work in steps of 15 degrees, in which case the
delta value is a multiple of 120; i.e., 120 units * 1/8 = 15 degrees.
@@ -926,7 +932,9 @@ QWheelEvent::~QWheelEvent()
that are less than 120 units (less than 15 degrees). To support this
possibility, you can either cumulatively add the delta values from events
until the value of 120 is reached, then scroll the widget, or you can
- partially scroll the widget in response to each wheel event.
+ partially scroll the widget in response to each wheel event. But to
+ provide a more native feel, you should prefer \l pixelDelta() on platforms
+ where it's available.
Example:
@@ -937,6 +945,8 @@ QWheelEvent::~QWheelEvent()
\li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin),
\li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd).
\endlist
+
+ \see pixelDelta()
*/
/*!
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 888ccd8453..2b3299f745 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -605,8 +605,13 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
The following parameters are available for \c {-platform windows}:
\list
+ \li \c {altgr}, detect the key \c {AltGr} found on some keyboards as
+ Qt::GroupSwitchModifier (since Qt 5.12).
\li \c {dialogs=[xp|none]}, \c xp uses XP-style native dialogs and
\c none disables them.
+
+ \li \c {dpiawareness=[0|1|2} Sets the DPI awareness of the process
+ (see \l{High DPI Displays}, since Qt 5.4).
\li \c {fontengine=freetype}, uses the FreeType font engine.
\li \c {menus=[native|none]}, controls the use of native menus.
@@ -616,10 +621,23 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
provide hover signals. They are mainly intended for Qt Quick.
By default, they will be used if the application is not an
instance of QApplication or for Qt Quick Controls 2
- applications.
+ applications (since Qt 5.10).
- \li \c {altgr}, detect the key \c {AltGr} found on some keyboards as
- Qt::GroupSwitchModifier.
+ \li \c {nocolorfonts} Turn off DirectWrite Color fonts
+ (since Qt 5.8).
+
+ \li \c {nodirectwrite} Turn off DirectWrite fonts (since Qt 5.8).
+
+ \li \c {nomousefromtouch} Ignores mouse events synthesized
+ from touch events by the operating system.
+
+ \li \c {nowmpointer} Switches from Pointer Input Messages handling
+ to legacy mouse handling (since Qt 5.12).
+ \li \c {reverse} Activates Right-to-left mode (experimental).
+ Windows title bars will be shown accordingly in Right-to-left locales
+ (since Qt 5.13).
+ \li \c {tabletabsoluterange=<value>} Sets a value for mouse mode detection
+ of WinTab tablets (Legacy, since Qt 5.3).
\endlist
The following parameter is available for \c {-platform cocoa} (on macOS):
@@ -3293,12 +3311,8 @@ QPalette QGuiApplication::palette()
*/
void QGuiApplication::setPalette(const QPalette &pal)
{
- if (QGuiApplicationPrivate::app_pal && pal.isCopyOf(*QGuiApplicationPrivate::app_pal))
+ if (!QGuiApplicationPrivate::setPalette(pal))
return;
- if (!QGuiApplicationPrivate::app_pal)
- QGuiApplicationPrivate::app_pal = new QPalette(pal);
- else
- *QGuiApplicationPrivate::app_pal = pal;
QCoreApplication::setAttribute(Qt::AA_SetPalette);
@@ -3306,6 +3320,19 @@ void QGuiApplication::setPalette(const QPalette &pal)
qGuiApp->d_func()->sendApplicationPaletteChange();
}
+bool QGuiApplicationPrivate::setPalette(const QPalette &palette)
+{
+ if (app_pal && palette.isCopyOf(*app_pal))
+ return false;
+
+ if (!app_pal)
+ app_pal = new QPalette(palette);
+ else
+ *app_pal = palette;
+
+ return true;
+}
+
void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window)
{
windowGeometrySpecification.applyTo(window);
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 26f65b2f16..7454bba0e5 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -323,6 +323,8 @@ public:
static void resetCachedDevicePixelRatio();
+ static bool setPalette(const QPalette &palette);
+
protected:
virtual void notifyThemeChanged();
virtual void sendApplicationPaletteChange(bool toAllWidgets = false, const char *className = nullptr);
diff --git a/src/gui/kernel/qinputdevicemanager_p_p.h b/src/gui/kernel/qinputdevicemanager_p_p.h
index 871f9315c3..82a86446a0 100644
--- a/src/gui/kernel/qinputdevicemanager_p_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p_p.h
@@ -69,7 +69,7 @@ public:
int deviceCount(QInputDeviceManager::DeviceType type) const;
void setDeviceCount(QInputDeviceManager::DeviceType type, int count);
- std::array<int, QInputDeviceManager::NumDeviceTypes> m_deviceCount;
+ std::array<int, QInputDeviceManager::NumDeviceTypes> m_deviceCount = {};
Qt::KeyboardModifiers keyboardModifiers;
};