Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove margin fix and tighten up spacing
  • Loading branch information
dakcarto committed Sep 11, 2012
1 parent 3caf80a commit b54a3eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
24 changes: 4 additions & 20 deletions src/gui/qgscollapsiblegroupbox.cpp
Expand Up @@ -27,25 +27,20 @@ QIcon QgsCollapsibleGroupBox::mCollapseIcon;
QIcon QgsCollapsibleGroupBox::mExpandIcon;

QgsCollapsibleGroupBox::QgsCollapsibleGroupBox( QWidget *parent )
: QGroupBox( parent ), mCollapsed( true ), mMarginOffset( 0 )
: QGroupBox( parent ), mCollapsed( true )
{
init();
}

QgsCollapsibleGroupBox::QgsCollapsibleGroupBox( const QString &title,
QWidget *parent )
: QGroupBox( title, parent ), mCollapsed( true ), mMarginOffset( 0 )
: QGroupBox( title, parent ), mCollapsed( true )
{
init();
}

void QgsCollapsibleGroupBox::init()
{
/* Top margin fix is to increase the vertical default spacing
between multiple groupboxes, especially ones without title checkboxes
may not be necessary on certain platforms */
mMarginOffset = 0; // in pixels; for temporary testing across platforms

// init icons
if ( mCollapseIcon.isNull() )
{
Expand All @@ -56,19 +51,10 @@ void QgsCollapsibleGroupBox::init()
// customize style sheet
// TODO: move to app stylesheet system, when appropriate
QString ss;
if ( mMarginOffset > 0 )
{
ss += "QgsCollapsibleGroupBox {";
ss += QString( " margin-top: %1px;" ).arg( mMarginOffset + 8 );
ss += "}";
}
ss += "QgsCollapsibleGroupBox::title {";
ss += " subcontrol-origin: margin;";
ss += " subcontrol-position: top left;";
// ss += QString( " font-size: %1";).arg( appFontSize );
ss += " margin-left: 24px;"; // offset for disclosure triangle
if ( mMarginOffset > 0 )
ss += QString( " margin-top: %1px;" ).arg( mMarginOffset );
ss += " margin-left: 20px;"; // offset for disclosure triangle
ss += "}";
setStyleSheet( ss );

Expand All @@ -80,8 +66,6 @@ void QgsCollapsibleGroupBox::init()
// TODO set size (as well as margins) depending on theme
mCollapseButton->setIconSize( QSize( 12, 12 ) );
mCollapseButton->setIcon( mExpandIcon );
if ( mMarginOffset > 0 )
mCollapseButton->move( 0, mMarginOffset ); // match title offset

// clear toolbutton default background and border
// TODO: move to app stylesheet system, when appropriate
Expand Down Expand Up @@ -141,7 +125,7 @@ void QgsCollapsibleGroupBox::setCollapsed( bool collapse )

// for consistent look/spacing across platforms when collapsed
setFlat( collapse );
setMaximumHeight( collapse ? 36 : 16777215 );
setMaximumHeight( collapse ? 28 : 16777215 );

// if we are collapsing, save hidden widgets in a list
if ( collapse )
Expand Down
1 change: 0 additions & 1 deletion src/gui/qgscollapsiblegroupbox.h
Expand Up @@ -56,7 +56,6 @@ class GUI_EXPORT QgsCollapsibleGroupBox : public QGroupBox
bool mCollapsed;
QList< QWidget* > mHiddenWidgets;
QToolButton* mCollapseButton;
int mMarginOffset;

static QIcon mCollapseIcon;
static QIcon mExpandIcon;
Expand Down

0 comments on commit b54a3eb

Please sign in to comment.