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

@ -162,7 +162,7 @@ public:
virtual void implicitWidthChanged(); virtual void implicitWidthChanged();
virtual void implicitHeightChanged(); virtual void implicitHeightChanged();
virtual QSGTransformNode *createTransformNode(); virtual QSGTransformNode* createTransformNode();
#endif #endif
bool maybeGesture( QQuickItem* child, QEvent* event ) bool maybeGesture( QQuickItem* child, QEvent* event )
@ -216,7 +216,7 @@ public:
bool isInitiallyPainted : 1; bool isInitiallyPainted : 1;
uint focusPolicy : 4; uint focusPolicy : 4;
bool isWheelEnabled; bool isWheelEnabled : 1;
}; };
QskControl::QskControl( QQuickItem* parent ): QskControl::QskControl( QQuickItem* parent ):
@ -471,6 +471,32 @@ bool QskControl::isTabFence() const
return d_func()->isTabFence; 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 QskControl::Flags QskControl::controlFlags() const
{ {
return QskControl::Flags( d_func()->controlFlags ); return QskControl::Flags( d_func()->controlFlags );
@ -821,7 +847,7 @@ void QskControl::resetLocale()
// not static as being called from QskSetup.cpp // not static as being called from QskSetup.cpp
bool qskInheritLocale( QskControl* control, const QLocale& locale ) bool qskInheritLocale( QskControl* control, const QLocale& locale )
{ {
auto d = static_cast< QskControlPrivate *>( QQuickItemPrivate::get( control ) ); auto d = static_cast< QskControlPrivate* >( QQuickItemPrivate::get( control ) );
if ( d->explicitLocale || d->locale == locale ) if ( d->explicitLocale || d->locale == locale )
return false; return false;
@ -836,7 +862,7 @@ void qskResolveLocale( QskControl* control )
{ {
const QLocale locale = qskSetup->inheritedLocale( control ); const QLocale locale = qskSetup->inheritedLocale( control );
auto d = static_cast< QskControlPrivate *>( QQuickItemPrivate::get( control ) ); auto d = static_cast< QskControlPrivate* >( QQuickItemPrivate::get( control ) );
if ( d->locale != locale ) if ( d->locale != locale )
{ {
d->locale = locale; d->locale = locale;

View File

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