moving ClipItem to namespace
This commit is contained in:
parent
1228518e6a
commit
571f532307
|
@ -175,14 +175,16 @@ namespace
|
|||
};
|
||||
}
|
||||
|
||||
class QskScrollAreaClipItem final : public QskControl, public QQuickItemChangeListener
|
||||
namespace
|
||||
{
|
||||
class ClipItem final : public QskControl, public QQuickItemChangeListener
|
||||
{
|
||||
// when inheriting from QskControl we participate in node cleanups
|
||||
using Inherited = QskControl;
|
||||
|
||||
public:
|
||||
QskScrollAreaClipItem( QskScrollArea* );
|
||||
virtual ~QskScrollAreaClipItem();
|
||||
ClipItem( QskScrollArea* );
|
||||
virtual ~ClipItem();
|
||||
|
||||
void enableGeometryListener( bool on );
|
||||
|
||||
|
@ -248,19 +250,19 @@ class QskScrollAreaClipItem final : public QskControl, public QQuickItemChangeLi
|
|||
bool m_isSizeChangedEnabled = true;
|
||||
};
|
||||
|
||||
QskScrollAreaClipItem::QskScrollAreaClipItem( QskScrollArea* scrollArea )
|
||||
ClipItem::ClipItem( QskScrollArea* scrollArea )
|
||||
: Inherited( scrollArea )
|
||||
{
|
||||
setObjectName( QStringLiteral( "QskScrollAreaClipItem" ) );
|
||||
setClip( true );
|
||||
}
|
||||
|
||||
QskScrollAreaClipItem::~QskScrollAreaClipItem()
|
||||
ClipItem::~ClipItem()
|
||||
{
|
||||
enableGeometryListener( false );
|
||||
}
|
||||
|
||||
void QskScrollAreaClipItem::updateNode( QSGNode* )
|
||||
void ClipItem::updateNode( QSGNode* )
|
||||
{
|
||||
auto* d = QQuickItemPrivate::get( this );
|
||||
|
||||
|
@ -317,7 +319,7 @@ void QskScrollAreaClipItem::updateNode( QSGNode* )
|
|||
}
|
||||
}
|
||||
|
||||
const QSGClipNode* QskScrollAreaClipItem::viewPortClipNode() const
|
||||
const QSGClipNode* ClipItem::viewPortClipNode() const
|
||||
{
|
||||
auto node = const_cast< QSGNode* >( qskPaintNode( scrollArea() ) );
|
||||
if ( node )
|
||||
|
@ -329,7 +331,7 @@ const QSGClipNode* QskScrollAreaClipItem::viewPortClipNode() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void QskScrollAreaClipItem::geometryChanged(
|
||||
void ClipItem::geometryChanged(
|
||||
const QRectF& newRect, const QRectF& oldRect )
|
||||
{
|
||||
Inherited::geometryChanged( newRect, oldRect );
|
||||
|
@ -341,7 +343,7 @@ void QskScrollAreaClipItem::geometryChanged(
|
|||
}
|
||||
}
|
||||
|
||||
void QskScrollAreaClipItem::itemChange(
|
||||
void ClipItem::itemChange(
|
||||
QQuickItem::ItemChange change, const QQuickItem::ItemChangeData& value )
|
||||
{
|
||||
if ( change == QQuickItem::ItemChildAddedChange )
|
||||
|
@ -356,7 +358,7 @@ void QskScrollAreaClipItem::itemChange(
|
|||
Inherited::itemChange( change, value );
|
||||
}
|
||||
|
||||
void QskScrollAreaClipItem::enableGeometryListener( bool on )
|
||||
void ClipItem::enableGeometryListener( bool on )
|
||||
{
|
||||
auto item = scrolledItem();
|
||||
if ( item )
|
||||
|
@ -372,7 +374,7 @@ void QskScrollAreaClipItem::enableGeometryListener( bool on )
|
|||
}
|
||||
}
|
||||
|
||||
bool QskScrollAreaClipItem::event( QEvent* event )
|
||||
bool ClipItem::event( QEvent* event )
|
||||
{
|
||||
if ( event->type() == QEvent::LayoutRequest )
|
||||
{
|
||||
|
@ -382,6 +384,7 @@ bool QskScrollAreaClipItem::event( QEvent* event )
|
|||
|
||||
return Inherited::event( event );
|
||||
}
|
||||
}
|
||||
|
||||
class QskScrollArea::PrivateData
|
||||
{
|
||||
|
@ -405,7 +408,7 @@ class QskScrollArea::PrivateData
|
|||
}
|
||||
}
|
||||
|
||||
QskScrollAreaClipItem* clipItem = nullptr;
|
||||
ClipItem* clipItem = nullptr;
|
||||
|
||||
bool isItemResizable : 1;
|
||||
};
|
||||
|
@ -430,7 +433,7 @@ QskScrollArea::QskScrollArea( QQuickItem* parentItem )
|
|||
{
|
||||
setPolishOnResize( true );
|
||||
|
||||
m_data->clipItem = new QskScrollAreaClipItem( this );
|
||||
m_data->clipItem = new ClipItem( this );
|
||||
m_data->enableAutoTranslation( this, true );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue