using QQuickItem::fontPolicy available since Qt 6.7

This commit is contained in:
Uwe Rathmann 2025-01-05 16:44:15 +01:00
parent 33a482505a
commit 57162cdff1
2 changed files with 16 additions and 6 deletions

View File

@ -414,14 +414,10 @@ bool QskItem::isTabFence() const
return d_func()->isTabFence; return d_func()->isTabFence;
} }
#if QT_VERSION < QT_VERSION_CHECK( 6, 7, 0 )
void QskItem::setFocusPolicy( Qt::FocusPolicy policy ) void QskItem::setFocusPolicy( Qt::FocusPolicy policy )
{ {
/*
Qt::FocusPolicy has always been there with widgets, got lost with
Qt/Quick and has been reintroduced with Qt/Quick Controls 2 ( QC2 ).
Unfortunately this was done by adding code on top instead of fixing
the foundation.
*/
Q_D( QskItem ); Q_D( QskItem );
if ( policy != d->focusPolicy ) if ( policy != d->focusPolicy )
{ {
@ -454,6 +450,14 @@ Qt::FocusPolicy QskItem::focusPolicy() const
return static_cast< Qt::FocusPolicy >( policy ); return static_cast< Qt::FocusPolicy >( policy );
} }
#else
/*
shifting the activeFocusItem before removing it from the tab focus
chain is not done by QQuickItem::setFocusPolicy. TODO ...
*/
#endif
void QskItem::setWheelEnabled( bool on ) void QskItem::setWheelEnabled( bool on )
{ {
Q_D( QskItem ); Q_D( QskItem );

View File

@ -29,8 +29,10 @@ class QSK_EXPORT QskItem : public QQuickItem
Q_PROPERTY( bool polishOnParentResize READ polishOnParentResize Q_PROPERTY( bool polishOnParentResize READ polishOnParentResize
WRITE setPolishOnParentResize NOTIFY itemFlagsChanged FINAL ) WRITE setPolishOnParentResize NOTIFY itemFlagsChanged FINAL )
#if QT_VERSION < QT_VERSION_CHECK( 6, 7, 0 )
Q_PROPERTY( Qt::FocusPolicy focusPolicy READ focusPolicy Q_PROPERTY( Qt::FocusPolicy focusPolicy READ focusPolicy
WRITE setFocusPolicy NOTIFY focusPolicyChanged ) WRITE setFocusPolicy NOTIFY focusPolicyChanged )
#endif
Q_PROPERTY( bool wheelEnabled READ isWheelEnabled Q_PROPERTY( bool wheelEnabled READ isWheelEnabled
WRITE setWheelEnabled NOTIFY wheelEnabledChanged ) WRITE setWheelEnabled NOTIFY wheelEnabledChanged )
@ -87,8 +89,10 @@ class QSK_EXPORT QskItem : public QQuickItem
void setPolishOnParentResize( bool ); void setPolishOnParentResize( bool );
bool polishOnParentResize() const; bool polishOnParentResize() const;
#if QT_VERSION < QT_VERSION_CHECK( 6, 7, 0 )
void setFocusPolicy( Qt::FocusPolicy ); void setFocusPolicy( Qt::FocusPolicy );
Qt::FocusPolicy focusPolicy() const; Qt::FocusPolicy focusPolicy() const;
#endif
void setTabFence( bool ); void setTabFence( bool );
bool isTabFence() const; bool isTabFence() const;
@ -119,7 +123,9 @@ class QSK_EXPORT QskItem : public QQuickItem
Q_SIGNALS: Q_SIGNALS:
void wheelEnabledChanged( bool ); void wheelEnabledChanged( bool );
#if QT_VERSION < QT_VERSION_CHECK( 6, 7, 0 )
void focusPolicyChanged( Qt::FocusPolicy ); void focusPolicyChanged( Qt::FocusPolicy );
#endif
void itemFlagsChanged(); void itemFlagsChanged();
void updateFlagsChanged( UpdateFlags ); void updateFlagsChanged( UpdateFlags );