Fix some duplication between QGuiApplication and QApplication,
for the mouseButtons and keyboardModifiers vars and methods. Implement queryKeyboardModifiers with a new virtual in QPlatformIntegration. Task-number: QTBUG-11243 Change-Id: I9e95841542ac61c73ff72d7682ad962ea8aada42 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
parent
657f634c0e
commit
816893d91d
@ -753,7 +753,17 @@ static QClipboard *clipboard();
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the currently held keyboard modifiers.
|
Returns the current state of the modifier keys on the keyboard. The current
|
||||||
|
state is updated sychronously as the event queue is emptied of events that
|
||||||
|
will spontaneously change the keyboard state (QEvent::KeyPress and
|
||||||
|
QEvent::KeyRelease events).
|
||||||
|
|
||||||
|
It should be noted this may not reflect the actual keys held on the input
|
||||||
|
device at the time of calling but rather the modifiers as last reported in
|
||||||
|
one of the above events. If no keys are being held Qt::NoModifier is
|
||||||
|
returned.
|
||||||
|
|
||||||
|
\sa mouseButtons(), queryKeyboardModifiers()
|
||||||
*/
|
*/
|
||||||
Qt::KeyboardModifiers QGuiApplication::keyboardModifiers()
|
Qt::KeyboardModifiers QGuiApplication::keyboardModifiers()
|
||||||
{
|
{
|
||||||
@ -761,7 +771,39 @@ Qt::KeyboardModifiers QGuiApplication::keyboardModifiers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the currently held mouse buttons.
|
\fn Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
|
||||||
|
|
||||||
|
Queries and returns the state of the modifier keys on the keyboard.
|
||||||
|
Unlike keyboardModifiers, this method returns the actual keys held
|
||||||
|
on the input device at the time of calling the method.
|
||||||
|
|
||||||
|
It does not rely on the keypress events having been received by this
|
||||||
|
process, which makes it possible to check the modifiers while moving
|
||||||
|
a window, for instance. Note that in most cases, you should use
|
||||||
|
keyboardModifiers(), which is faster and more accurate since it contains
|
||||||
|
the state of the modifiers as they were when the currently processed
|
||||||
|
event was received.
|
||||||
|
|
||||||
|
\sa keyboardModifiers()
|
||||||
|
*/
|
||||||
|
Qt::KeyboardModifiers QGuiApplication::queryKeyboardModifiers()
|
||||||
|
{
|
||||||
|
QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
|
||||||
|
return pi->queryKeyboardModifiers();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the current state of the buttons on the mouse. The current state is
|
||||||
|
updated syncronously as the event queue is emptied of events that will
|
||||||
|
spontaneously change the mouse state (QEvent::MouseButtonPress and
|
||||||
|
QEvent::MouseButtonRelease events).
|
||||||
|
|
||||||
|
It should be noted this may not reflect the actual buttons held on the
|
||||||
|
input device at the time of calling but rather the mouse buttons as last
|
||||||
|
reported in one of the above events. If no mouse buttons are being held
|
||||||
|
Qt::NoButton is returned.
|
||||||
|
|
||||||
|
\sa keyboardModifiers()
|
||||||
*/
|
*/
|
||||||
Qt::MouseButtons QGuiApplication::mouseButtons()
|
Qt::MouseButtons QGuiApplication::mouseButtons()
|
||||||
{
|
{
|
||||||
|
@ -113,6 +113,7 @@ public:
|
|||||||
static void setPalette(const QPalette &pal);
|
static void setPalette(const QPalette &pal);
|
||||||
|
|
||||||
static Qt::KeyboardModifiers keyboardModifiers();
|
static Qt::KeyboardModifiers keyboardModifiers();
|
||||||
|
static Qt::KeyboardModifiers queryKeyboardModifiers();
|
||||||
static Qt::MouseButtons mouseButtons();
|
static Qt::MouseButtons mouseButtons();
|
||||||
|
|
||||||
static void setLayoutDirection(Qt::LayoutDirection direction);
|
static void setLayoutDirection(Qt::LayoutDirection direction);
|
||||||
|
@ -291,6 +291,11 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers() const
|
||||||
|
{
|
||||||
|
return QGuiApplication::keyboardModifiers();
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Should be called by the implementation whenever a new screen is added.
|
Should be called by the implementation whenever a new screen is added.
|
||||||
|
|
||||||
|
@ -124,6 +124,8 @@ public:
|
|||||||
|
|
||||||
virtual QVariant styleHint(StyleHint hint) const;
|
virtual QVariant styleHint(StyleHint hint) const;
|
||||||
|
|
||||||
|
virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
|
||||||
|
|
||||||
virtual QPlatformTheme *platformTheme() const;
|
virtual QPlatformTheme *platformTheme() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -371,9 +371,6 @@ void qt_init(QApplicationPrivate *priv, int type
|
|||||||
);
|
);
|
||||||
void qt_cleanup();
|
void qt_cleanup();
|
||||||
|
|
||||||
Qt::MouseButtons QApplicationPrivate::mouse_buttons = Qt::NoButton;
|
|
||||||
Qt::KeyboardModifiers QApplicationPrivate::modifier_buttons = Qt::NoModifier;
|
|
||||||
|
|
||||||
QStyle *QApplicationPrivate::app_style = 0; // default application style
|
QStyle *QApplicationPrivate::app_style = 0; // default application style
|
||||||
QString QApplicationPrivate::styleOverride; // style override
|
QString QApplicationPrivate::styleOverride; // style override
|
||||||
|
|
||||||
@ -2665,68 +2662,6 @@ QDesktopWidget *QApplication::desktop()
|
|||||||
return qt_desktopWidget;
|
return qt_desktopWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the current state of the modifier keys on the keyboard. The current
|
|
||||||
state is updated sychronously as the event queue is emptied of events that
|
|
||||||
will spontaneously change the keyboard state (QEvent::KeyPress and
|
|
||||||
QEvent::KeyRelease events).
|
|
||||||
|
|
||||||
It should be noted this may not reflect the actual keys held on the input
|
|
||||||
device at the time of calling but rather the modifiers as last reported in
|
|
||||||
one of the above events. If no keys are being held Qt::NoModifier is
|
|
||||||
returned.
|
|
||||||
|
|
||||||
\sa mouseButtons(), queryKeyboardModifiers()
|
|
||||||
*/
|
|
||||||
|
|
||||||
Qt::KeyboardModifiers QApplication::keyboardModifiers()
|
|
||||||
{
|
|
||||||
return QApplicationPrivate::modifier_buttons;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
|
|
||||||
|
|
||||||
Queries and returns the state of the modifier keys on the keyboard.
|
|
||||||
Unlike keyboardModifiers, this method returns the actual keys held
|
|
||||||
on the input device at the time of calling the method.
|
|
||||||
|
|
||||||
It does not rely on the keypress events having been received by this
|
|
||||||
process, which makes it possible to check the modifiers while moving
|
|
||||||
a window, for instance. Note that in most cases, you should use
|
|
||||||
keyboardModifiers(), which is faster and more accurate since it contains
|
|
||||||
the state of the modifiers as they were when the currently processed
|
|
||||||
event was received.
|
|
||||||
|
|
||||||
\sa keyboardModifiers()
|
|
||||||
|
|
||||||
\since 4.8
|
|
||||||
*/
|
|
||||||
|
|
||||||
Qt::KeyboardModifiers QApplication::queryKeyboardModifiers()
|
|
||||||
{
|
|
||||||
qWarning("queryKeyboardModifiers() doesn't have a QPA implementation");
|
|
||||||
return QApplicationPrivate::modifier_buttons;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the current state of the buttons on the mouse. The current state is
|
|
||||||
updated syncronously as the event queue is emptied of events that will
|
|
||||||
spontaneously change the mouse state (QEvent::MouseButtonPress and
|
|
||||||
QEvent::MouseButtonRelease events).
|
|
||||||
|
|
||||||
It should be noted this may not reflect the actual buttons held on the
|
|
||||||
input device at the time of calling but rather the mouse buttons as last
|
|
||||||
reported in one of the above events. If no mouse buttons are being held
|
|
||||||
Qt::NoButton is returned.
|
|
||||||
|
|
||||||
\sa keyboardModifiers()
|
|
||||||
*/
|
|
||||||
|
|
||||||
Qt::MouseButtons QApplication::mouseButtons()
|
|
||||||
{
|
|
||||||
return QApplicationPrivate::mouse_buttons;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool QApplication::isSessionRestored() const
|
\fn bool QApplication::isSessionRestored() const
|
||||||
|
@ -150,10 +150,6 @@ public:
|
|||||||
static void beep();
|
static void beep();
|
||||||
static void alert(QWidget *widget, int duration = 0);
|
static void alert(QWidget *widget, int duration = 0);
|
||||||
|
|
||||||
static Qt::KeyboardModifiers keyboardModifiers();
|
|
||||||
static Qt::KeyboardModifiers queryKeyboardModifiers();
|
|
||||||
static Qt::MouseButtons mouseButtons();
|
|
||||||
|
|
||||||
static void setCursorFlashTime(int);
|
static void setCursorFlashTime(int);
|
||||||
static int cursorFlashTime();
|
static int cursorFlashTime();
|
||||||
|
|
||||||
|
@ -247,9 +247,6 @@ public:
|
|||||||
QPoint toolTipPos, toolTipGlobalPos, hoverGlobalPos;
|
QPoint toolTipPos, toolTipGlobalPos, hoverGlobalPos;
|
||||||
QPointer<QWidget> toolTipWidget;
|
QPointer<QWidget> toolTipWidget;
|
||||||
|
|
||||||
static Qt::MouseButtons mouse_buttons;
|
|
||||||
static Qt::KeyboardModifiers modifier_buttons;
|
|
||||||
|
|
||||||
static QSize app_strut;
|
static QSize app_strut;
|
||||||
static QWidgetList *popupWidgets;
|
static QWidgetList *popupWidgets;
|
||||||
static QStyle *app_style;
|
static QStyle *app_style;
|
||||||
|
Loading…
Reference in New Issue
Block a user