KDDockWidgets API Documentation 2.0
|
Singleton to allow to choose certain behaviours of the framework. More...
#include <Config.h>
Public Member Functions | |
~Config () | |
destructor, called at shutdown | |
Size | absoluteWidgetMaxSize () const |
Size | absoluteWidgetMinSize () const |
Config::CustomizableWidgets | disabledPaintEvents () const |
DockWidgetFactoryFunc | dockWidgetFactoryFunc () const |
Returns the DockWidgetFactoryFunc. nullptr by default. | |
DragAboutToStartFunc | dragAboutToStartFunc () const |
DragEndedFunc | dragEndedFunc () const |
double | draggedWindowOpacity () const |
returns the opacity to use when dragging dock widgets By default it's 1.0, fully opaque | |
DropIndicatorAllowedFunc | dropIndicatorAllowedFunc () const |
Used internally by the framework. Returns the function which was passed to setDropIndicatorAllowedFunc() By default it's nullptr. | |
bool | dropIndicatorsInhibited () const |
Returns whether drop indicators are inhibited. by default this is false unless you call setDropIndicatorsInhibited(true) | |
Flags | flags () const |
returns the chosen flags | |
InternalFlags | internalFlags () const |
bool | layoutSaverUsesStrictMode () const |
MainWindowFactoryFunc | mainWindowFactoryFunc () const |
Returns the MainWindowFactoryFunc. nullptr by default. | |
int | mdiPopupThreshold () const |
bool | onlyProgrammaticDrag () const |
void | printDebug () |
Prints some debug information. | |
int | separatorThickness () const |
Returns the thickness of the separator. | |
void | setAbsoluteWidgetMaxSize (Size size) |
Sets the maximum size a dock widget can have. Widgets can still provide their own max-size and it will be respected, however it can never be bigger than this one. | |
void | setAbsoluteWidgetMinSize (Size size) |
Sets the minimum size a dock widget can have. Widgets can still provide their own min-size and it will be respected, however it can never be smaller than this one. | |
void | setDisabledPaintEvents (CustomizableWidgets) |
Disables our internal widget's paint events By default, KDDockWidget's internal widgets reimplement paintEvent(). Disabling them (which makes the base-class, QWidget::paintEvent() be called instead) can be useful if you want to style. | |
void | setDockWidgetFactoryFunc (DockWidgetFactoryFunc) |
Registers a DockWidgetFactoryFunc. | |
void | setDragAboutToStartFunc (DragAboutToStartFunc func) |
set a callback to be called once a drag starts | |
void | setDragEndedFunc (DragEndedFunc func) |
set a callback to be called once drag ends | |
void | setDraggedWindowOpacity (double opacity) |
sets the dragged window opacity 1.0 is fully opaque while 0.0 is fully transparent | |
void | setDropIndicatorAllowedFunc (DropIndicatorAllowedFunc func) |
Allows the client app to disallow certain docking indicators. | |
void | setDropIndicatorsInhibited (bool inhibit) const |
Allows to disable support for drop indicators while dragging By default drop indicators will be shown when dragging dock widgets. This functionality can be toggled whenever you need it (it's not a startup-only setting). | |
void | setFlags (Flags flags) |
setter for the flags | |
void | setInternalFlags (InternalFlags flags) |
void | setLayoutSaverStrictMode (bool) |
void | setMainWindowFactoryFunc (MainWindowFactoryFunc) |
counter-part of DockWidgetFactoryFunc but for the main window. Should be rarely used. It's good practice to have the main window before restoring a layout. It's here so we can use it in the linter executable | |
void | setMDIPopupThreshold (int) |
Sets the MDI popup threshold. When the layout is MDI and you drag a dock widget X pixels behond the window's edge, it will float the dock widget. by default this value is 250px. Use -1 to disable. | |
void | setOnlyProgrammaticDrag (bool) |
void | setSeparatorThickness (int value) |
setter for separatorThickness Note: Only use this function at startup before creating any DockWidget or MainWindow. | |
void | setStartDragDistance (int) |
Sets how many pixels the mouse needs to travel before a drag is actually started Calling this is usually unneeded and just provided as a means to override Platform::startDragDistance() , which already has a reasonable default 4 pixels. | |
void | setTransparencyOnlyOverDropIndicator (bool only) |
Sets whether transparency is only set when the dragged window is over a drop indicator This is only relevant when using setDraggedWindowOpacity() Default is false. | |
void | setViewFactory (Core::ViewFactory *) |
Sets the ViewFactory. | |
int | startDragDistance () const |
Returns the value set by setStartDragDistance() Returns -1 if setStartDragDistance() wasn't call, in which case the Platform::startDragDistance() will be used. | |
bool | transparencyOnlyOverDropIndicator () const |
Returns whether transparency is only set when the dragged window is over a drop indicator This is only relevant when using setDraggedWindowOpacity() Default is false. | |
Core::ViewFactory * | viewFactory () const |
getter for the framework view factory | |
Static Public Member Functions | |
static bool | hasFlag (Flag) |
Returns whether the specified flag is set or not. | |
static Config & | self () |
returns the singleton Config instance | |
Singleton to allow to choose certain behaviours of the framework.
The setters should only be used before creating any DockWidget or MainWindow, preferably right after creating the QApplication.
List of customizable widgets.
Flag enum to tune certain behaviours, the defaults are Flag_Default.
Enumerator | |
---|---|
InternalFlag_None | The default. |
InternalFlag_NoAeroSnap | Only for development. Disables Aero-snap. |
InternalFlag_DontUseParentForFloatingWindows | FloatingWindows won't have a parent top-level. |
InternalFlag_DontUseQtToolWindowsForFloatingWindows | FloatingWindows will use Qt::Window instead of Qt::Tool. |
InternalFlag_DontShowWhenUnfloatingHiddenWindow | DockWidget::setFloating(false) won't do anything if the window is hidden. |
InternalFlag_UseTransparentFloatingWindow | For QtQuick only. Allows to have round-corners. It's flaky when used with native Windows drop-shadow. |
InternalFlag_DisableTranslucency | KDDW tries to detect if your Window Manager doesn't support transparent windows, but the detection might fail |
InternalFlag_TopLevelIndicatorRubberBand | with more exotic setups. This flag can be used to override. Makes the rubber band of classic drop indicators to be top-level windows. Helps with working around MFC bugs |
KDDockWidgets::Config::~Config | ( | ) |
destructor, called at shutdown
Definition at line 93 of file Config.cpp.
Size KDDockWidgets::Config::absoluteWidgetMaxSize | ( | ) | const |
Definition at line 265 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__absoluteWidgetMaxSize().
Size KDDockWidgets::Config::absoluteWidgetMinSize | ( | ) | const |
Definition at line 249 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__absoluteWidgetMinSize().
Config::CustomizableWidgets KDDockWidgets::Config::disabledPaintEvents | ( | ) | const |
Definition at line 339 of file Config.cpp.
DockWidgetFactoryFunc KDDockWidgets::Config::dockWidgetFactoryFunc | ( | ) | const |
Returns the DockWidgetFactoryFunc. nullptr by default.
Definition at line 140 of file Config.cpp.
DragAboutToStartFunc KDDockWidgets::Config::dragAboutToStartFunc | ( | ) | const |
Definition at line 223 of file Config.cpp.
DragEndedFunc KDDockWidgets::Config::dragEndedFunc | ( | ) | const |
Definition at line 233 of file Config.cpp.
double KDDockWidgets::Config::draggedWindowOpacity | ( | ) | const |
returns the opacity to use when dragging dock widgets By default it's 1.0, fully opaque
Definition at line 198 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__draggedWindowOpacity().
DropIndicatorAllowedFunc KDDockWidgets::Config::dropIndicatorAllowedFunc | ( | ) | const |
Used internally by the framework. Returns the function which was passed to setDropIndicatorAllowedFunc() By default it's nullptr.
Definition at line 213 of file Config.cpp.
bool KDDockWidgets::Config::dropIndicatorsInhibited | ( | ) | const |
Returns whether drop indicators are inhibited. by default this is false unless you call setDropIndicatorsInhibited(true)
Definition at line 362 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__dropIndicatorsInhibited().
Config::Flags KDDockWidgets::Config::flags | ( | ) | const |
returns the chosen flags
Definition at line 98 of file Config.cpp.
Referenced by KDDockWidgets::QtWidgets::FloatingWindow::event(), KDDockWidgets::Core::TabBar::makeWindow(), KDDockWidgets::Core::TitleBar::onCloseClicked(), KDDockWidgets::Core::TabBar::tabsAreMovable(), and KDDockWidgets::Core::TitleBar::titleBarIsFocusable().
|
static |
Returns whether the specified flag is set or not.
static
Definition at line 130 of file Config.cpp.
Referenced by KDDockWidgets::Core::TitleBar::onAutoHideClicked().
Config::InternalFlags KDDockWidgets::Config::internalFlags | ( | ) | const |
Definition at line 270 of file Config.cpp.
bool KDDockWidgets::Config::layoutSaverUsesStrictMode | ( | ) | const |
Definition at line 387 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__layoutSaverUsesStrictMode().
MainWindowFactoryFunc KDDockWidgets::Config::mainWindowFactoryFunc | ( | ) | const |
Returns the MainWindowFactoryFunc. nullptr by default.
Definition at line 150 of file Config.cpp.
Referenced by KDDockWidgets::LayoutSaver::restoreLayout().
int KDDockWidgets::Config::mdiPopupThreshold | ( | ) | const |
Definition at line 349 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__mdiPopupThreshold().
bool KDDockWidgets::Config::onlyProgrammaticDrag | ( | ) | const |
Definition at line 397 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__onlyProgrammaticDrag().
void KDDockWidgets::Config::printDebug | ( | ) |
Prints some debug information.
Definition at line 377 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__printDebug(), and KDDockWidgetsBindings_wrappersNS::Config_wrapper::printDebug().
|
static |
returns the singleton Config instance
Definition at line 87 of file Config.cpp.
Referenced by KDDockWidgets::QtWidgets::IndicatorWindow::IndicatorWindow(), KDDockWidgets::Core::SegmentedDropIndicatorOverlay::SegmentedDropIndicatorOverlay(), KDDockWidgets::Core::Separator::Separator(), KDDockWidgets::actualOptions(), actualParent(), KDDockWidgets::QtWidgets::MDIArea::addDockWidget(), createIndicatorWindow(), KDDockWidgets::DockRegistry::dockByName(), KDDockWidgets::QtWidgets::Group::dragRect(), KDDockWidgets::Core::DropIndicatorOverlay::dropIndicatorVisible(), KDDockWidgets::QtQuick::TitleBar::event(), KDDockWidgets::QtWidgets::FloatingWindow::event(), flagsForFloatingWindow(), KDDockWidgets::Core::TitleBar::focus(), hackFindParentHarder(), KDDockWidgets::Core::DropArea::hover(), KDDockWidgets::QtWidgets::Stack::init(), KDDockWidgets::QtWidgets::TitleBar::init(), lint(), main(), KDDockWidgets::Core::TabBar::makeWindow(), KDDockWidgets::Core::TitleBar::makeWindow(), KDDockWidgets::QtWidgets::Stack::mousePressEvent(), KDDockWidgets::Core::TitleBar::onCloseClicked(), KDDockWidgets::Core::TitleBar::onDoubleClicked(), KDDockWidgets::Core::Stack::onMouseDoubleClick(), KDDockWidgets::Core::TabBar::onMousePress(), KDDockWidgets::QtWidgets::FloatingWindow::paintEvent(), KDDockWidgets::QtWidgets::Separator::paintEvent(), KDDockWidgets::LayoutSaver::restoreLayout(), KDDockWidgets::QtQuick::ViewFactory::self(), KDDockWidgets::Core::DockWidget::setFloating(), KDDockWidgets::QtQuick::Platform::setQmlEngine(), KDDockWidgets::QtWidgets::Stack::showContextMenu(), KDDockWidgets::Core::Platform::startDragDistance(), KDDockWidgets::Core::TitleBar::supportsFloatingButton(), KDDockWidgets::Core::TabBar::tabsAreMovable(), KDDockWidgets::Core::TitleBar::titleBarIsFocusable(), KDDockWidgets::QtWidgets::TitleBar::updateAutoHideButton(), KDDockWidgets::QtWidgets::TitleBar::updateMaximizeButton(), KDDockWidgets::Core::Group::updateTitleBarVisibility(), KDDockWidgets::QtQuick::Platform::viewFactory(), windowFlagsToUse(), and KDDockWidgets::windowManagerHasTranslucency().
int KDDockWidgets::Config::separatorThickness | ( | ) | const |
Returns the thickness of the separator.
Default is 5px.
Definition at line 167 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__separatorThickness().
void KDDockWidgets::Config::setAbsoluteWidgetMaxSize | ( | Size | size | ) |
Sets the maximum size a dock widget can have. Widgets can still provide their own max-size and it will be respected, however it can never be bigger than this one.
Definition at line 254 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__setAbsoluteWidgetMaxSize_Size(), and KDDockWidgetsBindings_wrappersNS::Config_wrapper::setAbsoluteWidgetMaxSize().
void KDDockWidgets::Config::setAbsoluteWidgetMinSize | ( | Size | size | ) |
Sets the minimum size a dock widget can have. Widgets can still provide their own min-size and it will be respected, however it can never be smaller than this one.
Definition at line 238 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__setAbsoluteWidgetMinSize_Size(), and KDDockWidgetsBindings_wrappersNS::Config_wrapper::setAbsoluteWidgetMinSize().
void KDDockWidgets::Config::setDisabledPaintEvents | ( | CustomizableWidgets | widgets | ) |
Disables our internal widget's paint events By default, KDDockWidget's internal widgets reimplement paintEvent(). Disabling them (which makes the base-class, QWidget::paintEvent() be called instead) can be useful if you want to style.
Definition at line 334 of file Config.cpp.
void KDDockWidgets::Config::setDockWidgetFactoryFunc | ( | DockWidgetFactoryFunc | func | ) |
Registers a DockWidgetFactoryFunc.
This is optional, the default is nullptr.
A DockWidgetFactoryFunc is a function that receives a dock widget name and returns a DockWidget instance.
While restoring, LayoutSaver requires all dock widgets to exist. If a DockWidget doesn't exist then a DockWidgetFactoryFunc function is required, so the layout saver can ask to create the DockWidget and then restore it.
Definition at line 135 of file Config.cpp.
Referenced by lint().
void KDDockWidgets::Config::setDragAboutToStartFunc | ( | DragAboutToStartFunc | func | ) |
set a callback to be called once a drag starts
This function is for advanced usage only. Allows more granularity for inhibiting DnD.
Return true/false whether you allow the drag or not.
draggable | The thing about to be dragged. Can be a tab, a group of tabs, a floating window or the tabbar's background. |
Definition at line 218 of file Config.cpp.
void KDDockWidgets::Config::setDragEndedFunc | ( | DragEndedFunc | func | ) |
set a callback to be called once drag ends
Definition at line 228 of file Config.cpp.
void KDDockWidgets::Config::setDraggedWindowOpacity | ( | double | opacity | ) |
sets the dragged window opacity 1.0 is fully opaque while 0.0 is fully transparent
Definition at line 188 of file Config.cpp.
Referenced by KDDockWidgets::Core::SegmentedDropIndicatorOverlay::SegmentedDropIndicatorOverlay(), c_KDDockWidgets__Config__setDraggedWindowOpacity_double(), and KDDockWidgetsBindings_wrappersNS::Config_wrapper::setDraggedWindowOpacity().
void KDDockWidgets::Config::setDropIndicatorAllowedFunc | ( | DropIndicatorAllowedFunc | func | ) |
Allows the client app to disallow certain docking indicators.
For example, let's assume the app doesn't want to show outer indicators for a certain dock widget.
Run "examples/qtwidgets_dockwidgets --hide-certain-docking-indicators" to see this in action.
Definition at line 208 of file Config.cpp.
void KDDockWidgets::Config::setDropIndicatorsInhibited | ( | bool | inhibit | ) | const |
Allows to disable support for drop indicators while dragging By default drop indicators will be shown when dragging dock widgets. This functionality can be toggled whenever you need it (it's not a startup-only setting).
Definition at line 354 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__setDropIndicatorsInhibited_bool(), and KDDockWidgetsBindings_wrappersNS::Config_wrapper::setDropIndicatorsInhibited().
void KDDockWidgets::Config::setFlags | ( | Flags | flags | ) |
setter for the flags
flags | the flags to set Not all flags are guaranteed to be set, as the OS might not supported them Call flags() after the setter if you need to know what was really set |
Definition at line 103 of file Config.cpp.
void KDDockWidgets::Config::setInternalFlags | ( | InternalFlags | flags | ) |
Definition at line 275 of file Config.cpp.
void KDDockWidgets::Config::setLayoutSaverStrictMode | ( | bool | is | ) |
Mostly used by the linter so it errors out when finding invalid layouts. For production, this should be false, as sometimes there's fallbacks and the layout is recoverable. Default is false.
Definition at line 382 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__setLayoutSaverStrictMode_bool(), main(), and KDDockWidgetsBindings_wrappersNS::Config_wrapper::setLayoutSaverStrictMode().
void KDDockWidgets::Config::setMainWindowFactoryFunc | ( | MainWindowFactoryFunc | func | ) |
counter-part of DockWidgetFactoryFunc but for the main window. Should be rarely used. It's good practice to have the main window before restoring a layout. It's here so we can use it in the linter executable
Definition at line 145 of file Config.cpp.
Referenced by lint().
void KDDockWidgets::Config::setMDIPopupThreshold | ( | int | threshold | ) |
Sets the MDI popup threshold. When the layout is MDI and you drag a dock widget X pixels behond the window's edge, it will float the dock widget. by default this value is 250px. Use -1 to disable.
Definition at line 344 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__setMDIPopupThreshold_int(), and KDDockWidgetsBindings_wrappersNS::Config_wrapper::setMDIPopupThreshold().
void KDDockWidgets::Config::setOnlyProgrammaticDrag | ( | bool | only | ) |
For disallowing DnD to be started by mouse and instead require doing programmatically Default is false, DnD can be started by mouse, which is the most common use case.
Definition at line 392 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__setOnlyProgrammaticDrag_bool(), and KDDockWidgetsBindings_wrappersNS::Config_wrapper::setOnlyProgrammaticDrag().
void KDDockWidgets::Config::setSeparatorThickness | ( | int | value | ) |
setter for separatorThickness Note: Only use this function at startup before creating any DockWidget or MainWindow.
Definition at line 172 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__setSeparatorThickness_int(), and KDDockWidgetsBindings_wrappersNS::Config_wrapper::setSeparatorThickness().
void KDDockWidgets::Config::setStartDragDistance | ( | int | pixels | ) |
Sets how many pixels the mouse needs to travel before a drag is actually started Calling this is usually unneeded and just provided as a means to override Platform::startDragDistance() , which already has a reasonable default 4 pixels.
Definition at line 367 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__setStartDragDistance_int(), and KDDockWidgetsBindings_wrappersNS::Config_wrapper::setStartDragDistance().
void KDDockWidgets::Config::setTransparencyOnlyOverDropIndicator | ( | bool | only | ) |
Sets whether transparency is only set when the dragged window is over a drop indicator This is only relevant when using setDraggedWindowOpacity() Default is false.
Definition at line 193 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__setTransparencyOnlyOverDropIndicator_bool(), and KDDockWidgetsBindings_wrappersNS::Config_wrapper::setTransparencyOnlyOverDropIndicator().
void KDDockWidgets::Config::setViewFactory | ( | Core::ViewFactory * | wf | ) |
Sets the ViewFactory.
To draw things on screen, KDDW uses QtWidgets::{Group, TitleBar, TabBar, Separator, DockWidget, etc} (same for QtQuick::*) You can set your own factory and provide classes derived from the above list to override visual behaviour.
Ownership is taken.
Definition at line 155 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__setViewFactory_ViewFactory(), and KDDockWidgetsBindings_wrappersNS::Config_wrapper::setViewFactory().
int KDDockWidgets::Config::startDragDistance | ( | ) | const |
Returns the value set by setStartDragDistance() Returns -1 if setStartDragDistance() wasn't call, in which case the Platform::startDragDistance() will be used.
Definition at line 372 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__startDragDistance(), and KDDockWidgets::Core::Platform::startDragDistance().
bool KDDockWidgets::Config::transparencyOnlyOverDropIndicator | ( | ) | const |
Returns whether transparency is only set when the dragged window is over a drop indicator This is only relevant when using setDraggedWindowOpacity() Default is false.
Definition at line 203 of file Config.cpp.
Referenced by c_KDDockWidgets__Config__transparencyOnlyOverDropIndicator().
ViewFactory * KDDockWidgets::Config::viewFactory | ( | ) | const |
getter for the framework view factory
Definition at line 162 of file Config.cpp.
Referenced by KDDockWidgets::Core::Separator::Separator(), KDDockWidgets::QtWidgets::MDIArea::addDockWidget(), c_KDDockWidgets__Config__viewFactory(), createIndicatorWindow(), KDDockWidgets::QtWidgets::TitleBar::init(), lint(), KDDockWidgets::QtQuick::ViewFactory::self(), KDDockWidgets::QtWidgets::TitleBar::updateAutoHideButton(), KDDockWidgets::QtWidgets::TitleBar::updateMaximizeButton(), and KDDockWidgets::QtQuick::Platform::viewFactory().