version check fixed

This commit is contained in:
Uwe Rathmann 2021-04-26 11:44:25 +02:00
parent 7c1d8cfa05
commit 71a791918a
4 changed files with 19 additions and 3 deletions

View File

@ -31,8 +31,11 @@ static void qskSetFocus( QQuickItem* item, bool on )
if ( const auto scope = qskNearestFocusScope( item ) )
{
#if QT_VERSION >= QT_VERSION_CHECK( 6, 1, 0 )
auto dw = QQuickItemPrivate::get( item )->deliveryAgentPrivate();
#else
auto dw = QQuickWindowPrivate::get( item->window() );
#endif
if ( on )
{
dw->setFocusInScope( scope, item, Qt::PopupFocusReason );

View File

@ -238,8 +238,12 @@ void qskForceActiveFocus( QQuickItem* item, Qt::FocusReason reason )
if ( item == nullptr || item->window() == nullptr )
return;
auto wp = QQuickWindowPrivate::get( item->window() );
#if QT_VERSION >= QT_VERSION_CHECK( 6, 1, 0 )
auto wp = QQuickItemPrivate::get( item )->deliveryAgentPrivate();
#else
auto wp = QQuickWindowPrivate::get( item->window() );
#endif
while ( const auto scope = qskNearestFocusScope( item ) )
{
wp->setFocusInScope( scope, item, reason );

View File

@ -733,7 +733,11 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change,
oldWindow->activeFocusItem().
*/
#if QT_VERSION >= QT_VERSION_CHECK( 6, 1, 0 )
auto wd = QQuickWindowPrivate::get( oldWindow )->deliveryAgentPrivate();
#else
auto wd = QQuickWindowPrivate::get( oldWindow );
#endif
if ( auto scope = qskNearestFocusScope( this ) )
{
wd->clearFocusInScope( scope, this, Qt::OtherFocusReason );

View File

@ -162,7 +162,12 @@ void QskScrollBox::onFocusItemChanged()
{
if ( window() )
{
auto reason = QQuickWindowPrivate::get( window() )->lastFocusReason;
#if QT_VERSION >= QT_VERSION_CHECK( 6, 1, 0 )
auto wd = QQuickWindowPrivate::get( window() )->deliveryAgentPrivate();
#else
auto wd = QQuickWindowPrivate::get( window() );
#endif
auto reason = wd->lastFocusReason;
if ( reason == Qt::TabFocusReason || reason == Qt::BacktabFocusReason )
ensureFocusItemVisible();
}