Skip to content

Commit 8f0cb99

Browse files
committedSep 15, 2012
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
1 parent 2edbc04 commit 8f0cb99

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed
 

‎src/gui/qgscollapsiblegroupbox.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ void QgsCollapsibleGroupBox::showEvent( QShowEvent * event )
8585
event->accept();
8686
return;
8787
}
88-
mShown = true;
8988

9089
// check if groupbox was set to flat in Designer or in code
9190
mInitFlat = isFlat();
@@ -111,11 +110,12 @@ void QgsCollapsibleGroupBox::showEvent( QShowEvent * event )
111110
}
112111
else
113112
{
114-
/* manually expanding (already default) on show may scroll scroll areas;
115-
still emit signal for connections using expanded state */
113+
// emit signal for connections using expanded state
116114
emit collapsedStateChanged( this );
117115
}
118-
116+
// set mShown after first setCollapsed call or expanded groupboxes
117+
// will scroll scroll areas when first shown
118+
mShown = true;
119119
event->accept();
120120
}
121121

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

294294
// if expanding and is in a QScrollArea, scroll down to make entire widget visible
295-
if ( mScrollOnExpand && !collapse && mParentScrollArea )
295+
if ( mShown && mScrollOnExpand && !collapse && mParentScrollArea )
296296
{
297297
// process events so entire widget is shown
298298
QApplication::processEvents();

‎src/gui/qgscollapsiblegroupbox.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class GUI_EXPORT QgsCollapsibleGroupBox : public QGroupBox
4848
void setScrollOnExpand( bool scroll ) { mScrollOnExpand = scroll; }
4949

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

5354
public slots:
5455
void checkToggled( bool ckd );

0 commit comments

Comments
 (0)
Please sign in to comment.