obsolete code removed

This commit is contained in:
Uwe Rathmann 2023-10-26 13:29:16 +02:00
parent 78f92bada0
commit a9621f19ed
5 changed files with 76 additions and 81 deletions

View File

@ -27,6 +27,8 @@ namespace
auto content = new QskControl( this ); auto content = new QskControl( this );
content->setObjectName( "Content" ); content->setObjectName( "Content" );
content->setAutoLayoutChildren( true );
content->setMargins( 20 );
switch( edge ) switch( edge )
{ {
@ -50,6 +52,9 @@ namespace
content->setBackgroundColor( QskRgb::Wheat ); content->setBackgroundColor( QskRgb::Wheat );
break; break;
} }
auto button = new QskPushButton( "Push Me", content );
button->setPreferredHeight( 100 );
} }
}; };

View File

@ -371,7 +371,7 @@ QList< QQuickItem* > qskPaintOrderChildItems( const QQuickItem* item )
return QList< QQuickItem* >(); return QList< QQuickItem* >();
} }
const QSGNode* qskItemNode( const QQuickItem* item ) const QSGTransformNode* qskItemNode( const QQuickItem* item )
{ {
if ( item == nullptr ) if ( item == nullptr )
return nullptr; return nullptr;

View File

@ -16,6 +16,7 @@ class QskSizePolicy;
class QQuickItem; class QQuickItem;
class QSGNode; class QSGNode;
class QSGTransformNode;
class QRectF; class QRectF;
template< typename T > class QList; template< typename T > class QList;
@ -67,7 +68,7 @@ QSK_EXPORT QList< QQuickItem* > qskPaintOrderChildItems( const QQuickItem* );
QSK_EXPORT void qskUpdateInputMethod( const QQuickItem*, Qt::InputMethodQueries ); QSK_EXPORT void qskUpdateInputMethod( const QQuickItem*, Qt::InputMethodQueries );
QSK_EXPORT void qskInputMethodSetVisible( const QQuickItem*, bool ); QSK_EXPORT void qskInputMethodSetVisible( const QQuickItem*, bool );
QSK_EXPORT const QSGNode* qskItemNode( const QQuickItem* ); QSK_EXPORT const QSGTransformNode* qskItemNode( const QQuickItem* );
QSK_EXPORT const QSGNode* qskPaintNode( const QQuickItem* ); QSK_EXPORT const QSGNode* qskPaintNode( const QQuickItem* );
QSK_EXPORT void qskItemUpdateRecursive( QQuickItem* ); QSK_EXPORT void qskItemUpdateRecursive( QQuickItem* );

View File

@ -11,6 +11,71 @@ QSK_QT_PRIVATE_BEGIN
#include <private/qquickitemchangelistener_p.h> #include <private/qquickitemchangelistener_p.h>
QSK_QT_PRIVATE_END QSK_QT_PRIVATE_END
static QPointF qskSlideInTranslation( const QskSlideIn* slideIn )
{
const auto ratio = 1.0 - slideIn->transitioningFactor();
auto dx = 0.0;
auto dy = 0.0;
switch( slideIn->edge() )
{
case Qt::LeftEdge:
dx = -ratio * slideIn->width();
break;
case Qt::RightEdge:
dx = ratio * slideIn->width();
break;
case Qt::TopEdge:
dy = -ratio * slideIn->height();
break;
case Qt::BottomEdge:
dy = ratio * slideIn->height();
break;
}
return QPointF( dx, dy );
}
static inline QRectF qskUnboundedClipRect( const QRectF& rect, Qt::Edge edge )
{
/*
When sliding we want to clip against the edge, where the drawer
slides in/out. However the size of the slidein is often smaller than the
one of the parent and we would clip the overlay node
and all content, that is located outside the drawer geometry.
So we expand the clip rectangle to "unbounded" at the other edges.
*/
constexpr qreal d = 1e6;
QRectF r( -d, -d, 2.0 * d, 2.0 * d );
switch( edge )
{
case Qt::LeftEdge:
r.setLeft( rect.left() );
break;
case Qt::RightEdge:
r.setRight( rect.right() );
break;
case Qt::TopEdge:
r.setTop( rect.top() );
break;
case Qt::BottomEdge:
r.setBottom( rect.bottom() );
break;
}
return r;
}
namespace namespace
{ {
// Using an eventFilter for QskEvent::GeometryChange instead ??? // Using an eventFilter for QskEvent::GeometryChange instead ???
@ -94,7 +159,7 @@ QskSlideIn::QskSlideIn( QQuickItem* parentItem )
setPlacementPolicy( QskPlacementPolicy::Ignore ); setPlacementPolicy( QskPlacementPolicy::Ignore );
connect( this, &QskPopup::transitioningChanged, connect( this, &QskPopup::transitioningChanged,
this, &QskSlideIn::setIntermediate ); this, &QskSlideIn::setClip );
} }
QskSlideIn::~QskSlideIn() QskSlideIn::~QskSlideIn()
@ -132,90 +197,17 @@ void QskSlideIn::itemChange( QQuickItem::ItemChange change,
} }
} }
void QskSlideIn::setIntermediate( bool on )
{
setClip( on );
Q_EMIT focusIndicatorRectChanged();
}
QRectF QskSlideIn::focusIndicatorRect() const
{
if ( isTransitioning() )
return QRectF();
return Inherited::focusIndicatorRect();
}
QRectF QskSlideIn::clipRect() const QRectF QskSlideIn::clipRect() const
{ {
if ( !isTransitioning() ) if ( !isTransitioning() )
return Inherited::clipRect(); return Inherited::clipRect();
/*
When sliding we want to clip against the edge, where the drawer
slides in/out. However the size of the slidein is often smaller than the
one of the parent and we would clip the overlay node
and all content, that is located outside the drawer geometry.
So we expand the clip rectangle to "unbounded" at the other edges.
Note, that clipping against "rounded" rectangles can't be done
properly by overloading clipRect. We would have to manipulate the clip node
manually - like it is done in QskScrollArea. TODO ..
*/
constexpr qreal d = std::numeric_limits< short >::max();
QRectF r( -d, -d, 2.0 * d, 2.0 * d );
switch( edge() )
{
case Qt::LeftEdge:
r.setLeft( 0.0 );
break;
case Qt::RightEdge:
r.setRight( width() );
break;
case Qt::TopEdge:
r.setTop( 0.0 );
break;
case Qt::BottomEdge:
r.setBottom( height() );
break;
}
return r; return qskUnboundedClipRect( rect(), edge() );
} }
QRectF QskSlideIn::layoutRectForSize( const QSizeF& size ) const QRectF QskSlideIn::layoutRectForSize( const QSizeF& size ) const
{ {
const auto ratio = 1.0 - transitioningFactor(); return QRectF( qskSlideInTranslation( this ), size );
auto x = 0.0;
auto y = 0.0;
switch( edge() )
{
case Qt::LeftEdge:
x = -ratio * size.width();
break;
case Qt::RightEdge:
x = ratio * size.width();
break;
case Qt::TopEdge:
y = -ratio * size.height();
break;
case Qt::BottomEdge:
y = ratio * size.height();
break;
}
return QRectF( x, y, size.width(), size.height() );
} }
#include "moc_QskSlideIn.cpp" #include "moc_QskSlideIn.cpp"

View File

@ -20,7 +20,6 @@ class QSK_EXPORT QskSlideIn : public QskPopup
virtual Qt::Edge edge() const = 0; virtual Qt::Edge edge() const = 0;
QRectF focusIndicatorRect() const override;
QRectF clipRect() const override; QRectF clipRect() const override;
void setAdjustingToParentGeometry( bool on ); void setAdjustingToParentGeometry( bool on );
@ -34,8 +33,6 @@ class QSK_EXPORT QskSlideIn : public QskPopup
void itemChange( ItemChange, const ItemChangeData& ) override; void itemChange( ItemChange, const ItemChangeData& ) override;
private: private:
void setIntermediate( bool );
class PrivateData; class PrivateData;
std::unique_ptr< PrivateData > m_data; std::unique_ptr< PrivateData > m_data;
}; };