isTabFence/isShortcutScope added

This commit is contained in:
Uwe Rathmann 2017-12-05 13:10:17 +01:00
parent 81acf6b610
commit 8175719679
2 changed files with 38 additions and 9 deletions

View File

@ -216,7 +216,7 @@ public:
bool isInitiallyPainted : 1;
uint focusPolicy : 4;
bool isWheelEnabled;
bool isWheelEnabled : 1;
};
QskControl::QskControl( QQuickItem* parent ):
@ -471,6 +471,32 @@ bool QskControl::isTabFence() const
return d_func()->isTabFence;
}
bool QskControl::isTabFence( const QQuickItem* item )
{
if ( item == nullptr )
return false;
return QQuickItemPrivate::get( item )->isTabFence;
}
bool QskControl::isShortcutScope( const QQuickItem* item )
{
if ( item == nullptr )
return false;
/*
We might have something like CTRL+W to close a "window".
But in Qt/Quick a window is not necessarily a QQuickWindow
like we have f.e QskSubWindow.
Maybe it's worth to introduce a shortcutScope flag but for
the moment we simply use the isFocusScope/isTabFence combination,
that should usually be set for those "windows".
*/
return item->isFocusScope() && QQuickItemPrivate::get( item )->isTabFence;
}
QskControl::Flags QskControl::controlFlags() const
{
return QskControl::Flags( d_func()->controlFlags );

View File

@ -134,6 +134,9 @@ public:
void setTabFence( bool );
bool isTabFence() const;
static bool isTabFence( const QQuickItem* );
static bool isShortcutScope( const QQuickItem* );
void setControlFlags( Flags );
void resetControlFlags();
Flags controlFlags() const;