uncurstify
This commit is contained in:
parent
bfd4f2bc5f
commit
acd83bd8bf
|
@ -11,14 +11,14 @@ QSK_SUBCONTROL( QskDrawer, Panel )
|
||||||
QSK_SUBCONTROL( QskDrawer, Overlay )
|
QSK_SUBCONTROL( QskDrawer, Overlay )
|
||||||
|
|
||||||
class QskDrawer::PrivateData {
|
class QskDrawer::PrivateData {
|
||||||
public:
|
public:
|
||||||
QskControl* content;
|
QskControl* content;
|
||||||
QskBox* contentBox;
|
QskBox* contentBox;
|
||||||
Qt::Edge edge = Qt::LeftEdge;
|
Qt::Edge edge = Qt::LeftEdge;
|
||||||
Qt::Alignment alignment = Qt::AlignCenter;
|
Qt::Alignment alignment = Qt::AlignCenter;
|
||||||
};
|
};
|
||||||
|
|
||||||
QskDrawer::QskDrawer( QQuickItem* parentItem ) :
|
QskDrawer::QskDrawer( QQuickItem* parentItem ):
|
||||||
Inherited ( parentItem )
|
Inherited ( parentItem )
|
||||||
, m_data( new PrivateData { } )
|
, m_data( new PrivateData { } )
|
||||||
{
|
{
|
||||||
|
@ -33,9 +33,9 @@ QskDrawer::QskDrawer( QQuickItem* parentItem ) :
|
||||||
setFaderAspect( Panel | QskAspect::Metric );
|
setFaderAspect( Panel | QskAspect::Metric );
|
||||||
|
|
||||||
connect(this, &QskDrawer::closed, this, [this]() {
|
connect(this, &QskDrawer::closed, this, [this]() {
|
||||||
startTransition( Panel | QskAspect::Metric,
|
startTransition( Panel | QskAspect::Metric,
|
||||||
animationHint( Panel | QskAspect::Position ),
|
animationHint( Panel | QskAspect::Position ),
|
||||||
0.0, 1.0 );
|
0.0, 1.0 );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,8 +52,9 @@ Qt::Alignment QskDrawer::alignment() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskDrawer::setEdge( Qt::Edge edge ) {
|
void QskDrawer::setEdge( Qt::Edge edge ) {
|
||||||
if( m_data->edge == edge ) {
|
if( m_data->edge == edge )
|
||||||
return;
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
@ -62,8 +63,9 @@ void QskDrawer::setEdge( Qt::Edge edge ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskDrawer::setAlignment( Qt::Alignment alignment ) {
|
void QskDrawer::setAlignment( Qt::Alignment alignment ) {
|
||||||
if( m_data->alignment == alignment ) {
|
if( m_data->alignment == alignment )
|
||||||
return;
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
@ -81,76 +83,89 @@ void QskDrawer::updateLayout() {
|
||||||
const auto& parentSize = parentItem()->size();
|
const auto& parentSize = parentItem()->size();
|
||||||
|
|
||||||
switch( m_data->edge ) {
|
switch( m_data->edge ) {
|
||||||
case Qt::Edge::LeftEdge:
|
case Qt::Edge::LeftEdge:
|
||||||
{
|
{
|
||||||
qreal x = metric( faderAspect() ) * contentSize.width() * -1.0;
|
qreal x = metric( faderAspect() ) * contentSize.width() * -1.0;
|
||||||
qreal y = 0;
|
qreal y = 0;
|
||||||
|
|
||||||
if( alignment().testFlag( Qt::AlignVCenter ) ) {
|
if( alignment().testFlag( Qt::AlignVCenter ) )
|
||||||
y = ( parentSize.height() - contentSize.height() ) / 2.0;
|
{
|
||||||
} else if ( alignment().testFlag( Qt::AlignBottom ) ) {
|
y = ( parentSize.height() - contentSize.height() ) / 2.0;
|
||||||
y = ( parentSize.height() - contentSize.height() );
|
}
|
||||||
}
|
else if ( alignment().testFlag( Qt::AlignBottom ) )
|
||||||
|
{
|
||||||
|
y = ( parentSize.height() - contentSize.height() );
|
||||||
|
}
|
||||||
|
|
||||||
qskSetItemGeometry( m_data->contentBox,
|
qskSetItemGeometry( m_data->contentBox,
|
||||||
x, y,
|
x, y,
|
||||||
contentSize.width(), parentSize.height() );
|
contentSize.width(), parentSize.height() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Qt::Edge::RightEdge:
|
case Qt::Edge::RightEdge:
|
||||||
{
|
{
|
||||||
qreal x = ( metric( faderAspect() ) * contentSize.width() )
|
qreal x = ( metric( faderAspect() ) * contentSize.width() )
|
||||||
+ parentSize.width()
|
+ parentSize.width()
|
||||||
- contentSize.width();
|
- contentSize.width();
|
||||||
qreal y = 0;
|
qreal y = 0;
|
||||||
|
|
||||||
if( alignment().testFlag( Qt::AlignVCenter ) ) {
|
if( alignment().testFlag( Qt::AlignVCenter ) )
|
||||||
y = ( parentSize.height() - contentSize.height() ) / 2.0;
|
{
|
||||||
} else if ( alignment().testFlag( Qt::AlignBottom ) ) {
|
y = ( parentSize.height() - contentSize.height() ) / 2.0;
|
||||||
y = ( parentSize.height() - contentSize.height() );
|
}
|
||||||
}
|
else if ( alignment().testFlag( Qt::AlignBottom ) )
|
||||||
|
{
|
||||||
|
y = ( parentSize.height() - contentSize.height() );
|
||||||
|
}
|
||||||
|
|
||||||
qskSetItemGeometry( m_data->contentBox,
|
qskSetItemGeometry( m_data->contentBox,
|
||||||
x, y,
|
x, y,
|
||||||
contentSize.width(),
|
contentSize.width(),
|
||||||
parentSize.height() );
|
parentSize.height() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Qt::Edge::TopEdge:
|
case Qt::Edge::TopEdge:
|
||||||
{
|
{
|
||||||
qreal x = 0;
|
qreal x = 0;
|
||||||
qreal y = metric( faderAspect() ) * contentSize.height();
|
qreal y = metric( faderAspect() ) * contentSize.height();
|
||||||
|
|
||||||
if( alignment().testFlag( Qt::AlignCenter) ) {
|
if( alignment().testFlag( Qt::AlignCenter) )
|
||||||
x = ( parentSize.width() - contentSize.width() ) / 2;
|
{
|
||||||
} else if( alignment().testFlag( Qt::AlignRight) ) {
|
x = ( parentSize.width() - contentSize.width() ) / 2;
|
||||||
x = ( parentSize.width() - contentSize.width() );
|
}
|
||||||
}
|
else if( alignment().testFlag( Qt::AlignRight) )
|
||||||
|
{
|
||||||
|
x = ( parentSize.width() - contentSize.width() );
|
||||||
|
}
|
||||||
|
|
||||||
qskSetItemGeometry( m_data->contentBox,
|
qskSetItemGeometry( m_data->contentBox,
|
||||||
x, -y,
|
x, -y,
|
||||||
parentSize.width(), contentSize.height());
|
parentSize.width(), contentSize.height() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Qt::Edge::BottomEdge:
|
case Qt::Edge::BottomEdge:
|
||||||
{
|
{
|
||||||
qreal x = 0;
|
qreal x = 0;
|
||||||
qreal y = metric( faderAspect() ) * contentSize.height() + parentSize.height() - contentSize.height();
|
qreal y = metric( faderAspect() ) * contentSize.height() + parentSize.height() -
|
||||||
|
contentSize.height();
|
||||||
|
|
||||||
if( alignment().testFlag( Qt::AlignCenter) ) {
|
if( alignment().testFlag( Qt::AlignCenter) )
|
||||||
x = ( parentSize.width() - contentSize.width() ) / 2;
|
{
|
||||||
} else if( alignment().testFlag( Qt::AlignRight) ) {
|
x = ( parentSize.width() - contentSize.width() ) / 2;
|
||||||
x = ( parentSize.width() - contentSize.width() );
|
}
|
||||||
}
|
else if( alignment().testFlag( Qt::AlignRight) )
|
||||||
|
{
|
||||||
|
x = ( parentSize.width() - contentSize.width() );
|
||||||
|
}
|
||||||
|
|
||||||
qskSetItemGeometry( m_data->contentBox,
|
qskSetItemGeometry( m_data->contentBox,
|
||||||
x, y,
|
x, y,
|
||||||
parentSize.width(), contentSize.height());
|
parentSize.width(), contentSize.height() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,8 +175,8 @@ void QskDrawer::updateLayout() {
|
||||||
void QskDrawer::aboutToShow()
|
void QskDrawer::aboutToShow()
|
||||||
{
|
{
|
||||||
startTransition( Panel | QskAspect::Metric,
|
startTransition( Panel | QskAspect::Metric,
|
||||||
animationHint( Panel | QskAspect::Position ),
|
animationHint( Panel | QskAspect::Position ),
|
||||||
1.0, 0.0 );
|
1.0, 0.0 );
|
||||||
Inherited::aboutToShow();
|
Inherited::aboutToShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class QSK_EXPORT QskDrawer : public QskPopup
|
||||||
Q_PROPERTY( Qt::Edge edge READ edge WRITE setEdge NOTIFY edgeChanged )
|
Q_PROPERTY( Qt::Edge edge READ edge WRITE setEdge NOTIFY edgeChanged )
|
||||||
Q_PROPERTY( Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged )
|
Q_PROPERTY( Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, Overlay )
|
QSK_SUBCONTROLS( Panel, Overlay )
|
||||||
QskDrawer( QQuickItem* parentItem = nullptr );
|
QskDrawer( QQuickItem* parentItem = nullptr );
|
||||||
~QskDrawer() override;
|
~QskDrawer() override;
|
||||||
|
@ -26,14 +26,14 @@ class QSK_EXPORT QskDrawer : public QskPopup
|
||||||
void setEdge( Qt::Edge edge );
|
void setEdge( Qt::Edge edge );
|
||||||
void setAlignment( Qt::Alignment aligmnent );
|
void setAlignment( Qt::Alignment aligmnent );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void aboutToShow() override;
|
void aboutToShow() override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void edgeChanged( Qt::Edge );
|
void edgeChanged( Qt::Edge );
|
||||||
void alignmentChanged( Qt::Alignment );
|
void alignmentChanged( Qt::Alignment );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class PrivateData;
|
class PrivateData;
|
||||||
std::unique_ptr< PrivateData > m_data;
|
std::unique_ptr< PrivateData > m_data;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue