Skip to content

Commit

Permalink
Ensure top of QgsCollapsibleGroupBox is visible after expand. Previous
Browse files Browse the repository at this point in the history
behaviour was to scroll to center of group box for long group boxes,
which is confusing for users.
  • Loading branch information
nyalldawson committed Sep 3, 2014
1 parent 224411b commit 7819949
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/gui/qgscollapsiblegroupbox.cpp
Expand Up @@ -434,7 +434,12 @@ void QgsCollapsibleGroupBoxBasic::setCollapsed( bool collapse )
{
// process events so entire widget is shown
QApplication::processEvents();
mParentScrollArea->setUpdatesEnabled( false );
mParentScrollArea->ensureWidgetVisible( this );
//and then make sure the top of the widget is visible - otherwise tall group boxes
//scroll to their centres, which is disorienting for users
mParentScrollArea->ensureWidgetVisible( mCollapseButton, 0, 5 );
mParentScrollArea->setUpdatesEnabled( true );
}
// emit signal for connections using collapsed state
emit collapsedStateChanged( isCollapsed() );
Expand All @@ -447,7 +452,7 @@ void QgsCollapsibleGroupBoxBasic::collapseExpandFixes()

if ( mCollapsed )
{
Q_FOREACH ( QObject* child, children() )
Q_FOREACH( QObject* child, children() )
{
QWidget* w = qobject_cast<QWidget*>( child );
if ( w && w != mCollapseButton )
Expand All @@ -459,7 +464,7 @@ void QgsCollapsibleGroupBoxBasic::collapseExpandFixes()
}
else // on expand
{
Q_FOREACH ( QObject* child, children() )
Q_FOREACH( QObject* child, children() )
{
QWidget* w = qobject_cast<QWidget*>( child );
if ( w && w != mCollapseButton )
Expand Down

0 comments on commit 7819949

Please sign in to comment.