Skip to content
Permalink
Browse files

Fix QgsCollapsibleGroupBox signal and scrolling issue

- Signal now passes pointer to custom widget; calling isCollapsed() now works in connected slot
- Keep expanded group boxes in scroll areas from scrolling on first showing of dialog
  • Loading branch information
dakcarto committed Sep 15, 2012
1 parent 2edbc04 commit 8f0cb990ae2e0bb07676723ea578337402bbe77c
Showing with 7 additions and 6 deletions.
  1. +5 −5 src/gui/qgscollapsiblegroupbox.cpp
  2. +2 −1 src/gui/qgscollapsiblegroupbox.h
@@ -85,7 +85,6 @@ void QgsCollapsibleGroupBox::showEvent( QShowEvent * event )
event->accept();
return;
}
mShown = true;

// check if groupbox was set to flat in Designer or in code
mInitFlat = isFlat();
@@ -111,11 +110,12 @@ void QgsCollapsibleGroupBox::showEvent( QShowEvent * event )
}
else
{
/* manually expanding (already default) on show may scroll scroll areas;
still emit signal for connections using expanded state */
// emit signal for connections using expanded state
emit collapsedStateChanged( this );
}

// set mShown after first setCollapsed call or expanded groupboxes
// will scroll scroll areas when first shown
mShown = true;
event->accept();
}

@@ -292,7 +292,7 @@ void QgsCollapsibleGroupBox::setCollapsed( bool collapse )
mCollapseButton->setIcon( collapse ? mExpandIcon : mCollapseIcon );

// if expanding and is in a QScrollArea, scroll down to make entire widget visible
if ( mScrollOnExpand && !collapse && mParentScrollArea )
if ( mShown && mScrollOnExpand && !collapse && mParentScrollArea )
{
// process events so entire widget is shown
QApplication::processEvents();
@@ -48,7 +48,8 @@ class GUI_EXPORT QgsCollapsibleGroupBox : public QGroupBox
void setScrollOnExpand( bool scroll ) { mScrollOnExpand = scroll; }

signals:
void collapsedStateChanged( QWidget* );
/** Signal emitted when groupbox collapsed/expanded state is changed, and when first shown */
void collapsedStateChanged( QgsCollapsibleGroupBox* );

public slots:
void checkToggled( bool ckd );

0 comments on commit 8f0cb99

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