Skip to content

Commit 979d76a

Browse files
Imporved user guide - added documentation for some undocumented flags.
1 parent 0a55bcd commit 979d76a

File tree

1 file changed

+99
-4
lines changed

1 file changed

+99
-4
lines changed

doc/user-guide.md

Lines changed: 99 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
- [`MiddleMouseButtonClosesTab`](#middlemousebuttonclosestab)
3030
- [`DisableTabTextEliding`](#disabletabtexteliding)
3131
- [`ShowTabTextOnlyForActiveTab`](#showtabtextonlyforactivetab)
32-
- [Auto-Hide Configuration Flags](#auto-hide-configuration-flags)
33-
- [Auto Hide Dock Widgets](#auto-hide-dock-widgets)
32+
- [`DoubleClickUndocksWidget`](#doubleclickundockswidget)
33+
- [Auto Hide Dock Widgets](#auto-hide-dock-widgets)
3434
- [Pinning Auto-Hide Widgets to a certain border](#pinning-auto-hide-widgets-to-a-certain-border)
3535
- [Show / Hide Auto-Hide Widgets via Mouse Over](#show--hide-auto-hide-widgets-via-mouse-over)
3636
- [Drag \& Drop to Auto-Hide](#drag--drop-to-auto-hide)
@@ -39,6 +39,7 @@
3939
- [Auto-Hide Drag to Float / Dock](#auto-hide-drag-to-float--dock)
4040
- [Auto-Hide Context Menu](#auto-hide-context-menu)
4141
- [Adding Auto Hide Widgets](#adding-auto-hide-widgets)
42+
- [Auto-Hide Configuration Flags](#auto-hide-configuration-flags)
4243
- [Setting Auto-Hide Flags](#setting-auto-hide-flags)
4344
- [`AutoHideFeatureEnabled`](#autohidefeatureenabled)
4445
- [`DockAreaHasAutoHideButton`](#dockareahasautohidebutton)
@@ -63,6 +64,8 @@
6364
- [Central Widget](#central-widget)
6465
- [Empty Dock Area](#empty-dock-area)
6566
- [Custom Close Handling](#custom-close-handling)
67+
- [Globally Lock Docking Features](#globally-lock-docking-features)
68+
- [Dock Widget Size / Minimum Size Handling](#dock-widget-size--minimum-size-handling)
6669
- [Styling](#styling)
6770
- [Disabling the Internal Style Sheet](#disabling-the-internal-style-sheet)
6871

@@ -496,9 +499,12 @@ for active tabs. Inactive tabs only show their icon:
496499
497500
![MShowTabTextOnlyForActiveTab true](cfg_flag_ShowTabTextOnlyForActiveTab_true.png)
498501
499-
## Auto-Hide Configuration Flags
502+
### `DoubleClickUndocksWidget`
503+
504+
If the flag is set (default), a double click on a tab undocks the dock widget.
505+
If you would like to disable undocking, just clear this flag.
500506
501-
### Auto Hide Dock Widgets
507+
## Auto Hide Dock Widgets
502508
503509
The Advanced Docking System supports "Auto-Hide" functionality for **all**
504510
dock containers. The "Auto Hide" feature allows to display more information
@@ -599,6 +605,8 @@ DockManager->addAutoHideDockWidget(SideBarLeft, TableDockWidget);
599605

600606
See `autohide` example or the demo application to learn how it works.
601607

608+
## Auto-Hide Configuration Flags
609+
602610
### Setting Auto-Hide Flags
603611

604612
The Advanced Docking System has a number of global configuration flags to
@@ -835,6 +843,93 @@ Normally clicking the close button of a dock widget will just hide the widget an
835843
836844
When an entire area is closed, the default behavior is to hide the dock widgets it contains regardless of the `DockWidgetDeleteOnClose` flag except if there is only one dock widget. In this special case, the `DockWidgetDeleteOnClose` flag is followed. This behavior can be changed by setting the `DockWidgetForceCloseWithArea` flag to all the dock widgets that needs to be closed with their area.
837845
846+
## Globally Lock Docking Features
847+
848+
It is possible to globally lock features of all dock widgets to "freeze" the
849+
current workspace layout. That means, you can now lock your workspace
850+
to avoid accidentally dragging a docked view. When locking was't possible,
851+
users had to manually dock it back to the desired place after each accidental
852+
undock.
853+
854+
You can use a combination of the following feature flags to define which features
855+
shall get locked:
856+
857+
- CDockWidget::DockWidgetClosable
858+
- CDockWidget::DockWidgetMovable
859+
- CDockWidget::DockWidgetFloatable
860+
- CDockWidget::DockWidgetPinable
861+
862+
To clear the locked features, you can use CDockWidget::NoDockWidgetFeatures
863+
The following code shows how to lock and unlock all dock widget features
864+
globally.
865+
866+
```c++
867+
DockManager->lockDockWidgetFeaturesGlobally();
868+
DockManager->lockDockWidgetFeaturesGlobally(CDockWidget::NoDockWidgetFeatures);
869+
```
870+
871+
## Dock Widget Size / Minimum Size Handling
872+
873+
There are several `CDockWidget` mode enums to control how a `CDockWidget` is
874+
resized and how the docking system handles the minimum size of a dockwidget.
875+
876+
The first one is the `eInsertMode` enum:
877+
878+
```c++
879+
enum eInsertMode
880+
{
881+
AutoScrollArea,
882+
ForceScrollArea,
883+
ForceNoScrollArea
884+
};
885+
```
886+
887+
The InsertMode defines how the widget is inserted into the dock widget, when you
888+
call the `CDockWidget::setWidget` method:
889+
890+
```c++
891+
DockWidget->setWidget(widget, CDockWidget::AutoScrollArea);
892+
```
893+
894+
The content of a dock widget should be resizable do a very small size to
895+
prevent the dock widget from blocking the resizing. To ensure, that a
896+
dock widget can be resized very well, it is better to insert the content
897+
widget into a scroll area or to provide a widget that is already a scroll
898+
area or that contains a scroll area (such as an `QAbstractItemView`)
899+
If the InsertMode is `AutoScrollArea`, the DockWidget tries to automatically
900+
detect how to insert the given widget. If the widget is derived from
901+
`QScrollArea` (i.e. an `QAbstractItemView`), then the widget is inserted
902+
directly. If the given widget is not a scroll area, the widget will be
903+
inserted into a scroll area.
904+
905+
To force insertion into a scroll area, you can also provide the InsertMode
906+
`ForceScrollArea`. In this case a scroll area will also be created for content
907+
widgets that are derived from `QScrollArea` To prevent insertion into a scroll
908+
area, you can provide the InsertMode `ForceNoScrollArea`. In this case, the
909+
content widget is always inserted directly.
910+
911+
A second enum, the `eMinimumSizeHintMode` defines, which value will be returned
912+
from the `CDockWidget::minimumSizeHint()` function:
913+
914+
```c++
915+
enum eMinimumSizeHintMode
916+
{
917+
MinimumSizeHintFromDockWidget,
918+
MinimumSizeHintFromContent,
919+
MinimumSizeHintFromDockWidgetMinimumSize,
920+
MinimumSizeHintFromContentMinimumSize,
921+
};
922+
```
923+
924+
To ensure, that a dock widget does not block resizing, the dock widget
925+
reimplements `minimumSizeHint()` function to return a very small minimum
926+
size hint. If you would like to adhere the `minimumSizeHint()` from the
927+
content widget, then set the `minimumSizeHintMode()` to
928+
`MinimumSizeHintFromContent`. If you would like to use the `minimumSize()`
929+
value of the content widget or the dock widget, then you can use the
930+
`MinimumSizeHintFromDockWidgetMinimumSize` or
931+
`MinimumSizeHintFromContentMinimumSize` modes.
932+
838933
## Styling
839934

840935
The Advanced Docking System supports styling via [Qt Style Sheets](https://doc.qt.io/qt-5/stylesheet.html). All components like splitters, tabs, buttons, titlebar and

0 commit comments

Comments
 (0)