Skip to content
Permalink
Browse files

Fix corrupted group box layouts

  • Loading branch information
nyalldawson committed Oct 15, 2018
1 parent 88da833 commit 0fb0023519fd92c1cd357fe23ab3abd96b043c8d
@@ -119,7 +119,6 @@ Visual fixes for when group box is collapsed/expanded
void clearModifiers();



};


@@ -26,6 +26,8 @@
#include <QStyleOptionGroupBox>
#include <QScrollArea>

const QString COLLAPSE_HIDE_BORDER_FIX = QStringLiteral( " QgsCollapsibleGroupBoxBasic { border: none; }" );

QgsCollapsibleGroupBoxBasic::QgsCollapsibleGroupBoxBasic( QWidget *parent )
: QGroupBox( parent )
{
@@ -382,8 +384,7 @@ void QgsCollapsibleGroupBoxBasic::updateStyle()
ss += QLatin1String( " background-color: rgba(0,0,0,0)" );
}
ss += '}';
mStyleSheet = styleSheet() + ss;
setStyleSheet( mStyleSheet );
setStyleSheet( styleSheet() + ss );

// clear toolbutton default background and border and apply offset
QString ssd;
@@ -444,9 +445,15 @@ void QgsCollapsibleGroupBoxBasic::collapseExpandFixes()
// handle child widgets so they don't paint while hidden
const char *hideKey = "CollGrpBxHide";

QString ss = styleSheet();
if ( mCollapsed )
{
setStyleSheet( mStyleSheet + " QgsCollapsibleGroupBoxBasic { border: none; }" );
if ( !ss.contains( COLLAPSE_HIDE_BORDER_FIX ) )
{
ss += COLLAPSE_HIDE_BORDER_FIX;
setStyleSheet( ss );
}

Q_FOREACH ( QObject *child, children() )
{
QWidget *w = qobject_cast<QWidget *>( child );
@@ -459,7 +466,12 @@ void QgsCollapsibleGroupBoxBasic::collapseExpandFixes()
}
else // on expand
{
setStyleSheet( mStyleSheet );
if ( ss.contains( COLLAPSE_HIDE_BORDER_FIX ) )
{
ss.replace( COLLAPSE_HIDE_BORDER_FIX, QString() );
setStyleSheet( ss );
}

Q_FOREACH ( QObject *child, children() )
{
QWidget *w = qobject_cast<QWidget *>( child );
@@ -161,8 +161,6 @@ class GUI_EXPORT QgsCollapsibleGroupBoxBasic : public QGroupBox

QIcon mCollapseIcon;
QIcon mExpandIcon;

QString mStyleSheet;
};

/**

0 comments on commit 0fb0023

Please sign in to comment.
You can’t perform that action at this time.