Skip to content
Permalink
Browse files

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.
  • Loading branch information
nyalldawson committed Sep 3, 2014
1 parent 224411b commit 7819949e87b8b477e75c44d35f72bfef159b8d87
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/gui/qgscollapsiblegroupbox.cpp
@@ -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() );
@@ -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 )
@@ -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 )

0 comments on commit 7819949

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