Fix size of drawer's content
This commit is contained in:
parent
55925c2774
commit
9699d2b4f7
@ -1,5 +1,6 @@
|
|||||||
#include "QskDrawer.h"
|
#include "QskDrawer.h"
|
||||||
#include "QskAspect.h"
|
#include "QskAspect.h"
|
||||||
|
#include "QskControl.h"
|
||||||
|
|
||||||
#include <QskPopup.h>
|
#include <QskPopup.h>
|
||||||
#include <QskBox.h>
|
#include <QskBox.h>
|
||||||
@ -10,7 +11,8 @@ QSK_SUBCONTROL( QskDrawer, DasPanel )
|
|||||||
|
|
||||||
class QskDrawer::PrivateData {
|
class QskDrawer::PrivateData {
|
||||||
public:
|
public:
|
||||||
QskBox* content;
|
QskControl* content;
|
||||||
|
QskBox* contentBox;
|
||||||
Qt::Edge edge = Qt::LeftEdge;
|
Qt::Edge edge = Qt::LeftEdge;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -22,8 +24,8 @@ QskDrawer::QskDrawer( QQuickItem* parentItem ) :
|
|||||||
|
|
||||||
setPopupFlag( PopupFlag::CloseOnPressOutside, true );
|
setPopupFlag( PopupFlag::CloseOnPressOutside, true );
|
||||||
|
|
||||||
m_data->content = new QskBox(this);
|
m_data->contentBox = new QskBox(this);
|
||||||
m_data->content->setSubcontrolProxy( QskBox::Panel, DasPanel );
|
m_data->contentBox->setSubcontrolProxy( QskBox::Panel, DasPanel );
|
||||||
|
|
||||||
setAnimationHint( DasPanel | QskAspect::Position, QskAnimationHint( 1000 ) );
|
setAnimationHint( DasPanel | QskAspect::Position, QskAnimationHint( 1000 ) );
|
||||||
|
|
||||||
@ -55,12 +57,13 @@ void QskDrawer::setEdge( Qt::Edge edge ) {
|
|||||||
edgeChanged( edge );
|
edgeChanged( edge );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskDrawer::setContent( QskControl* t ) {
|
void QskDrawer::setContent( QskControl* content ) {
|
||||||
t->setParentItem( m_data->content );
|
content->setParentItem( m_data->contentBox );
|
||||||
|
m_data->content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskDrawer::updateLayout() {
|
void QskDrawer::updateLayout() {
|
||||||
auto rect = parentItem()->childrenRect();
|
auto size = m_data->content->preferredSize();
|
||||||
|
|
||||||
switch( m_data->edge ) {
|
switch( m_data->edge ) {
|
||||||
case Qt::Edge::LeftEdge:
|
case Qt::Edge::LeftEdge:
|
||||||
@ -75,10 +78,8 @@ void QskDrawer::updateLayout() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto size = rect.size();
|
|
||||||
qreal off = metric( faderAspect() ) * size.width();
|
qreal off = metric( faderAspect() ) * size.width();
|
||||||
|
qskSetItemGeometry( m_data->contentBox, -off, 0, size.width(), size.height());
|
||||||
qskSetItemGeometry( m_data->content, -off, 0, size.width(), size.height());
|
|
||||||
|
|
||||||
Inherited::updateLayout();
|
Inherited::updateLayout();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user