Expose addTabifiedDockWidget through QgisInterface

This commit is contained in:
Germán Carrillo 2020-05-02 13:15:00 -05:00 committed by Nyall Dawson
parent 4629f83409
commit 76a8f8270a
4 changed files with 41 additions and 0 deletions

View File

@ -1057,7 +1057,25 @@ Remove action from the Web menu
%Docstring
Adds a ``dock`` widget to the main window, in the specified dock ``area``.
.. seealso:: :py:func:`addTabifiedDockWidget`
.. seealso:: :py:func:`removeDockWidget`
%End
virtual void addTabifiedDockWidget( Qt::DockWidgetArea area, QDockWidget *dockwidget, const QStringList &tabifyWith = QStringList(), bool raiseTab = false ) = 0;
%Docstring
Add a dock widget to the given area and tabify it (if other dock widgets
exist in the same ``area``). The new tab will be below other tabs unless
``raiseTab`` is passed as true.
``tabifyWith`` is a list of dock widget object names, ordered by
priority, with which the new dock widget should be tabified. Only the
first matching object name will be picked. If none of the given object
names is found in that ``area`` (or if ``tabifyWith`` is not given at
all), the new dock widget will be created anyways, but its location
within that ``area`` will be unpredictable.
.. versionadded:: 3.14
%End
virtual void removeDockWidget( QDockWidget *dockwidget ) = 0;

View File

@ -470,6 +470,11 @@ void QgisAppInterface::addDockWidget( Qt::DockWidgetArea area, QDockWidget *dock
qgis->addDockWidget( area, dockwidget );
}
void QgisAppInterface::addTabifiedDockWidget( Qt::DockWidgetArea area, QDockWidget *dockwidget, const QStringList &tabifyWith, bool raiseTab )
{
qgis->addTabifiedDockWidget( area, dockwidget, tabifyWith, raiseTab );
}
void QgisAppInterface::removeDockWidget( QDockWidget *dockwidget )
{
qgis->removeDockWidget( dockwidget );

View File

@ -132,6 +132,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
void insertAddLayerAction( QAction *action ) override;
void removeAddLayerAction( QAction *action ) override;
void addDockWidget( Qt::DockWidgetArea area, QDockWidget *dockwidget ) override;
void addTabifiedDockWidget( Qt::DockWidgetArea area, QDockWidget *dockwidget, const QStringList &tabifyWith = QStringList(), bool raiseTab = false ) override;
void removeDockWidget( QDockWidget *dockwidget ) override;
QgsAdvancedDigitizingDockWidget *cadDockWidget() override;
void showLayerProperties( QgsMapLayer *l ) override;

View File

@ -889,10 +889,27 @@ class GUI_EXPORT QgisInterface : public QObject
/**
* Adds a \a dock widget to the main window, in the specified dock \a area.
*
* \see addTabifiedDockWidget()
* \see removeDockWidget()
*/
virtual void addDockWidget( Qt::DockWidgetArea area, QDockWidget *dockwidget ) = 0;
/**
* Add a dock widget to the given area and tabify it (if other dock widgets
* exist in the same \a area). The new tab will be below other tabs unless
* \a raiseTab is passed as true.
*
* \a tabifyWith is a list of dock widget object names, ordered by
* priority, with which the new dock widget should be tabified. Only the
* first matching object name will be picked. If none of the given object
* names is found in that \a area (or if \a tabifyWith is not given at
* all), the new dock widget will be created anyways, but its location
* within that \a area will be unpredictable.
*
* \since QGIS 3.14
*/
virtual void addTabifiedDockWidget( Qt::DockWidgetArea area, QDockWidget *dockwidget, const QStringList &tabifyWith = QStringList(), bool raiseTab = false ) = 0;
/**
* Removes the specified \a dock widget from main window (without deleting it).
*