Squashed commit of the following:

commit 02f95db2e5a105cad4ac0bc07f5dcfc655546f9d
Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de>
Date:   Fri Mar 11 14:14:35 2022 +0100

    wip
This commit is contained in:
Uwe Rathmann 2022-03-11 14:16:41 +01:00
parent 820bb9cdc2
commit d7d5c8cff3
6 changed files with 29 additions and 6 deletions

View File

@ -181,13 +181,15 @@ void QskBoundedInput::keyPressEvent( QKeyEvent* event )
{ {
if ( !isReadOnly() ) if ( !isReadOnly() )
{ {
if ( event->key() == Qt::Key_Up || event->matches( QKeySequence::MoveToNextChar ) ) if ( event->key() == Qt::Key_Up ||
qskKeyMatches( event, QKeySequence::MoveToNextChar ) )
{ {
increment( m_stepSize ); increment( m_stepSize );
return; return;
} }
if ( event->key() == Qt::Key_Down || event->matches( QKeySequence::MoveToPreviousChar ) ) if ( event->key() == Qt::Key_Down ||
qskKeyMatches( event, QKeySequence::MoveToPreviousChar ) )
{ {
increment( -m_stepSize ); increment( -m_stepSize );
return; return;

View File

@ -114,6 +114,21 @@ qreal qskWheelIncrement( const QWheelEvent* event )
#endif #endif
bool qskKeyMatches( const QKeyEvent* event, QKeySequence::StandardKey key )
{
#if 1
return event->matches( key );
#else
constexpr auto mask = ~(Qt::KeypadModifier | Qt::GroupSwitchModifier);
// We should route this call through the skin. TODO
const auto theme = QGuiApplicationPrivate::platformTheme();
const auto bindings = theme->keyBindings( ( event->modifiers() | event->key() ) & mask );
return bindings.contains( QKeySequence(searchkey) );
#endif
}
QskEvent::QskEvent( QskEvent::Type type ) QskEvent::QskEvent( QskEvent::Type type )
: QEvent( static_cast< QEvent::Type >( type ) ) : QEvent( static_cast< QEvent::Type >( type ) )
{ {

View File

@ -10,6 +10,7 @@
#include <qcoreevent.h> #include <qcoreevent.h>
#include <qrect.h> #include <qrect.h>
#include <qkeysequence.h>
#include <memory> #include <memory>
class QskGesture; class QskGesture;
@ -20,6 +21,7 @@ class QQuickItem;
class QMouseEvent; class QMouseEvent;
class QWheelEvent; class QWheelEvent;
class QHoverEvent; class QHoverEvent;
class QKeyEvent;
class QSK_EXPORT QskEvent : public QEvent class QSK_EXPORT QskEvent : public QEvent
{ {
@ -148,4 +150,6 @@ QSK_EXPORT qreal qskWheelIncrement( const QWheelEvent* );
#endif #endif
QSK_EXPORT bool qskKeyMatches( const QKeyEvent*, QKeySequence::StandardKey );
#endif #endif

View File

@ -15,10 +15,10 @@ QSK_SYSTEM_STATE( QskPageIndicator, Selected, QskAspect::FirstSystemState << 1 )
static int qskKeyIncrement( static int qskKeyIncrement(
const QskPageIndicator* indicator, const QKeyEvent* event ) const QskPageIndicator* indicator, const QKeyEvent* event )
{ {
if ( event->matches( QKeySequence::MoveToNextChar ) ) if ( qskKeyMatches( event, QKeySequence::MoveToNextChar ) )
return 1; return 1;
if ( event->matches( QKeySequence::MoveToPreviousChar ) ) if ( qskKeyMatches( event, QKeySequence::MoveToPreviousChar ) )
return -1; return -1;
const auto key = event->key(); const auto key = event->key();

View File

@ -7,6 +7,7 @@
#include "QskDialogButtonBox.h" #include "QskDialogButtonBox.h"
#include "QskPushButton.h" #include "QskPushButton.h"
#include "QskQuick.h" #include "QskQuick.h"
#include "QskEvent.h"
#include <qquickwindow.h> #include <qquickwindow.h>
#include <qpointer.h> #include <qpointer.h>
@ -280,7 +281,7 @@ void QskDialogSubWindow::keyPressEvent( QKeyEvent* event )
button->click(); button->click();
} }
if ( event->matches( QKeySequence::Cancel ) ) if ( qskKeyMatches( event, QKeySequence::Cancel ) )
{ {
// using shortcuts instead ??? // using shortcuts instead ???

View File

@ -8,6 +8,7 @@
#include "QskLinearBox.h" #include "QskLinearBox.h"
#include "QskPushButton.h" #include "QskPushButton.h"
#include "QskQuick.h" #include "QskQuick.h"
#include "QskEvent.h"
#include <qeventloop.h> #include <qeventloop.h>
#include <qpointer.h> #include <qpointer.h>
@ -248,7 +249,7 @@ void QskDialogWindow::keyPressEvent( QKeyEvent* event )
button->click(); button->click();
} }
if ( event->matches( QKeySequence::Cancel ) ) if ( qskKeyMatches( event, QKeySequence::Cancel ) )
{ {
// using shortcuts instead ??? // using shortcuts instead ???