obsolete code removed
This commit is contained in:
parent
78f92bada0
commit
a9621f19ed
|
@ -27,6 +27,8 @@ namespace
|
|||
|
||||
auto content = new QskControl( this );
|
||||
content->setObjectName( "Content" );
|
||||
content->setAutoLayoutChildren( true );
|
||||
content->setMargins( 20 );
|
||||
|
||||
switch( edge )
|
||||
{
|
||||
|
@ -50,6 +52,9 @@ namespace
|
|||
content->setBackgroundColor( QskRgb::Wheat );
|
||||
break;
|
||||
}
|
||||
|
||||
auto button = new QskPushButton( "Push Me", content );
|
||||
button->setPreferredHeight( 100 );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ QList< QQuickItem* > qskPaintOrderChildItems( const QQuickItem* item )
|
|||
return QList< QQuickItem* >();
|
||||
}
|
||||
|
||||
const QSGNode* qskItemNode( const QQuickItem* item )
|
||||
const QSGTransformNode* qskItemNode( const QQuickItem* item )
|
||||
{
|
||||
if ( item == nullptr )
|
||||
return nullptr;
|
||||
|
|
|
@ -16,6 +16,7 @@ class QskSizePolicy;
|
|||
|
||||
class QQuickItem;
|
||||
class QSGNode;
|
||||
class QSGTransformNode;
|
||||
class QRectF;
|
||||
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 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 void qskItemUpdateRecursive( QQuickItem* );
|
||||
|
|
|
@ -11,6 +11,71 @@ QSK_QT_PRIVATE_BEGIN
|
|||
#include <private/qquickitemchangelistener_p.h>
|
||||
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
|
||||
{
|
||||
// Using an eventFilter for QskEvent::GeometryChange instead ???
|
||||
|
@ -94,7 +159,7 @@ QskSlideIn::QskSlideIn( QQuickItem* parentItem )
|
|||
setPlacementPolicy( QskPlacementPolicy::Ignore );
|
||||
|
||||
connect( this, &QskPopup::transitioningChanged,
|
||||
this, &QskSlideIn::setIntermediate );
|
||||
this, &QskSlideIn::setClip );
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
if ( !isTransitioning() )
|
||||
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
|
||||
{
|
||||
const auto ratio = 1.0 - transitioningFactor();
|
||||
|
||||
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() );
|
||||
return QRectF( qskSlideInTranslation( this ), size );
|
||||
}
|
||||
|
||||
#include "moc_QskSlideIn.cpp"
|
||||
|
|
|
@ -20,7 +20,6 @@ class QSK_EXPORT QskSlideIn : public QskPopup
|
|||
|
||||
virtual Qt::Edge edge() const = 0;
|
||||
|
||||
QRectF focusIndicatorRect() const override;
|
||||
QRectF clipRect() const override;
|
||||
|
||||
void setAdjustingToParentGeometry( bool on );
|
||||
|
@ -34,8 +33,6 @@ class QSK_EXPORT QskSlideIn : public QskPopup
|
|||
void itemChange( ItemChange, const ItemChangeData& ) override;
|
||||
|
||||
private:
|
||||
void setIntermediate( bool );
|
||||
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue