File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ struct DockWidgetPrivate
82
82
QSize ToolBarIconSizeFloating = QSize(24 , 24 );
83
83
bool IsFloatingTopLevel = false ;
84
84
QList<QAction*> TitleBarActions;
85
+ CDockWidget::eMinimumSizeHintMode MinimumSizeHintMode = CDockWidget::MinimumSizeHintFromDockWidget;
85
86
86
87
/* *
87
88
* Private data constructor
@@ -424,6 +425,13 @@ void CDockWidget::setToggleViewActionMode(eToggleViewActionMode Mode)
424
425
}
425
426
426
427
428
+ // ============================================================================
429
+ void CDockWidget::setMinimumSizeHintMode (eMinimumSizeHintMode Mode)
430
+ {
431
+ d->MinimumSizeHintMode = Mode;
432
+ }
433
+
434
+
427
435
// ============================================================================
428
436
void CDockWidget::toggleView (bool Open)
429
437
{
@@ -753,7 +761,14 @@ void CDockWidget::setClosedState(bool Closed)
753
761
// ============================================================================
754
762
QSize CDockWidget::minimumSizeHint () const
755
763
{
756
- return QSize (60 , 40 );
764
+ if (d->MinimumSizeHintMode == CDockWidget::MinimumSizeHintFromDockWidget || !d->Widget )
765
+ {
766
+ return QSize (60 , 40 );
767
+ }
768
+ else
769
+ {
770
+ return d->Widget ->minimumSizeHint ();
771
+ }
757
772
}
758
773
759
774
Original file line number Diff line number Diff line change @@ -189,6 +189,23 @@ private slots:
189
189
ForceNoScrollArea
190
190
};
191
191
192
+
193
+ /* *
194
+ * The mode of the minimumSizeHint() that is returned by the DockWidget
195
+ * minimumSizeHint() function.
196
+ * To ensure, that a dock widget does not block resizing, the dock widget
197
+ * reimplements minimumSizeHint() function to return a very small minimum
198
+ * size hint. If you would like to adhere the minimumSizeHint() from the
199
+ * content widget, the set the minimumSizeHintMode() to
200
+ * MinimumSizeHintFromContent.
201
+ */
202
+ enum eMinimumSizeHintMode
203
+ {
204
+ MinimumSizeHintFromDockWidget,
205
+ MinimumSizeHintFromContent
206
+ };
207
+
208
+
192
209
/* *
193
210
* This mode configures the behavior of the toggle view action.
194
211
* If the mode if ActionModeToggle, then the toggle view action is
@@ -334,6 +351,13 @@ private slots:
334
351
*/
335
352
void setToggleViewActionMode (eToggleViewActionMode Mode);
336
353
354
+ /* *
355
+ * Configures the minimum size hint that is returned by the
356
+ * minimumSizeHint() function.
357
+ * \see eMinimumSizeHintMode for a detailed description
358
+ */
359
+ void setMinimumSizeHintMode (eMinimumSizeHintMode Mode);
360
+
337
361
/* *
338
362
* Sets the dock widget icon that is shown in tabs and in toggle view
339
363
* actions
You can’t perform that action at this time.
0 commit comments