Be able to obtain list of possible key combinations in platform integration
As there is no way to obtain the list of possible keys for a shortcut in a platform independent way there needs to be a way to get that from the platform integration. Task-number: QTBUG-26902 Change-Id: I520add56ee09d5c3c58709fb29dad2fbfe4c9d0b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
9e44b76093
commit
bcbcf5e718
@ -43,6 +43,8 @@
|
|||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#include <private/qevent_p.h>
|
#include <private/qevent_p.h>
|
||||||
#include <private/qlocale_p.h>
|
#include <private/qlocale_p.h>
|
||||||
|
#include <private/qguiapplication_p.h>
|
||||||
|
#include <qpa/qplatformintegration.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -66,7 +68,10 @@ void QKeyMapperPrivate::clearMappings()
|
|||||||
|
|
||||||
QList<int> QKeyMapperPrivate::possibleKeys(QKeyEvent *e)
|
QList<int> QKeyMapperPrivate::possibleKeys(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
QList<int> result;
|
QList<int> result = QGuiApplicationPrivate::platformIntegration()->possibleKeys(e);
|
||||||
|
if (!result.isEmpty())
|
||||||
|
return result;
|
||||||
|
|
||||||
if (e->key() && (e->key() != Qt::Key_unknown))
|
if (e->key() && (e->key() != Qt::Key_unknown))
|
||||||
result << int(e->key() + e->modifiers());
|
result << int(e->key() + e->modifiers());
|
||||||
else if (!e->text().isEmpty())
|
else if (!e->text().isEmpty())
|
||||||
|
@ -312,6 +312,20 @@ Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers() const
|
|||||||
return QGuiApplication::keyboardModifiers();
|
return QGuiApplication::keyboardModifiers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Should be used to obtain a list of possible shortcuts for the given key
|
||||||
|
event. As that needs system functionality it cannot be done in qkeymapper.
|
||||||
|
|
||||||
|
One example for more than 1 possibility is the key combination of Shift+5.
|
||||||
|
That one might trigger a shortcut which is set as "Shift+5" as well as one
|
||||||
|
using %. These combinations depend on the currently set keyboard layout
|
||||||
|
which cannot be obtained by Qt functionality.
|
||||||
|
*/
|
||||||
|
QList<int> QPlatformIntegration::possibleKeys(const QKeyEvent *) const
|
||||||
|
{
|
||||||
|
return QList<int>();
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Should be called by the implementation whenever a new screen is added.
|
Should be called by the implementation whenever a new screen is added.
|
||||||
|
|
||||||
|
@ -76,6 +76,7 @@ class QPlatformTheme;
|
|||||||
class QPlatformDialogHelper;
|
class QPlatformDialogHelper;
|
||||||
class QPlatformSharedGraphicsCache;
|
class QPlatformSharedGraphicsCache;
|
||||||
class QPlatformServices;
|
class QPlatformServices;
|
||||||
|
class QKeyEvent;
|
||||||
|
|
||||||
class Q_GUI_EXPORT QPlatformIntegration
|
class Q_GUI_EXPORT QPlatformIntegration
|
||||||
{
|
{
|
||||||
@ -141,6 +142,7 @@ public:
|
|||||||
virtual QVariant styleHint(StyleHint hint) const;
|
virtual QVariant styleHint(StyleHint hint) const;
|
||||||
|
|
||||||
virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
|
virtual Qt::KeyboardModifiers queryKeyboardModifiers() const;
|
||||||
|
virtual QList<int> possibleKeys(const QKeyEvent *) const;
|
||||||
|
|
||||||
virtual QStringList themeNames() const;
|
virtual QStringList themeNames() const;
|
||||||
virtual QPlatformTheme *createPlatformTheme(const QString &name) const;
|
virtual QPlatformTheme *createPlatformTheme(const QString &name) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user