Also pass InitialOption to addDockWidgetToContainingWindow()

So you can control initial size and such
This commit is contained in:
Sergio Martins
2021-01-09 13:57:13 +00:00
parent 306bf26f66
commit 36eef80192
2 changed files with 8 additions and 5 deletions

View File

@@ -204,11 +204,12 @@ void DockWidgetBase::addDockWidgetAsTab(DockWidgetBase *other, InitialOption opt
void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other,
Location location,
DockWidgetBase *relativeTo)
DockWidgetBase *relativeTo,
InitialOption initialOption)
{
if (auto mainWindow = qobject_cast<MainWindowBase*>(window())) {
// It's inside a main window. Simply use the main window API.
mainWindow->addDockWidget(other, location, relativeTo);
mainWindow->addDockWidget(other, location, relativeTo, initialOption);
return;
}
@@ -228,7 +229,7 @@ void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other,
morphIntoFloatingWindow();
if (auto fw = floatingWindow()) {
fw->dropArea()->addDockWidget(other, location, relativeTo);
fw->dropArea()->addDockWidget(other, location, relativeTo, initialOption);
} else {
qWarning() << Q_FUNC_INFO << "Couldn't find floating nested window";
}

View File

@@ -119,11 +119,13 @@ public:
*
* @param other The other dock widget to dock into the window.
* @param location The location to dock.
* @param relativeTo The dock widget that the @p location is relative to. If null then the window is considered.
* @param relativeTo The dock widget that the @p location is relative to. If null then the window is considered
* @param initialOption Allows to specify some extra options that are used while docking.
* @sa MainWindow::addDockWidget(), DockWidget::addDockWidgetAsTab()
*/
void addDockWidgetToContainingWindow(DockWidgetBase *other, KDDockWidgets::Location location,
DockWidgetBase *relativeTo = nullptr);
DockWidgetBase *relativeTo = nullptr,
InitialOption initialOption = {});
/**
* @brief sets the widget which this dock widget hosts.