diff --git a/src/DockWidget.cpp b/src/DockWidget.cpp index 9184b38..518a064 100644 --- a/src/DockWidget.cpp +++ b/src/DockWidget.cpp @@ -621,6 +621,11 @@ void CDockWidget::setMinimumSizeHintMode(eMinimumSizeHintMode Mode) d->MinimumSizeHintMode = Mode; } +//============================================================================ +ads::CDockWidget::eMinimumSizeHintMode CDockWidget::getMinimumSizeHintMode() const +{ + return d->MinimumSizeHintMode; +} //============================================================================ bool CDockWidget::isCentralWidget() const @@ -990,14 +995,15 @@ void CDockWidget::setClosedState(bool Closed) //============================================================================ QSize CDockWidget::minimumSizeHint() const { - if (d->MinimumSizeHintMode == CDockWidget::MinimumSizeHintFromDockWidget || !d->Widget) - { - return QSize(60, 40); - } - else - { - return d->Widget->minimumSizeHint(); - } + if (d->MinimumSizeHintMode == CDockWidget::MinimumSizeHintFromDockWidget || !d->Widget) + return QSize(60, 40); + else if (d->MinimumSizeHintMode == CDockWidget::MinimumSizeHintFromDockWidgetMinimumSize) + return minimumSize(); + else if (d->MinimumSizeHintMode == CDockWidget::MinimumSizeHintFromContentMinimumSize) + return d->Widget->minimumSize(); + + // default from widget + return d->Widget->minimumSizeHint(); } diff --git a/src/DockWidget.h b/src/DockWidget.h index c0d0d91..6a5db55 100644 --- a/src/DockWidget.h +++ b/src/DockWidget.h @@ -209,11 +209,14 @@ public: * size hint. If you would like to adhere the minimumSizeHint() from the * content widget, then set the minimumSizeHintMode() to * MinimumSizeHintFromContent. + * Set minimumSizeHint to the docks or widgets minimumSize for special control. */ enum eMinimumSizeHintMode { MinimumSizeHintFromDockWidget, - MinimumSizeHintFromContent + MinimumSizeHintFromContent, + MinimumSizeHintFromDockWidgetMinimumSize, + MinimumSizeHintFromContentMinimumSize, }; @@ -411,6 +414,11 @@ public: */ void setMinimumSizeHintMode(eMinimumSizeHintMode Mode); + /** + * Get the minimum size hint mode configured by setMinimumSizeHintMode + */ + eMinimumSizeHintMode getMinimumSizeHintMode() const; + /** * Returns true if the dock widget is set as central widget of it's dock manager */