@@ -434,7 +434,12 @@ void QgsCollapsibleGroupBoxBasic::setCollapsed( bool collapse )
434
434
{
435
435
// process events so entire widget is shown
436
436
QApplication::processEvents ();
437
+ mParentScrollArea ->setUpdatesEnabled ( false );
437
438
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 );
438
443
}
439
444
// emit signal for connections using collapsed state
440
445
emit collapsedStateChanged ( isCollapsed () );
@@ -447,7 +452,7 @@ void QgsCollapsibleGroupBoxBasic::collapseExpandFixes()
447
452
448
453
if ( mCollapsed )
449
454
{
450
- Q_FOREACH ( QObject* child, children () )
455
+ Q_FOREACH ( QObject* child, children () )
451
456
{
452
457
QWidget* w = qobject_cast<QWidget*>( child );
453
458
if ( w && w != mCollapseButton )
@@ -459,7 +464,7 @@ void QgsCollapsibleGroupBoxBasic::collapseExpandFixes()
459
464
}
460
465
else // on expand
461
466
{
462
- Q_FOREACH ( QObject* child, children () )
467
+ Q_FOREACH ( QObject* child, children () )
463
468
{
464
469
QWidget* w = qobject_cast<QWidget*>( child );
465
470
if ( w && w != mCollapseButton )
0 commit comments