QtCanpool 3.3.0
载入中...
搜索中...
未找到
dockmanager.h
浏览该文件的文档.
1
5#pragma once
6
7#include "qxdock_global.h"
8#include "dockiconprovider.h"
9
11
12class DockManagerPrivate;
13
20{
21public:
27 // If this flag is set, the active tab in a tab area has a close button
28 ActiveTabHasCloseButton = 0x0001,
29 // If the flag is set each dock area has a close button
30 DockAreaHasCloseButton = 0x0002,
31 // If the flag is set, the dock area close button closes the active tab,
32 // if not set, it closes the complete dock area
33 DockAreaCloseButtonClosesTab = 0x0004,
34 // See QSplitter::setOpaqueResize() documentation
35 OpaqueSplitterResize = 0x0008,
36 // If enabled, the XML writer automatically adds line-breaks and indentation to
37 // empty sections between elements (ignorable whitespace).
38 XmlAutoFormattingEnabled = 0x0010,
39 // If enabled, the XML output will be compressed and is not human readable anymore
40 XmlCompressionEnabled = 0x0020,
41 // If enabled the tab close buttons will be QToolButtons instead of QPushButtons - disabled by default
42 TabCloseButtonIsToolButton = 0x0040,
43 // if this flag is set, then all tabs that are closable show a close button
44 AllTabsHaveCloseButton = 0x0080,
45 // if this flag is set, the space for the close button is reserved even if the close button is not visible
46 RetainTabSizeWhenCloseButtonHidden = 0x0100,
47 // If opaque undocking is disabled, this flag defines the behavior of the drag preview window,
48 // if this flag is enabled, the preview will be adjusted dynamically to the drop area
49 DragPreviewIsDynamic = 0x0400,
50 // If opaque undocking is disabled, the created drag preview window shows a copy of the content
51 // of the dock widget / dock are that is dragged
52 DragPreviewShowsContentPixmap = 0x0800,
53 // If opaque undocking is disabled, then this flag configures if the drag preview is frameless or
54 // looks like a real window
55 DragPreviewHasWindowFrame = 0x1000,
56 // If this option is enabled, the tab of a dock widget is always displayed - even if
57 // it is the only visible dock widget in a floating widget.
58 AlwaysShowTabs = 0x2000,
59 // If the flag is set each dock area has an undock button
60 DockAreaHasUndockButton = 0x4000,
61 // If the flag is set each dock area has a tabs menu button
62 DockAreaHasTabsMenuButton = 0x8000,
63 // If the flag is set disabled dock area buttons will not appear on the toolbar
64 // at all (enabling them will bring them back)
65 DockAreaHideDisabledButtons = 0x10000,
66 // If the flag is set, the tabs menu button will be shown only when it is required - that means,
67 // if the tabs are elided. If the tabs are not elided, it is hidden
68 DockAreaDynamicTabsMenuButtonVisibility = 0x20000,
69 // If set, the Floating Widget window title reflects the title of the current dock widget
70 // otherwise it displays the title set with `DockManager::setFloatingContainersTitle` or
71 // application name as window title
72 FloatingContainerHasWidgetTitle = 0x40000,
73 // If set, the Floating Widget icon reflects the icon of the current dock widget
74 // otherwise it displays application icon
75 FloatingContainerHasWidgetIcon = 0x80000,
76 // If there is only one single visible dock widget in the main dock container (the dock manager)
77 // and if this flag is set, then the titlebar of this dock widget will be hidden
78 // this only makes sense for non draggable and non floatable widgets and
79 // enables the creation of some kind of "central" widget
80 HideSingleCentralWidgetTitleBar = 0x100000,
81
82 // enables styling of focused dock widget tabs or floating widget titlebar
83 FocusHighlighting = 0x200000,
84 // if enabled, the space is equally distributed to all widgets in a splitter
85 EqualSplitOnInsertion = 0x400000,
86
87 // Linux only ! Forces all FloatingContainer to use the native title bar.
88 // This might break docking for FloatinContainer on some Window Managers (like Kwin/KDE).
89 // If neither this nor FloatingContainerForceCustomTitleBar is set (the default) native titlebars
90 // are used except on known bad systems.
91 // Users can overwrite this by setting the environment variable ADS_UseNativeTitle to "1" or "0".
92 FloatingContainerForceNativeTitleBar = 0x800000,
93 // Linux only ! Forces all FloatingContainer to use a QWidget based title bar.
94 // If neither this nor FloatingContainerForceNativeTitleBar is set (the default) native titlebars
95 // are used except on known bad systems.
96 // Users can overwrite this by setting the environment variable ADS_UseNativeTitle to "1" or "0".
97 FloatingContainerForceQWidgetTitleBar = 0x1000000,
98
99 // If the flag is set, the user can use the mouse middle button to close the tab under the mouse
100 MiddleMouseButtonClosesTab = 0x2000000,
101 // Set this flag to disable eliding of tab texts in dock area tabs
102 DisableTabTextEliding = 0x4000000,
103 // Set this flag to show label texts in dock area tabs only for active tabs
104 ShowTabTextOnlyForActiveTab = 0x8000000,
105
106 // default configuration of dock area title bar buttons
107 DefaultDockAreaButtons = DockAreaHasCloseButton | DockAreaHasUndockButton | DockAreaHasTabsMenuButton,
108
109 // default base configuration settings
110 DefaultBaseConfig =
111 DefaultDockAreaButtons | ActiveTabHasCloseButton | XmlCompressionEnabled | FloatingContainerHasWidgetTitle,
112
113 // the default configuration for opaque operations
114 DefaultOpaqueConfig = DefaultBaseConfig | OpaqueSplitterResize | DragPreviewShowsContentPixmap,
115
116 // the default configuration for non opaque operations
117 DefaultNonOpaqueConfig = DefaultBaseConfig | DragPreviewShowsContentPixmap,
118 // the default configuration for non opaque operations that show a real window with frame
119 NonOpaqueWithWindowFrame = DefaultNonOpaqueConfig | DragPreviewHasWindowFrame
120 };
121 Q_DECLARE_FLAGS(ConfigFlags, ConfigFlag)
122
123
128 // enables / disables auto hide feature
129 AutoHideFeatureEnabled = 0x01,
130 // If the flag is set each dock area has a auto hide menu button
131 DockAreaHasAutoHideButton = 0x02,
132 // If the flag is set, the auto hide button enables auto hiding for all dock widgets in an area,
133 // if disabled, only the current dock widget will be toggled
134 AutoHideButtonTogglesArea = 0x04,
135 // If the flag is set, the auto hide button will be checked and unchecked depending on the auto hide state.
136 // Mainly for styling purposes.
137 AutoHideButtonCheckable = 0x08,
138 // show only icons in auto hide side tab - if a tab has no icon, then the text will be shown
139 AutoHideSideBarsIconOnly = 0x10,
140 // show the auto hide window on mouse over tab and hide it if mouse leaves auto hide container
141 AutoHideShowOnMouseOver = 0x20,
142 // Close button of an auto hide container collapses the dock instead of hiding it completely
143 AutoHideCloseButtonCollapsesDock = 0x40,
144 // If the flag is set an auto hide title bar has a close button
145 AutoHideHasCloseButton = 0x80,
146 // if this flag is set, the auto hide title bar has a minimize button to collapse the dock widget
147 AutoHideHasMinimizeButton = 0x100,
148
149 DefaultAutoHideConfig = AutoHideFeatureEnabled | DockAreaHasAutoHideButton | AutoHideHasMinimizeButton
150 };
151 Q_DECLARE_FLAGS(AutoHideFlags, AutoHideFlag)
152public:
153 DockManager();
154 ~DockManager();
155
156 static ConfigFlags configFlags();
157 static void setConfigFlags(const ConfigFlags flags);
158 static void setConfigFlag(ConfigFlag flag, bool on = true);
159 static bool testConfigFlag(ConfigFlag flag);
160
161 static AutoHideFlags autoHideConfigFlags();
162 static void setAutoHideConfigFlags(const AutoHideFlags flags);
163 static void setAutoHideConfigFlag(AutoHideFlag flag, bool on = true);
164 static bool testAutoHideConfigFlag(AutoHideFlag flag);
165
166 static DockIconProvider &iconProvider();
167
168 static int startDragDistance();
169
170 // Helper function to set focus depending on the configuration of the FocusHighlighting flag
171 template <class QWidgetPtr> static void setWidgetFocus(QWidgetPtr widget)
172 {
173 if (!DockManager::testConfigFlag(DockManager::FocusHighlighting)) {
174 return;
175 }
176 widget->setFocus(Qt::OtherFocusReason);
177 }
178
179 static QString floatingContainersTitle();
180 static void setFloatingContainersTitle(const QString &title);
181private:
183};
184
The dock manager that maintains the complete docking system.
Definition dockmanager.h:20
ConfigFlag
These global configuration flags configure some global dock manager settings.
Definition dockmanager.h:26
static void setWidgetFocus(QWidgetPtr widget)
AutoHideFlag
These global configuration flags configure some dock manager auto hide settings Set the dock manager ...
#define QX_DECLARE_PRIVATE(Class)
#define QX_DOCK_END_NAMESPACE
#define QX_DOCK_BEGIN_NAMESPACE
#define QX_DOCK_EXPORT