itemFocusClip added

This commit is contained in:
Uwe Rathmann 2021-07-14 13:31:05 +02:00
parent 44f9f36d0d
commit 3df57c6025
2 changed files with 32 additions and 0 deletions

View File

@ -212,6 +212,16 @@ namespace
m_isSizeChangedEnabled = on; m_isSizeChangedEnabled = on;
} }
QRectF focusIndicatorClipRect() const override
{
if( scrollArea()->hasItemFocusClipping() )
{
return Inherited::focusIndicatorClipRect();
}
return QRectF();
}
protected: protected:
bool event( QEvent* event ) override; bool event( QEvent* event ) override;
@ -392,6 +402,7 @@ class QskScrollArea::PrivateData
public: public:
PrivateData() PrivateData()
: isItemResizable( true ) : isItemResizable( true )
, isItemFocusClipping( true )
{ {
} }
@ -412,6 +423,7 @@ class QskScrollArea::PrivateData
ClipItem* clipItem = nullptr; ClipItem* clipItem = nullptr;
bool isItemResizable : 1; bool isItemResizable : 1;
bool isItemFocusClipping : 1;
}; };
/* /*
@ -511,6 +523,20 @@ bool QskScrollArea::isItemResizable() const
return m_data->isItemResizable; return m_data->isItemResizable;
} }
void QskScrollArea::setItemFocusClipping( bool on )
{
if( m_data->isItemFocusClipping != on )
{
m_data->isItemFocusClipping = on;
Q_EMIT focusIndicatorRectChanged();
}
}
bool QskScrollArea::hasItemFocusClipping() const
{
return m_data->isItemFocusClipping;
}
void QskScrollArea::setScrolledItem( QQuickItem* item ) void QskScrollArea::setScrolledItem( QQuickItem* item )
{ {
auto oldItem = m_data->clipItem->scrolledItem(); auto oldItem = m_data->clipItem->scrolledItem();

View File

@ -18,6 +18,9 @@ class QSK_EXPORT QskScrollArea : public QskScrollView
Q_PROPERTY( bool itemResizable READ isItemResizable Q_PROPERTY( bool itemResizable READ isItemResizable
WRITE setItemResizable NOTIFY itemResizableChanged FINAL ) WRITE setItemResizable NOTIFY itemResizableChanged FINAL )
Q_PROPERTY( bool itemFocusClipping READ hasItemFocusClipping
WRITE setItemFocusClipping FINAL )
using Inherited = QskScrollView; using Inherited = QskScrollView;
public: public:
@ -30,6 +33,9 @@ class QSK_EXPORT QskScrollArea : public QskScrollView
void setItemResizable( bool on ); void setItemResizable( bool on );
bool isItemResizable() const; bool isItemResizable() const;
void setItemFocusClipping( bool on );
bool hasItemFocusClipping() const;
Q_SIGNALS: Q_SIGNALS:
void scrolledItemChanged(); void scrolledItemChanged();
void itemResizableChanged( bool ); void itemResizableChanged( bool );