uncurstify

This commit is contained in:
Clemens Manert 2023-05-01 20:27:34 +02:00 committed by uwerat
parent bfd4f2bc5f
commit acd83bd8bf
2 changed files with 90 additions and 75 deletions

View File

@ -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 { } )
{ {
@ -52,7 +52,8 @@ 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;
} }
@ -62,7 +63,8 @@ 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;
} }
@ -86,9 +88,12 @@ void QskDrawer::updateLayout() {
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; y = ( parentSize.height() - contentSize.height() ) / 2.0;
} else if ( alignment().testFlag( Qt::AlignBottom ) ) { }
else if ( alignment().testFlag( Qt::AlignBottom ) )
{
y = ( parentSize.height() - contentSize.height() ); y = ( parentSize.height() - contentSize.height() );
} }
@ -104,9 +109,12 @@ void QskDrawer::updateLayout() {
- 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; y = ( parentSize.height() - contentSize.height() ) / 2.0;
} else if ( alignment().testFlag( Qt::AlignBottom ) ) { }
else if ( alignment().testFlag( Qt::AlignBottom ) )
{
y = ( parentSize.height() - contentSize.height() ); y = ( parentSize.height() - contentSize.height() );
} }
@ -122,32 +130,39 @@ void QskDrawer::updateLayout() {
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; x = ( parentSize.width() - contentSize.width() ) / 2;
} else if( alignment().testFlag( Qt::AlignRight) ) { }
else if( alignment().testFlag( Qt::AlignRight) )
{
x = ( parentSize.width() - contentSize.width() ); 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; x = ( parentSize.width() - contentSize.width() ) / 2;
} else if( alignment().testFlag( Qt::AlignRight) ) { }
else if( alignment().testFlag( Qt::AlignRight) )
{
x = ( parentSize.width() - contentSize.width() ); 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;