Skip to content

Commit 36eef80

Browse files
committed
Also pass InitialOption to addDockWidgetToContainingWindow()
So you can control initial size and such
1 parent 306bf26 commit 36eef80

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/DockWidgetBase.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,12 @@ void DockWidgetBase::addDockWidgetAsTab(DockWidgetBase *other, InitialOption opt
204204

205205
void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other,
206206
Location location,
207-
DockWidgetBase *relativeTo)
207+
DockWidgetBase *relativeTo,
208+
InitialOption initialOption)
208209
{
209210
if (auto mainWindow = qobject_cast<MainWindowBase*>(window())) {
210211
// It's inside a main window. Simply use the main window API.
211-
mainWindow->addDockWidget(other, location, relativeTo);
212+
mainWindow->addDockWidget(other, location, relativeTo, initialOption);
212213
return;
213214
}
214215

@@ -228,7 +229,7 @@ void DockWidgetBase::addDockWidgetToContainingWindow(DockWidgetBase *other,
228229
morphIntoFloatingWindow();
229230

230231
if (auto fw = floatingWindow()) {
231-
fw->dropArea()->addDockWidget(other, location, relativeTo);
232+
fw->dropArea()->addDockWidget(other, location, relativeTo, initialOption);
232233
} else {
233234
qWarning() << Q_FUNC_INFO << "Couldn't find floating nested window";
234235
}

src/DockWidgetBase.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,13 @@ class DOCKS_EXPORT DockWidgetBase : public QWidget
119119
*
120120
* @param other The other dock widget to dock into the window.
121121
* @param location The location to dock.
122-
* @param relativeTo The dock widget that the @p location is relative to. If null then the window is considered.
122+
* @param relativeTo The dock widget that the @p location is relative to. If null then the window is considered
123+
* @param initialOption Allows to specify some extra options that are used while docking.
123124
* @sa MainWindow::addDockWidget(), DockWidget::addDockWidgetAsTab()
124125
*/
125126
void addDockWidgetToContainingWindow(DockWidgetBase *other, KDDockWidgets::Location location,
126-
DockWidgetBase *relativeTo = nullptr);
127+
DockWidgetBase *relativeTo = nullptr,
128+
InitialOption initialOption = {});
127129

128130
/**
129131
* @brief sets the widget which this dock widget hosts.

0 commit comments

Comments
 (0)