Allow to pass a preferred initial size to MainWindow::addDockWidget()

fixes #95
This commit is contained in:
Sergio Martins
2020-12-28 11:18:11 +00:00
parent 08c058b214
commit 6719dd2b9e
5 changed files with 60 additions and 22 deletions

View File

@@ -88,18 +88,27 @@ namespace KDDockWidgets
InitialOption(InitialVisibilityOption v)
: visibility(v) {}
/*InitialOption(QSize size)
InitialOption(QSize size)
: preferredSize(size) {}
InitialOption(InitialVisibilityOption v, QSize size)
: visibility(v)
, preferredSize(size)
{}*/
{}
bool startsHidden() const {
return visibility == InitialVisibilityOption::StartHidden;
}
int preferredLength(Qt::Orientation o) const {
return o == Qt::Horizontal ? preferredSize.width()
: preferredSize.height();
}
bool hasPreferredLength(Qt::Orientation o) const {
return preferredLength(o) > 0;
}
/**
* @brief Allows a dock widget to be docked as hidden.
*
@@ -117,7 +126,7 @@ namespace KDDockWidgets
* dock widget to the left then only the preferred width will be taken into account, as the
* height will simply fill the whole layout.
*/
//const QSize preferredSize; not yet done.
const QSize preferredSize;
private:
friend class Layouting::Item;