Skip to content

Commit 7819949

Browse files
committedSep 3, 2014
Ensure top of QgsCollapsibleGroupBox is visible after expand. Previous
behaviour was to scroll to center of group box for long group boxes, which is confusing for users.
1 parent 224411b commit 7819949

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
 

‎src/gui/qgscollapsiblegroupbox.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,12 @@ void QgsCollapsibleGroupBoxBasic::setCollapsed( bool collapse )
434434
{
435435
// process events so entire widget is shown
436436
QApplication::processEvents();
437+
mParentScrollArea->setUpdatesEnabled( false );
437438
mParentScrollArea->ensureWidgetVisible( this );
439+
//and then make sure the top of the widget is visible - otherwise tall group boxes
440+
//scroll to their centres, which is disorienting for users
441+
mParentScrollArea->ensureWidgetVisible( mCollapseButton, 0, 5 );
442+
mParentScrollArea->setUpdatesEnabled( true );
438443
}
439444
// emit signal for connections using collapsed state
440445
emit collapsedStateChanged( isCollapsed() );
@@ -447,7 +452,7 @@ void QgsCollapsibleGroupBoxBasic::collapseExpandFixes()
447452

448453
if ( mCollapsed )
449454
{
450-
Q_FOREACH ( QObject* child, children() )
455+
Q_FOREACH( QObject* child, children() )
451456
{
452457
QWidget* w = qobject_cast<QWidget*>( child );
453458
if ( w && w != mCollapseButton )
@@ -459,7 +464,7 @@ void QgsCollapsibleGroupBoxBasic::collapseExpandFixes()
459464
}
460465
else // on expand
461466
{
462-
Q_FOREACH ( QObject* child, children() )
467+
Q_FOREACH( QObject* child, children() )
463468
{
464469
QWidget* w = qobject_cast<QWidget*>( child );
465470
if ( w && w != mCollapseButton )

0 commit comments

Comments
 (0)
Please sign in to comment.