diff --git a/python/gui/auto_generated/qgisinterface.sip.in b/python/gui/auto_generated/qgisinterface.sip.in index 3d5fd2bf69f..8dafdc6846e 100644 --- a/python/gui/auto_generated/qgisinterface.sip.in +++ b/python/gui/auto_generated/qgisinterface.sip.in @@ -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; diff --git a/src/app/qgisappinterface.cpp b/src/app/qgisappinterface.cpp index 92750c9906e..6f52b7fdcc1 100644 --- a/src/app/qgisappinterface.cpp +++ b/src/app/qgisappinterface.cpp @@ -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 ); diff --git a/src/app/qgisappinterface.h b/src/app/qgisappinterface.h index 52ab18f8625..c6d2836a8b4 100644 --- a/src/app/qgisappinterface.h +++ b/src/app/qgisappinterface.h @@ -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; diff --git a/src/gui/qgisinterface.h b/src/gui/qgisinterface.h index 06b24ff9309..90955b8781d 100644 --- a/src/gui/qgisinterface.h +++ b/src/gui/qgisinterface.h @@ -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). *