diff --git a/src/DockWidget.cpp b/src/DockWidget.cpp index 9184b38..9dde469 100644 --- a/src/DockWidget.cpp +++ b/src/DockWidget.cpp @@ -622,6 +622,13 @@ void CDockWidget::setMinimumSizeHintMode(eMinimumSizeHintMode Mode) } +//============================================================================ +CDockWidget::eMinimumSizeHintMode CDockWidget::minimumSizeHintMode() const +{ + return d->MinimumSizeHintMode; +} + + //============================================================================ bool CDockWidget::isCentralWidget() const { @@ -990,14 +997,20 @@ void CDockWidget::setClosedState(bool Closed) //============================================================================ QSize CDockWidget::minimumSizeHint() const { - if (d->MinimumSizeHintMode == CDockWidget::MinimumSizeHintFromDockWidget || !d->Widget) + if (!d->Widget) { return QSize(60, 40); } - else + + switch (d->MinimumSizeHintMode) { - return d->Widget->minimumSizeHint(); + case MinimumSizeHintFromDockWidget: return QSize(60, 40); + case MinimumSizeHintFromContent: return d->Widget->minimumSizeHint(); + case MinimumSizeHintFromDockWidgetMinimumSize: return minimumSize(); + case MinimumSizeHintFromContentMinimumSize: return d->Widget->minimumSize(); } + + return d->Widget->minimumSizeHint(); } diff --git a/src/DockWidget.h b/src/DockWidget.h index c0d0d91..43f8048 100644 --- a/src/DockWidget.h +++ b/src/DockWidget.h @@ -208,12 +208,17 @@ public: * reimplements minimumSizeHint() function to return a very small minimum * size hint. If you would like to adhere the minimumSizeHint() from the * content widget, then set the minimumSizeHintMode() to - * MinimumSizeHintFromContent. + * MinimumSizeHintFromContent. If you would like to use the minimumSize() + * value of the content widget or the dock widget, then you can use the + * MinimumSizeHintFromDockWidgetMinimumSize or + * MinimumSizeHintFromContentMinimumSize modes. */ enum eMinimumSizeHintMode { MinimumSizeHintFromDockWidget, - MinimumSizeHintFromContent + MinimumSizeHintFromContent, + MinimumSizeHintFromDockWidgetMinimumSize, + MinimumSizeHintFromContentMinimumSize, }; @@ -411,6 +416,11 @@ public: */ void setMinimumSizeHintMode(eMinimumSizeHintMode Mode); + /** + * Get the minimum size hint mode configured by setMinimumSizeHintMode + */ + eMinimumSizeHintMode minimumSizeHintMode() const; + /** * Returns true if the dock widget is set as central widget of it's dock manager */