Skip to content

Commit

Permalink
Revert "Try to fix QgsCollapsibleGroupBox crash on Qt 5.10"
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Feb 12, 2018
1 parent ec86fcb commit 03e49f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/gui/qgscollapsiblegroupbox.cpp
Expand Up @@ -58,17 +58,17 @@ void QgsCollapsibleGroupBoxBasic::init()
mExpandIcon = QgsApplication::getThemeIcon( QStringLiteral( "/mIconExpand.svg" ) );

// collapse button
mCollapseButton = qgis::make_unique<QgsGroupBoxCollapseButton>( nullptr );
mCollapseButton = new QgsGroupBoxCollapseButton( this );
mCollapseButton->setObjectName( QStringLiteral( "collapseButton" ) );
mCollapseButton->setAutoRaise( true );
mCollapseButton->setFixedSize( 16, 16 );
// TODO set size (as well as margins) depending on theme, in updateStyle()
mCollapseButton->setIconSize( QSize( 12, 12 ) );
mCollapseButton->setIcon( mCollapseIcon );
setFocusProxy( mCollapseButton.get() );
setFocusProxy( mCollapseButton );
setFocusPolicy( Qt::StrongFocus );

connect( mCollapseButton.get(), &QAbstractButton::clicked, this, &QgsCollapsibleGroupBoxBasic::toggleCollapsed );
connect( mCollapseButton, &QAbstractButton::clicked, this, &QgsCollapsibleGroupBoxBasic::toggleCollapsed );
connect( this, &QGroupBox::toggled, this, &QgsCollapsibleGroupBoxBasic::checkToggled );
connect( this, &QGroupBox::clicked, this, &QgsCollapsibleGroupBoxBasic::checkClicked );
}
Expand Down Expand Up @@ -221,7 +221,7 @@ void QgsCollapsibleGroupBoxBasic::toggleCollapsed()
{
// verify if sender is this group box's collapse button
QgsGroupBoxCollapseButton *collBtn = qobject_cast<QgsGroupBoxCollapseButton *>( QObject::sender() );
bool senderCollBtn = ( collBtn && collBtn == mCollapseButton.get() );
bool senderCollBtn = ( collBtn && collBtn == mCollapseButton );

mAltDown = ( mAltDown || mCollapseButton->altDown() );
mShiftDown = ( mShiftDown || mCollapseButton->shiftDown() );
Expand Down Expand Up @@ -426,7 +426,7 @@ void QgsCollapsibleGroupBoxBasic::setCollapsed( bool collapse )
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.get(), 0, 5 );
mParentScrollArea->ensureWidgetVisible( mCollapseButton, 0, 5 );
mParentScrollArea->setUpdatesEnabled( true );
}
// emit signal for connections using collapsed state
Expand All @@ -444,7 +444,7 @@ void QgsCollapsibleGroupBoxBasic::collapseExpandFixes()
Q_FOREACH ( QObject *child, children() )
{
QWidget *w = qobject_cast<QWidget *>( child );
if ( w && w != mCollapseButton.get() )
if ( w && w != mCollapseButton )
{
w->setProperty( hideKey, true );
w->hide();
Expand All @@ -456,7 +456,7 @@ void QgsCollapsibleGroupBoxBasic::collapseExpandFixes()
Q_FOREACH ( QObject *child, children() )
{
QWidget *w = qobject_cast<QWidget *>( child );
if ( w && w != mCollapseButton.get() )
if ( w && w != mCollapseButton )
{
if ( w->property( hideKey ).toBool() )
w->show();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgscollapsiblegroupbox.h
Expand Up @@ -157,7 +157,7 @@ class GUI_EXPORT QgsCollapsibleGroupBoxBasic : public QGroupBox
bool mScrollOnExpand;
bool mShown;
QScrollArea *mParentScrollArea = nullptr;
std::unique_ptr<QgsGroupBoxCollapseButton> mCollapseButton;
QgsGroupBoxCollapseButton *mCollapseButton = nullptr;
QWidget *mSyncParent = nullptr;
QString mSyncGroup;
bool mAltDown;
Expand Down

0 comments on commit 03e49f1

Please sign in to comment.