qskTabChainIncrement added
This commit is contained in:
parent
e91a0932e8
commit
d32646c67c
|
@ -1,5 +1,6 @@
|
|||
#include "QskEvent.h"
|
||||
#include "QskGesture.h"
|
||||
#include <QKeyEvent>
|
||||
|
||||
static void qskRegisterEventTypes()
|
||||
{
|
||||
|
@ -17,6 +18,27 @@ static void qskRegisterEventTypes()
|
|||
|
||||
Q_CONSTRUCTOR_FUNCTION( qskRegisterEventTypes )
|
||||
|
||||
int qskTabChainIncrement( const QEvent* event )
|
||||
{
|
||||
if ( event && event->type() == QEvent::KeyPress )
|
||||
{
|
||||
const auto keyEvent = static_cast< const QKeyEvent* >( event );
|
||||
if ( !( keyEvent->modifiers() & ( Qt::ControlModifier | Qt::AltModifier ) ) )
|
||||
{
|
||||
switch( keyEvent->key() )
|
||||
{
|
||||
case Qt::Key_Tab:
|
||||
return 1;
|
||||
|
||||
case Qt::Key_Backtab:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QskEvent::QskEvent( QskEvent::Type type ):
|
||||
QEvent( static_cast< QEvent::Type >( type ) )
|
||||
{
|
||||
|
|
|
@ -99,4 +99,6 @@ private:
|
|||
const State m_state;
|
||||
};
|
||||
|
||||
QSK_EXPORT int qskTabChainIncrement( const QEvent* );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "QskAspect.h"
|
||||
#include "QskSetup.h"
|
||||
#include "QskSkin.h"
|
||||
#include "QskEvent.h"
|
||||
|
||||
#include <QtMath>
|
||||
#include <QPointer>
|
||||
|
@ -259,31 +260,28 @@ bool QskWindow::event( QEvent* event )
|
|||
|
||||
void QskWindow::keyPressEvent( QKeyEvent* event )
|
||||
{
|
||||
if ( !( event->modifiers() & ( Qt::ControlModifier | Qt::AltModifier ) ) )
|
||||
if ( qskTabChainIncrement( event ) != 0 )
|
||||
{
|
||||
if ( ( event->key() == Qt::Key_Backtab ) || ( event->key() == Qt::Key_Tab ) )
|
||||
auto focusItem = activeFocusItem();
|
||||
if ( focusItem == nullptr || focusItem == contentItem() )
|
||||
{
|
||||
auto focusItem = activeFocusItem();
|
||||
if ( focusItem == nullptr || focusItem == contentItem() )
|
||||
{
|
||||
/*
|
||||
The Qt/Quick implementation for navigating along the
|
||||
focus tab chain gives unsufficient results, when the
|
||||
starting point is the root item. In this specific
|
||||
situation we also have to include all items being
|
||||
tab fences into consideration.
|
||||
/*
|
||||
The Qt/Quick implementation for navigating along the
|
||||
focus tab chain gives unsufficient results, when the
|
||||
starting point is the root item. In this specific
|
||||
situation we also have to include all items being
|
||||
tab fences into consideration.
|
||||
|
||||
In certain situations Qt/Quick gets even stuck in a non
|
||||
terminating loop: see Qt-Bug 65943
|
||||
In certain situations Qt/Quick gets even stuck in a non
|
||||
terminating loop: see Qt-Bug 65943
|
||||
|
||||
So we better block the focus navigation and find the
|
||||
next focus item on our own.
|
||||
*/
|
||||
ensureFocus( Qt::TabFocusReason );
|
||||
event->accept();
|
||||
So we better block the focus navigation and find the
|
||||
next focus item on our own.
|
||||
*/
|
||||
ensureFocus( Qt::TabFocusReason );
|
||||
event->accept();
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue