Fix main panel ownership in QgsPanelWidgetStack bindings

This commit is contained in:
Nyall Dawson 2019-01-14 14:25:09 +10:00
parent 3bc06e2bb9
commit ef250c4563
2 changed files with 15 additions and 10 deletions

View File

@ -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::
@ -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.

View File

@ -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
@ -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