Skip to content

Commit

Permalink
Fix main panel ownership in QgsPanelWidgetStack bindings
Browse files Browse the repository at this point in the history
(cherry picked from commit ef250c4)
  • Loading branch information
nyalldawson committed Jan 15, 2019
1 parent 59485f3 commit d35228d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
11 changes: 6 additions & 5 deletions python/gui/auto_generated/qgspanelwidgetstack.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ for added panels.
:param parent:
%End

void setMainPanel( QgsPanelWidget *panel );
void setMainPanel( QgsPanelWidget *panel /Transfer/ );
%Docstring
Adds the main panel widget to the stack and selects it for the user
The main widget can not be closed and only the showPanel signal is attached
Sets the main ``panel`` widget for the stack and selects it for the user.

The main widget cannot be closed and only the showPanel signal is attached
to handle children widget opening panels.

:param panel: The panel to set as the first widget in the stack.
Ownership of ``panel`` is transferred to the stack.

.. note::

Expand All @@ -59,7 +60,7 @@ and doesn't display a back button.
.. seealso:: :py:func:`setMainPanel`
%End

QgsPanelWidget *takeMainPanel();
QgsPanelWidget *takeMainPanel() /TransferBack/;
%Docstring
Removes the main panel widget from the stack and transfers ownsership to the
caller.
Expand Down
14 changes: 9 additions & 5 deletions src/gui/qgspanelwidgetstack.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,20 @@ class GUI_EXPORT QgsPanelWidgetStack : public QWidget, private Ui::QgsRendererWi
QgsPanelWidgetStack( QWidget *parent = nullptr );

/**
* Adds the main panel widget to the stack and selects it for the user
* The main widget can not be closed and only the showPanel signal is attached
* Sets the main \a panel widget for the stack and selects it for the user.
*
* The main widget cannot be closed and only the showPanel signal is attached
* to handle children widget opening panels.
* \param panel The panel to set as the first widget in the stack.
*
* Ownership of \a panel is transferred to the stack.
*
* \note a stack can have only one main panel. Any existing main panel
* should be removed by first calling takeMainPanel().
*
* \see mainPanel()
* \see takeMainPanel()
*/
void setMainPanel( QgsPanelWidget *panel );
void setMainPanel( QgsPanelWidget *panel SIP_TRANSFER );

/**
* The main panel widget that is set in the stack. The main widget can not be closed
Expand All @@ -73,7 +77,7 @@ class GUI_EXPORT QgsPanelWidgetStack : public QWidget, private Ui::QgsRendererWi
* \see mainPanel()
* \see setMainPanel()
*/
QgsPanelWidget *takeMainPanel();
QgsPanelWidget *takeMainPanel() SIP_TRANSFERBACK;

/**
* Clear the stack of all widgets. Unless the panels autoDelete is set to false
Expand Down

0 comments on commit d35228d

Please sign in to comment.