KDDockWidgets API Documentation  1.0.1
Public Types | Public Member Functions | Static Public Member Functions | List of all members
KDDockWidgets::Config Class Reference

Singleton to allow to choose certain behaviours of the framework. More...

#include <Config.h>

Public Types

enum  Flag {
  Flag_None = 0, Flag_NativeTitleBar = 1, Flag_AeroSnapWithClientDecos = 2, Flag_HideTitleBarWhenTabsVisible = 8,
  Flag_AlwaysShowTabs = 16, Flag_AllowReorderTabs = 32, Flag_TabsHaveCloseButton = 64, Flag_DoubleClickMaximizes = 128,
  Flag_TitleBarHasMaximizeButton = 256, Flag_LazyResize = 1024, Flag_Default = Flag_AeroSnapWithClientDecos
}
 Flag enum to tune certain behaviours, the defaults are Flag_Default. More...
 

Public Member Functions

 ~Config ()
 destructor, called at shutdown
 
DockWidgetFactoryFunc dockWidgetFactoryFunc () const
 Returns the DockWidgetFactoryFunc. nullptr by default.
 
Flags flags () const
 returns the chosen flags
 
FrameworkWidgetFactoryframeworkWidgetFactory () const
 getter for the framework widget factory
 
MainWindowFactoryFunc mainWindowFactoryFunc () const
 Returns the MainWindowFactoryFunc. nullptr by default.
 
QQmlEngine * qmlEngine () const
 
int separatorThickness () const
 Returns the thickness of the separator. More...
 
void setDockWidgetFactoryFunc (DockWidgetFactoryFunc)
 Registers a DockWidgetFactoryFunc. More...
 
void setFlags (Flags flags)
 setter for the flags More...
 
void setFrameworkWidgetFactory (FrameworkWidgetFactory *)
 Sets the WidgetFactory. More...
 
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 setQmlEngine (QQmlEngine *)
 Sets the QQmlEngine to use. Applicable only when using QtQuick.
 
void setSeparatorThickness (int value)
 setter for separatorThickness Note: Only use this function at startup before creating any DockWidget or MainWindow.
 

Static Public Member Functions

static Configself ()
 returns the singleton Config instance
 

Detailed Description

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.

Member Enumeration Documentation

Flag enum to tune certain behaviours, the defaults are Flag_Default.

Enumerator
Flag_NativeTitleBar 

No option set

Flag_AeroSnapWithClientDecos 

Enables the Native OS title bar on OSes that support it (Windows 10, macOS), ignored otherwise. This is mutually exclusive with Flag_AeroSnap

Flag_HideTitleBarWhenTabsVisible 

Enables AeroSnap even if we're not using the native title bar. Only supported on Windows 10.

Flag_AlwaysShowTabs 

Hides the title bar if there's tabs visible. The empty space in the tab bar becomes draggable.

Flag_AllowReorderTabs 

Always show tabs, even if there's only one,

Flag_TabsHaveCloseButton 

Allows user to re-order tabs by dragging them.

Flag_DoubleClickMaximizes 

Tabs will have a close button. Equivalent to QTabWidget::setTabsClosable(true).

Flag_TitleBarHasMaximizeButton 

Double clicking the titlebar will maximize a floating window instead of re-docking it.

Flag_LazyResize 

The title bar will have a maximize/restore button when floating. This is mutually-exclusive with the floating button (since many apps behave that way).

Flag_Default 

The dock widgets are resized in a lazy manner. The actual resize only happens when you release the mouse button.

Member Function Documentation

int KDDockWidgets::Config::separatorThickness ( ) const

Returns the thickness of the separator.

Default is 5px.

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.

void KDDockWidgets::Config::setFlags ( Flags  flags)

setter for the flags

Parameters
flagsthe 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
void KDDockWidgets::Config::setFrameworkWidgetFactory ( FrameworkWidgetFactory wf)

Sets the WidgetFactory.

By default DefaultWidgetFactory is used, which gives you FrameWidget, TitleBarWidget, TabBarWidget, TabWidgetWidget etc. You can set your own factory, to supply your own variants of those classes, for the purposes of changing GUI appearance and such.

Also potentially useful to return QtQuick classes instead of the QtWidget based ones. Ownership is taken.


Klarälvdalens Datakonsult AB (KDAB)
"The Qt Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/