Skip to content

Commit

Permalink
Correctly emit panelAccepted when panel is not in dock mode
Browse files Browse the repository at this point in the history
Fixes #15373 - refine current rule not working when symbol widgets
are not used in the style dock

This fixes a behavioural difference when new panels are opened
in a QgsPanelWidget when in docked/undocked mode. When in
docked mode, the newly opened panel will emit panelAccepted
when it is accepted. But for undocked mode, the parent
panel was emitting the panelAccepted signal and so the
connection to update the renderer was never
triggered. Now both docked/undocked panels will always
emit panelAccepted ONLY from the newly opened panel itself.

This also fixes memory leaks as the clean up code was never
run in undocked mode.

I've updated the docs to clarify this behaviour.
  • Loading branch information
nyalldawson committed Oct 5, 2016
1 parent bad1372 commit ddbd25d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions python/gui/qgspanelwidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ class QgsPanelWidget : public QWidget
* @param panel The panel widget that was accepted.
* @note This argument is normally raised with emit panelAccepted(this)
* so that callers can retrive the widget easier in calling code.
* @note this is emitted only when this panel is accepted, and is not emitted for
* child panels. Eg, if this panel opens a second stacked panel, then this panel
* will not emit panelAccepted when the second panel is accepted.
*/
void panelAccepted( QgsPanelWidget* panel );

Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgspanelwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void QgsPanelWidget::openPanel( QgsPanelWidget* panel )
dlg->layout()->addWidget( buttonBox );
dlg->exec();
settings.setValue( key, dlg->saveGeometry() );
emit panelAccepted( panel );
panel->acceptPanel();
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/gui/qgspanelwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ class GUI_EXPORT QgsPanelWidget : public QWidget
* @param panel The panel widget that was accepted.
* @note This argument is normally raised with emit panelAccepted(this)
* so that callers can retrive the widget easier in calling code.
* @note this is emitted only when this panel is accepted, and is not emitted for
* child panels. Eg, if this panel opens a second stacked panel, then this panel
* will not emit panelAccepted when the second panel is accepted.
*/
void panelAccepted( QgsPanelWidget* panel );

Expand Down

0 comments on commit ddbd25d

Please sign in to comment.