KDDockWidgets API Documentation 2.0
|
The DockWidget base-class. DockWidget and Core::DockWidget are only split in two so we can share some code with the QtQuick implementation, which also derives from Core::DockWidget. More...
#include <DockWidget.h>
Public Types | |
typedef Vector< DockWidget * > | List |
Public Member Functions | |
DockWidget (View *view, const QString &uniqueName, DockWidgetOptions options={}, LayoutSaverOptions layoutSaverOptions={}) | |
constructs a new DockWidget | |
~DockWidget () override | |
destructor | |
void | addDockWidgetAsTab (KDDockWidgets::Core::DockWidget *other, KDDockWidgets::InitialOption initialOption={}) |
docks other widget into this one. Tabs will be shown if not already. | |
void | addDockWidgetToContainingWindow (KDDockWidgets::Core::DockWidget *other, KDDockWidgets::Location location, KDDockWidgets::Core::DockWidget *relativeTo=nullptr, KDDockWidgets::InitialOption initialOption={}) |
docks other widget into the window that contains this one. Equivalent to MainWindow::addDockWidget() with the difference that it also supports the case where the top-level window is a FloatingWindow instead of MainWindow. | |
Vector< QString > | affinities () const |
Returns the affinity name. Empty by default. | |
int | currentTabIndex () const |
Returns the index of the current tab of the tab group this dock widget is in. | |
Private * | dptr () const |
Action * | floatAction () const |
Returns the Action that allows to dock/undock the dock widget Useful to put in menus. | |
FloatingWindow * | floatingWindow () const |
returns the FloatingWindow this widget is in, otherwise nullptr | |
KDDockWidgets::FloatingWindowFlags | floatingWindowFlags () const |
void | forceClose () |
Like QWidget::close() but the hosted widget won't be asked if we should close. | |
Rect | groupGeometry () const |
Returns the size of the dock widget's parent group. | |
std::shared_ptr< View > | guestView () const |
Like widget() but returns a view. | |
bool | hasPreviousDockedLocation () const |
Returns whether this floating dock widget knows its previous docked location Result only makes sense if it's floating. | |
Icon | icon (IconPlace place=IconPlace::TitleBar) const |
Returns the dock widget's titlebar, tabbar, or toggle action icon (depending on the passed place ) | |
void | init () |
bool | isCurrentTab () const |
Returns true if this dock widget is the current one in the tab widget that contains it. If the dock widget is alone then true is returned, as in this case there will also be a tab widget even though it's invisible. | |
bool | isFloating () const |
Returns whether the dock widget is floating. Floating means it's not docked and has a window of its own. Note that if you dock a floating dock widget into another floating one then they don't count as floating anymore, as they are side-by-side (or tabbed). | |
bool | isFocused () const |
Returns whether This or any child of this dock widget is focused Not to be confused with QWidget::hasFocus(), which just refers to 1 widget. This includes variant includes children. | |
bool | isInMainWindow () const |
Returns whether this dock widget is docked into a main window (as opposed to floating) | |
bool | isInSideBar () const |
Returns where this dockwidget is in a sidebar Similar to sideBarLocation(), but returns a bool. | |
bool | isMainWindow () const |
Returns whether widget() is a KDDockWidget::MainWindow. | |
bool | isOpen () const |
Returns whether this dock widget is open. Equivalent to calling toggleAction().isChecked() | |
bool | isOverlayed () const |
Returns whether this dock widget is overlayed from the side-bar. | |
bool | isPersistentCentralDockWidget () const |
Returns whether this dock widget is the main window persistent central widget This only applies when using MainWindowOption_HasCentralWidget. | |
bool | isTabbed () const |
returns if this dock widget is tabbed into another | |
Size | lastOverlayedSize () const |
returns the last size the widget has when overlayed Empty otherwise | |
KDDockWidgets::LayoutSaverOptions | layoutSaverOptions () const |
returns the per-dockwidget options which will affect LayoutSaver These are the options which were passed to the constructor | |
MainWindow * | mainWindow () const |
Returns the main window this dock widget is in. nullptr if it's not inside a main window Also returns nullptr if it's minimized to a sidebar. | |
void | moveToSideBar () |
Minimizes this dock widget to the MainWindow's side-bar. | |
void | onResize (Size newSize) |
void | open () |
Opens this dock widget. Does nothing if already open. The dock widget will appear floating unless it knows about its previous layout position, in which case it will appear docked (or tabbed) into the main window. | |
DockWidgetOptions | options () const |
Returns the dock widget's options which control behaviour. | |
void | raise () |
Brings the dock widget to the front. | |
void | resizeInLayout (int left, int top, int right, int bottom) |
void | setAffinities (const Vector< QString > &) |
Sets the affinity names. Dock widgets can only dock into dock widgets of the same affinity. | |
void | setAffinityName (const QString &name) |
void | setAsCurrentTab () |
Makes this dock widget current in its tab group. | |
bool | setFloating (bool floats) |
setter to make the dock widget float or dock. | |
void | setFloatingGeometry (Rect geo) |
If this dock widget is floating, then sets its geometry to geo . | |
void | setFloatingWindowFlags (FloatingWindowFlags) |
Sets the desired floating window flags, in case the defaults aren't desired. By default KDDW will use the flags specified in KDDockWidgets::Config to influence many aspects regarding windows (minimize,maximize support for example). You can use this function to override those "global flags" and specify per-dock widget flags. Be sure to not call this before the floating window has already been created. It's suggested to call it before the dock widget is shown. | |
void | setGuestView (std::shared_ptr< View > guest) |
sets the widget which this dock widget hosts. | |
void | setIcon (const Icon &icon, IconPlaces places=IconPlace::All) |
Sets an icon to show on title bars and tab bars. | |
void | setMDIPosition (Point pos) |
Sets this dock widgets position to pos within the MDI layout This only applies if the main window is in MDI mode, which it is not by default. | |
void | setMDISize (Size size) |
like setMDIPosition(), but for the size. | |
void | setMDIZ (int z) |
like setMDIPosition(), but for the Z only implemented for QtQuick | |
void | setOptions (DockWidgetOptions) |
Setter for the options. Only DockWidetOption_NotClosable is allowed to change after construction. For the other options use the constructor only. | |
void | setTitle (const QString &title) |
setter for the dock widget's title | |
void | setUserType (int userType) |
Allows the user to set a type on this dock widget The type is opaque and will not be interpreted by KDDockWidgets. This type is passed to ViewFactory::createTitleBar(), which the user can override and return different TitleBar subclasses, depending on the type. | |
void | show () |
Deprecated, use open() instead. Visibility isn't a good concept since tabbed non-current dock widgets are not visible but still open. | |
SideBarLocation | sideBarLocation () const |
Returns whether this dock widget is in a side bar, and which. SideBarLocation::None is returned if it's not in a sidebar. This is only relevant when using the auto-hide and side-bar feature. | |
Size | sizeInLayout () const |
bool | skipsRestore () const |
Returns whether this widget has the LayoutSaverOption::Skip flag. | |
bool | startDragging (bool singleTab=false) |
int | tabIndex () const |
Returns the tab index this dock widget occupies Note that dock widgets are almost always tabbed, even if you don't see the tab bar. A single floating dock widget is still tabbed on a tab widget with a single tab. | |
QString | title () const |
Returns the dock widget's title. This title is visible in title bars and tab bars. | |
Core::TitleBar * | titleBar () const |
Returns this dock widget's title bar. | |
Action * | toggleAction () const |
Returns the Action that allows to hide/show the dock widget Useful to put in menus. | |
QString | uniqueName () const |
the dock widget's unique name. | |
int | userType () const |
bool | wasRestored () const |
Public Member Functions inherited from KDDockWidgets::Core::Controller | |
Controller (ViewType type, View *) | |
virtual | ~Controller () |
bool | close () |
void | destroyLater () |
Controller::Private * | dptr () const |
Rect | geometry () const |
int | height () const |
bool | inDtor () const |
bool | is (ViewType) const |
Returns whether this controller is of the specified type. | |
bool | isVisible () const |
Point | mapToGlobal (Point) const |
Point | pos () const |
Rect | rect () const |
void | setParentView (View *parent) |
void | setVisible (bool) |
void | show () const |
Size | size () const |
ViewType | type () const |
Returns the type of this controller. | |
View * | view () const |
Returns the view associated with this controller, if any. | |
int | width () const |
std::shared_ptr< View > | window () const |
int | x () const |
int | y () const |
Static Public Member Functions | |
static DockWidget * | byName (const QString &uniqueName) |
Returns a dock widget by its name This is the same name you passed to DockWidget CTOR. nullptr is returned if the dock widget isn't found. | |
static DockWidget * | deserialize (const std::shared_ptr< LayoutSaver::DockWidget > &) |
Constructs a dock widget from its serialized form. | |
Public Attributes | |
Private *const | d |
Protected Member Functions | |
void | setParentView_impl (View *parent) override |
Additional Inherited Members | |
Protected Attributes inherited from KDDockWidgets::Core::Controller | |
bool | m_inDtor = false |
The DockWidget base-class. DockWidget and Core::DockWidget are only split in two so we can share some code with the QtQuick implementation, which also derives from Core::DockWidget.
Do not use instantiate directly in user code. Use DockWidget instead.
Definition at line 59 of file core/DockWidget.h.
Definition at line 63 of file core/DockWidget.h.
|
explicit |
constructs a new DockWidget
uniqueName | the name of the dockwidget, should be unique. Use title for user visible text. |
options | the options controlling certain behaviours |
layoutSaverOptions | the options to control save/restore |
There's no parent argument. The DockWidget is either parented to FloatingWindow or MainWindow when visible, or stays without a parent when hidden.
Definition at line 55 of file core/DockWidget.cpp.
References d, KDDockWidgets::Core::Platform::d, KDDockWidgets::Core::Platform::instance(), QString::isEmpty(), KDDockWidgets::DockRegistry::registerDockWidget(), and KDDockWidgets::DockRegistry::self().
|
override |
destructor
Definition at line 71 of file core/DockWidget.cpp.
References d, KDDockWidgets::Core::Controller::m_inDtor, KDDockWidgets::DockRegistry::self(), and KDDockWidgets::DockRegistry::unregisterDockWidget().
void DockWidget::addDockWidgetAsTab | ( | KDDockWidgets::Core::DockWidget * | other, |
KDDockWidgets::InitialOption | initialOption = {} |
||
) |
docks other
widget into this one. Tabs will be shown if not already.
other | The other dock widget to dock into this one. |
initialOption | Allows to specify an InitialOption. Which is useful to add the dock widget as hidden, recording only a placeholder in the tab. So it's restored to tabbed when eventually shown. |
Definition at line 88 of file core/DockWidget.cpp.
References KDDockWidgets::Core::Group::addTab(), affinities(), KDDockWidgets::Core::Group::containsDockWidget(), d, KDDockWidgets::DockWidgetOption_NotDockable, isPersistentCentralDockWidget(), options(), KDDockWidgets::DockRegistry::self(), KDDockWidgets::Core::Controller::setParentView(), and KDDockWidgets::Core::Controller::view().
Referenced by KDDockWidgets::Core::DockWidgetViewInterface::addDockWidgetAsTab(), KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::addDockWidgetAsTab(), KDDockWidgets::DockWidgetInstantiator::addDockWidgetAsTab(), KDDockWidgets::QtQuick::TabBar::addDockWidgetAsTab(), and c_KDDockWidgets__Core__DockWidget__addDockWidgetAsTab_DockWidget_InitialOption().
void DockWidget::addDockWidgetToContainingWindow | ( | KDDockWidgets::Core::DockWidget * | other, |
KDDockWidgets::Location | location, | ||
KDDockWidgets::Core::DockWidget * | relativeTo = nullptr , |
||
KDDockWidgets::InitialOption | initialOption = {} |
||
) |
docks other
widget into the window that contains this one. Equivalent to MainWindow::addDockWidget() with the difference that it also supports the case where the top-level window is a FloatingWindow instead of MainWindow.
other | The other dock widget to dock into the window. |
location | The location to dock. |
relativeTo | The dock widget that the location is relative to. If null then the window is considered |
initialOption | Allows to specify some extra options that are used while docking. |
Definition at line 143 of file core/DockWidget.cpp.
References KDDockWidgets::Core::MainWindow::addDockWidget(), affinities(), d, KDDockWidgets::DockWidgetOption_NotDockable, floatingWindow(), mainWindow(), options(), KDDockWidgets::DockRegistry::self(), and KDDockWidgets::Core::Controller::view().
Referenced by KDDockWidgets::Core::DockWidgetViewInterface::addDockWidgetToContainingWindow(), KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::addDockWidgetToContainingWindow(), KDDockWidgets::DockWidgetInstantiator::addDockWidgetToContainingWindow(), and c_KDDockWidgets__Core__DockWidget__addDockWidgetToContainingWindow_DockWidget_Location_DockWidget_InitialOption().
Returns the affinity name. Empty by default.
Definition at line 419 of file core/DockWidget.cpp.
References d.
Referenced by addDockWidgetAsTab(), addDockWidgetToContainingWindow(), KDDockWidgets::Core::Group::affinities(), KDDockWidgets::Core::DockWidgetViewInterface::affinities(), deserialize(), and setAffinities().
|
static |
Returns a dock widget by its name This is the same name you passed to DockWidget CTOR. nullptr is returned if the dock widget isn't found.
Definition at line 536 of file core/DockWidget.cpp.
References KDDockWidgets::DockRegistry::dockByName(), KDDockWidgets::DockRegistry::self(), and uniqueName().
int DockWidget::currentTabIndex | ( | ) | const |
Returns the index of the current tab of the tab group this dock widget is in.
Definition at line 365 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__currentTabIndex().
|
static |
Constructs a dock widget from its serialized form.
Definition at line 899 of file core/DockWidget.cpp.
References affinities(), KDDockWidgets::DockRegistry::CreateIfNotFound, d, guestView(), KDDockWidgets::DockRegistry::self(), and KDDockWidgets::Core::Controller::setVisible().
Referenced by KDDockWidgets::Core::Group::deserialize(), and KDDockWidgets::LayoutSaver::restoreLayout().
DockWidget::Private * DockWidget::dptr | ( | ) | const |
Definition at line 678 of file core/DockWidget.cpp.
References d.
Referenced by KDDockWidgets::flutter::DockWidget::DockWidget(), KDDockWidgets::Core::DockWidgetViewInterface::group(), and KDDockWidgets::Core::TabBar::insertDockWidget().
Action * DockWidget::floatAction | ( | ) | const |
Returns the Action that allows to dock/undock the dock widget Useful to put in menus.
Definition at line 260 of file core/DockWidget.cpp.
References d.
Referenced by KDDockWidgets::QtWidgets::DockWidget::floatAction().
Core::FloatingWindow * DockWidget::floatingWindow | ( | ) | const |
returns the FloatingWindow this widget is in, otherwise nullptr
Definition at line 565 of file core/DockWidget.cpp.
References KDDockWidgets::Core::Controller::view().
Referenced by addDockWidgetToContainingWindow(), c_KDDockWidgets__Core__DockWidget__floatingWindow(), isFloating(), raise(), setFloating(), and setFloatingWindowFlags().
KDDockWidgets::FloatingWindowFlags DockWidget::floatingWindowFlags | ( | ) | const |
Definition at line 1112 of file core/DockWidget.cpp.
References d.
void DockWidget::forceClose | ( | ) |
Like QWidget::close() but the hosted widget won't be asked if we should close.
Definition at line 401 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__forceClose(), KDDockWidgets::Core::DockWidgetViewInterface::forceClose(), KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::forceClose(), and KDDockWidgets::DockWidgetInstantiator::forceClose().
Rect DockWidget::groupGeometry | ( | ) | const |
Returns the size of the dock widget's parent group.
This will always be bigger than the DockWidget's size, as there's margins and a title bar. Also, a group can contain more than 1 dock widget (tabbed), meaning the geometry will account for the tab bar and title bar.
The position of the rect is in layout coordinates. 0,0 is the top-left of the layout holding the widgets.
Definition at line 296 of file core/DockWidget.cpp.
References d, and KDDockWidgets::Core::Controller::geometry().
Referenced by c_KDDockWidgets__Core__DockWidget__groupGeometry().
std::shared_ptr< View > DockWidget::guestView | ( | ) | const |
Like widget() but returns a view.
Definition at line 177 of file core/DockWidget.cpp.
References d.
Referenced by KDDockWidgets::flutter::DockWidget::DockWidget(), KDDockWidgets::DockWidgetInstantiator::componentComplete(), deserialize(), KDDockWidgets::QtWidgets::DockWidget::focusCandidate(), KDDockWidgets::QtQuick::DockWidget::guestItem(), isMainWindow(), title(), and KDDockWidgets::QtWidgets::DockWidget::widget().
bool DockWidget::hasPreviousDockedLocation | ( | ) | const |
Returns whether this floating dock widget knows its previous docked location Result only makes sense if it's floating.
When you call dockWidget->setFloating(false) it will only dock if it knows where to.
Definition at line 526 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__hasPreviousDockedLocation().
Icon DockWidget::icon | ( | IconPlace | place = IconPlace::TitleBar | ) | const |
Returns the dock widget's titlebar, tabbar, or toggle action icon (depending on the passed place
)
By default it's null.
Definition at line 387 of file core/DockWidget.cpp.
References d, KDDockWidgets::TabBar, KDDockWidgets::TitleBar, and KDDockWidgets::ToggleAction.
Referenced by KDDockWidgets::Core::DockWidgetViewInterface::icon(), KDDockWidgets::Core::Stack::insertDockWidget(), KDDockWidgets::Core::Group::onDockWidgetTitleChanged(), and setIcon().
void DockWidget::init | ( | ) |
Definition at line 82 of file core/DockWidget.cpp.
References d, KDDockWidgets::Core::View::enableAttribute(), KDDockWidgets::Core::Controller::view(), and Qt::WA_PendingMoveEvent.
Referenced by KDDockWidgets::flutter::DockWidget::DockWidget(), KDDockWidgets::QtWidgets::DockWidget::DockWidget(), KDDockWidgets::QtQuick::DockWidget::DockWidget(), c_KDDockWidgets__Core__DockWidget__init(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::init().
bool DockWidget::isCurrentTab | ( | ) | const |
Returns true if this dock widget is the current one in the tab widget that contains it. If the dock widget is alone then true is returned, as in this case there will also be a tab widget even though it's invisible.
Definition at line 342 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__isCurrentTab(), isFocused(), and KDDockWidgets::Core::TitleBar::onFloatClicked().
bool DockWidget::isFloating | ( | ) | const |
Returns whether the dock widget is floating. Floating means it's not docked and has a window of its own. Note that if you dock a floating dock widget into another floating one then they don't count as floating anymore, as they are side-by-side (or tabbed).
Definition at line 199 of file core/DockWidget.cpp.
References floatingWindow(), and KDDockWidgets::Core::Controller::view().
Referenced by c_KDDockWidgets__Core__DockWidget__isFloating(), KDDockWidgets::Core::DockWidgetViewInterface::isFloating(), KDDockWidgets::DockWidgetInstantiator::isFloating(), isTabbed(), setFloating(), and setFloatingGeometry().
bool DockWidget::isFocused | ( | ) | const |
Returns whether This or any child of this dock widget is focused Not to be confused with QWidget::hasFocus(), which just refers to 1 widget. This includes variant includes children.
Definition at line 474 of file core/DockWidget.cpp.
References d, and isCurrentTab().
Referenced by c_KDDockWidgets__Core__DockWidget__isFocused(), KDDockWidgets::Core::DockWidgetViewInterface::isFocused(), and KDDockWidgets::DockWidgetInstantiator::isFocused().
bool DockWidget::isInMainWindow | ( | ) | const |
Returns whether this dock widget is docked into a main window (as opposed to floating)
Note that isFloating() returning false might either mean the dock widget is docked into a main window or into a floating window (grouped/nested with other dock widgets. Use this function then if you need to disambiguate
Definition at line 464 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__isInMainWindow().
bool DockWidget::isInSideBar | ( | ) | const |
Returns where this dockwidget is in a sidebar Similar to sideBarLocation(), but returns a bool.
Definition at line 521 of file core/DockWidget.cpp.
References KDDockWidgets::None, and sideBarLocation().
Referenced by c_KDDockWidgets__Core__DockWidget__isInSideBar().
bool DockWidget::isMainWindow | ( | ) | const |
Returns whether widget() is a KDDockWidget::MainWindow.
This function doesn't have anything to do with this dock widget being inside a main window or not, but rather the inverse concept. It's not a very popular usage, but some applications want to dock a main window into another main window. This is done by putting it into a dock widget first.
See also examples/qtwidgets_dockwidgets -j
Definition at line 457 of file core/DockWidget.cpp.
References guestView(), and KDDockWidgets::Core::MainWindow.
Referenced by c_KDDockWidgets__Core__DockWidget__isMainWindow().
bool DockWidget::isOpen | ( | ) | const |
Returns whether this dock widget is open. Equivalent to calling toggleAction().isChecked()
Definition at line 414 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__isOpen(), KDDockWidgets::Core::DockWidgetViewInterface::isOpen(), KDDockWidgets::DockWidgetInstantiator::isOpen(), raise(), and setFloatingGeometry().
bool DockWidget::isOverlayed | ( | ) | const |
Returns whether this dock widget is overlayed from the side-bar.
This is only relevant when using the auto-hide and side-bar feature. Not to be confused with "floating", which means top-level window.
Definition at line 508 of file core/DockWidget.cpp.
References mainWindow().
Referenced by c_KDDockWidgets__Core__DockWidget__isOverlayed(), and onResize().
bool DockWidget::isPersistentCentralDockWidget | ( | ) | const |
Returns whether this dock widget is the main window persistent central widget This only applies when using MainWindowOption_HasCentralWidget.
Definition at line 960 of file core/DockWidget.cpp.
References d.
Referenced by addDockWidgetAsTab(), c_KDDockWidgets__Core__DockWidget__isPersistentCentralDockWidget(), KDDockWidgets::Core::Group::insertWidget(), and setFloating().
bool DockWidget::isTabbed | ( | ) | const |
returns if this dock widget is tabbed into another
Technically a docked DockWidget always lives in a tab widget, but from the user's perspective it's not tabbed when there's only 1 dock widget, as there are no tabs displayed. Unless the group is using Option_AlwaysShowsTabs, in which case this method will return true regardless if being the single one.
Definition at line 331 of file core/DockWidget.cpp.
References d, and isFloating().
Referenced by c_KDDockWidgets__Core__DockWidget__isTabbed(), and setFloating().
Size DockWidget::lastOverlayedSize | ( | ) | const |
returns the last size the widget has when overlayed Empty otherwise
Definition at line 531 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__lastOverlayedSize().
LayoutSaverOptions DockWidget::layoutSaverOptions | ( | ) | const |
returns the per-dockwidget options which will affect LayoutSaver These are the options which were passed to the constructor
Definition at line 310 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__layoutSaverOptions(), and KDDockWidgets::DockRegistry::closedDockwidgets().
MainWindow * DockWidget::mainWindow | ( | ) | const |
Returns the main window this dock widget is in. nullptr if it's not inside a main window Also returns nullptr if it's minimized to a sidebar.
Definition at line 469 of file core/DockWidget.cpp.
References d.
Referenced by addDockWidgetToContainingWindow(), c_KDDockWidgets__Core__DockWidget__mainWindow(), isOverlayed(), and moveToSideBar().
void DockWidget::moveToSideBar | ( | ) |
Minimizes this dock widget to the MainWindow's side-bar.
It will be undocked from current layout. It's previous docked position will be remembered.
This action is only available if the dock widget is docked into a MainWindow. The dockwidget will initially be visible and overlayed on top of the current layout (this is the auto-hide feature).
Definition at line 502 of file core/DockWidget.cpp.
References mainWindow().
Referenced by c_KDDockWidgets__Core__DockWidget__moveToSideBar(), KDDockWidgets::Core::DockWidgetViewInterface::moveToSideBar(), KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::moveToSideBar(), and KDDockWidgets::DockWidgetInstantiator::moveToSideBar().
void DockWidget::onResize | ( | Size | newSize | ) |
Definition at line 888 of file core/DockWidget.cpp.
References d, isOverlayed(), KDDockWidgets::Core::View::size(), and KDDockWidgets::Core::Controller::view().
Referenced by c_KDDockWidgets__Core__DockWidget__onResize_Size(), KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::onResize(), and KDDockWidgets::QtWidgets::DockWidget::resizeEvent().
void DockWidget::open | ( | ) |
Opens this dock widget. Does nothing if already open. The dock widget will appear floating unless it knows about its previous layout position, in which case it will appear docked (or tabbed) into the main window.
Definition at line 429 of file core/DockWidget.cpp.
References d, and KDDockWidgets::Core::Controller::view().
Referenced by KDDockWidgets::Debug::DebugWindow::DebugWindow(), c_KDDockWidgets__Core__DockWidget__open(), KDDockWidgets::QtWidgets::DockWidget::event(), KDDockWidgets::QtQuick::DockWidget::event(), KDDockWidgets::Core::DockWidgetViewInterface::open(), KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::open(), KDDockWidgets::DockWidgetInstantiator::open(), and show().
DockWidgetOptions DockWidget::options | ( | ) | const |
Returns the dock widget's options which control behaviour.
Definition at line 305 of file core/DockWidget.cpp.
References d.
Referenced by KDDockWidgets::QtWidgets::MDIArea::addDockWidget(), addDockWidgetAsTab(), addDockWidgetToContainingWindow(), c_KDDockWidgets__Core__DockWidget__options(), KDDockWidgets::Core::DockWidgetViewInterface::options(), and setOptions().
void DockWidget::raise | ( | ) |
Brings the dock widget to the front.
This means:
This only applies if the dock widget is already open. If closed, does nothing.
Definition at line 441 of file core/DockWidget.cpp.
References d, floatingWindow(), isOpen(), and setAsCurrentTab().
Referenced by c_KDDockWidgets__Core__DockWidget__raise(), KDDockWidgets::Core::DockWidgetViewInterface::raise(), KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::raise(), and KDDockWidgets::DockWidgetInstantiator::raise().
void DockWidget::resizeInLayout | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom | ||
) |
Resizes the dock widget to the requested size. The new sizing is expressed by how much the margins should shift, similar to how QRect::adjust() works. Use negative values to shrink the widget.
By "inLayout" it is meant that it will be resized within the layout. You can't use this method to resize a top-level floating dock widget. Using this function will never resize the window.
Note: the final size might not be the same as the requested size, as min/max sizes need to be honoured. Also, if you're trying to resize the left margin and the widget is already left-most in the layout then left isn't changed (similar for the other sides). Call sizeInLayout() afterwards, to see what size was really given.
Example: // Grow the widget 5px to the left, 10px to the right and shrink 7px at the bottom dockWidget->resizeInLayout(5, 0, 10, -7);
Definition at line 1125 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__resizeInLayout_int_int_int_int(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::resizeInLayout().
Sets the affinity names. Dock widgets can only dock into dock widgets of the same affinity.
By default the affinity is empty and a dock widget can dock into any main window and into any floating window. Usually you won't ever need to call this function, unless you have requirements where certain dock widgets can only dock into certain other dock widgets and main windows.
Note: Call this function right after creating your dock widget, before adding to a main window and before restoring any layout.
Note: Currently you can only call this function once, to keep the code simple and avoid edge cases. This will only be changed if a good use case comes up that requires changing affinities multiple times.
names
the affinity names
Definition at line 485 of file core/DockWidget.cpp.
References affinities(), d, and KDToolBox::StlContainerAdaptor::StdVectorAdaptor< T, Args >::removeAll().
Referenced by KDDockWidgets::Core::DockWidgetViewInterface::setAffinities(), and setAffinityName().
void DockWidget::setAffinityName | ( | const QString & | name | ) |
name | the affinity name |
Definition at line 480 of file core/DockWidget.cpp.
References setAffinities().
Referenced by c_KDDockWidgets__Core__DockWidget__setAffinityName_QString(), KDDockWidgets::Core::DockWidgetViewInterface::setAffinityName(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::setAffinityName().
void DockWidget::setAsCurrentTab | ( | ) |
Makes this dock widget current in its tab group.
Definition at line 351 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__setAsCurrentTab(), KDDockWidgets::Core::TitleBar::onFloatClicked(), raise(), KDDockWidgets::Core::DockWidgetViewInterface::setAsCurrentTab(), KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::setAsCurrentTab(), and KDDockWidgets::DockWidgetInstantiator::setAsCurrentTab().
bool DockWidget::setFloating | ( | bool | floats | ) |
setter to make the dock widget float or dock.
floats | If true makes the dock widget float, otherwise docks it. |
Returns true if the request was accomplished
Definition at line 208 of file core/DockWidget.cpp.
References d, floatingWindow(), KDDockWidgets::Config::InternalFlag_DontShowWhenUnfloatingHiddenWindow, isFloating(), isPersistentCentralDockWidget(), isTabbed(), KDDockWidgets::Core::Controller::isVisible(), KDDockWidgets::Core::TitleBar::makeWindow(), KDDockWidgets::Config::self(), KDDockWidgets::SuggestedGeometryHint_PreserveCenter, and titleBar().
Referenced by c_KDDockWidgets__Core__DockWidget__setFloating_bool(), KDDockWidgets::DockWidgetInstantiator::componentComplete(), KDDockWidgets::Core::TitleBar::onFloatClicked(), KDDockWidgets::Core::DockWidgetViewInterface::setFloating(), and KDDockWidgets::DockWidgetInstantiator::setFloating().
void DockWidget::setFloatingGeometry | ( | Rect | geo | ) |
If this dock widget is floating, then sets its geometry to geo
.
If this dock widget is hidden then it stores the geometry so it can be used the next time it becomes floating.
This is just convenience, equivalent to calling window()->setGeometry(rect), with the added bonus of remembering the requested geometry in case it's still hidden.
Definition at line 556 of file core/DockWidget.cpp.
References d, KDDockWidgets::Core::Controller::geometry(), isFloating(), isOpen(), KDDockWidgets::Core::View::rootView(), and KDDockWidgets::Core::Controller::view().
Referenced by c_KDDockWidgets__Core__DockWidget__setFloatingGeometry_Rect(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::setFloatingGeometry().
void DockWidget::setFloatingWindowFlags | ( | FloatingWindowFlags | flags | ) |
Sets the desired floating window flags, in case the defaults aren't desired. By default KDDW will use the flags specified in KDDockWidgets::Config to influence many aspects regarding windows (minimize,maximize support for example). You can use this function to override those "global flags" and specify per-dock widget flags. Be sure to not call this before the floating window has already been created. It's suggested to call it before the dock widget is shown.
Definition at line 1103 of file core/DockWidget.cpp.
References d, and floatingWindow().
void DockWidget::setGuestView | ( | std::shared_ptr< View > | guest | ) |
sets the widget which this dock widget hosts.
widget | the widget to show inside this dock widget. Must not be null. |
Ownership for widget
is transferred to Core::DockWidget. Ownsership for any previously existing widget is transferred back to the user. Meaning if you call setWidget(A) followed by setWidget(B) then A will have to be deleted by you, while B is owned by the dock widget.
Definition at line 182 of file core/DockWidget.cpp.
References d, and KDDockWidgets::Core::Controller::view().
Referenced by KDDockWidgets::QtQuick::DockWidget::setGuestItem(), and KDDockWidgets::QtWidgets::DockWidget::setWidget().
void DockWidget::setIcon | ( | const Icon & | icon, |
IconPlaces | places = IconPlace::All |
||
) |
Sets an icon to show on title bars and tab bars.
By default there's no icon set.
Definition at line 373 of file core/DockWidget.cpp.
References d, icon(), KDDockWidgets::TabBar, KDDockWidgets::TitleBar, and KDDockWidgets::ToggleAction.
Referenced by KDDockWidgets::Core::DockWidgetViewInterface::setIcon().
void DockWidget::setMDIPosition | ( | Point | pos | ) |
Sets this dock widgets position to pos within the MDI layout This only applies if the main window is in MDI mode, which it is not by default.
Definition at line 928 of file core/DockWidget.cpp.
References d, and KDDockWidgets::Core::Controller::pos().
Referenced by c_KDDockWidgets__Core__DockWidget__setMDIPosition_Point(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::setMDIPosition().
void DockWidget::setMDISize | ( | Size | size | ) |
like setMDIPosition(), but for the size.
Definition at line 940 of file core/DockWidget.cpp.
References d, and KDDockWidgets::Core::Controller::size().
Referenced by c_KDDockWidgets__Core__DockWidget__setMDISize_Size(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::setMDISize().
void DockWidget::setMDIZ | ( | int | z | ) |
like setMDIPosition(), but for the Z only implemented for QtQuick
Definition at line 952 of file core/DockWidget.cpp.
References d, KDDockWidgets::Core::Group::isMDI(), KDDockWidgets::Core::View::setZOrder(), and KDDockWidgets::Core::Controller::view().
Referenced by c_KDDockWidgets__Core__DockWidget__setMDIZ_int(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::setMDIZ().
void DockWidget::setOptions | ( | DockWidgetOptions | options | ) |
Setter for the options. Only DockWidetOption_NotClosable is allowed to change after construction. For the other options use the constructor only.
Definition at line 315 of file core/DockWidget.cpp.
References d, KDDockWidgets::DockWidgetOption_NotDockable, options(), and titleBar().
Referenced by c_KDDockWidgets__Core__DockWidget__setOptions_DockWidgetOptions(), KDDockWidgets::Core::DockWidgetViewInterface::setOptions(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::setOptions().
|
overrideprotectedvirtual |
Reimplemented from KDDockWidgets::Core::Controller.
Reimplemented in KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper.
Definition at line 541 of file core/DockWidget.cpp.
References d, and KDDockWidgets::Core::Controller::setParentView_impl().
Referenced by KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::setParentView_impl(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::setParentView_impl_nocallback().
void DockWidget::setTitle | ( | const QString & | title | ) |
setter for the dock widget's title
title | the dock widget's new title |
Definition at line 287 of file core/DockWidget.cpp.
Referenced by c_KDDockWidgets__Core__DockWidget__setTitle_QString(), KDDockWidgets::DockWidgetInstantiator::componentComplete(), KDDockWidgets::Core::DockWidgetViewInterface::setTitle(), KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::setTitle(), and KDDockWidgets::DockWidgetInstantiator::setTitle().
void DockWidget::setUserType | ( | int | userType | ) |
Allows the user to set a type on this dock widget The type is opaque and will not be interpreted by KDDockWidgets. This type is passed to ViewFactory::createTitleBar(), which the user can override and return different TitleBar subclasses, depending on the type.
Definition at line 918 of file core/DockWidget.cpp.
References d, and userType().
Referenced by c_KDDockWidgets__Core__DockWidget__setUserType_int(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::setUserType().
void DockWidget::show | ( | ) |
Deprecated, use open() instead. Visibility isn't a good concept since tabbed non-current dock widgets are not visible but still open.
Definition at line 424 of file core/DockWidget.cpp.
References open().
Referenced by c_KDDockWidgets__Core__DockWidget__show(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DockWidget_wrapper::show().
SideBarLocation DockWidget::sideBarLocation | ( | ) | const |
Returns whether this dock widget is in a side bar, and which. SideBarLocation::None is returned if it's not in a sidebar. This is only relevant when using the auto-hide and side-bar feature.
Definition at line 516 of file core/DockWidget.cpp.
References KDDockWidgets::DockRegistry::self(), and KDDockWidgets::DockRegistry::sideBarLocationForDockWidget().
Referenced by isInSideBar().
Size DockWidget::sizeInLayout | ( | ) | const |
Returns the size this dockwidget occupies inside the layout This is slightly bigger than DockWidget::size() due to margins from the tab widget This is convenience for calling Group::size(), as Group is private API
Definition at line 1117 of file core/DockWidget.cpp.
References d, and KDDockWidgets::Core::Controller::size().
Referenced by c_KDDockWidgets__Core__DockWidget__sizeInLayout().
bool DockWidget::skipsRestore | ( | ) | const |
Returns whether this widget has the LayoutSaverOption::Skip flag.
Definition at line 551 of file core/DockWidget.cpp.
References d, and KDDockWidgets::Skip.
Referenced by c_KDDockWidgets__Core__DockWidget__skipsRestore().
bool DockWidget::startDragging | ( | bool | singleTab = false | ) |
See documentation for DragController::programmaticStartDrag()
Definition at line 1158 of file core/DockWidget.cpp.
References KDDockWidgets::Core::Platform::cursorPos(), d, KDDockWidgets::Core::TabBar::dptr(), KDDockWidgets::Core::TabBar::group(), KDDockWidgets::Core::Platform::instance(), KDDockWidgets::Core::View::mapFromGlobal(), KDDockWidgets::Core::Group::tabBar(), and KDDockWidgets::Core::Controller::view().
Referenced by c_KDDockWidgets__Core__DockWidget__startDragging_bool().
int DockWidget::tabIndex | ( | ) | const |
Returns the tab index this dock widget occupies Note that dock widgets are almost always tabbed, even if you don't see the tab bar. A single floating dock widget is still tabbed on a tab widget with a single tab.
Definition at line 357 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__tabIndex().
QString DockWidget::title | ( | ) | const |
Returns the dock widget's title. This title is visible in title bars and tab bars.
Definition at line 270 of file core/DockWidget.cpp.
References KDDockWidgets::Core::Platform::applicationName(), d, guestView(), and KDDockWidgets::Core::Platform::instance().
Referenced by KDDockWidgets::Core::SideBar::addDockWidget(), c_KDDockWidgets__Core__DockWidget__title(), KDDockWidgets::QtQuick::DockWidgetModel::data(), KDDockWidgets::Core::Stack::insertDockWidget(), KDDockWidgets::Core::Group::onDockWidgetTitleChanged(), KDDockWidgets::Core::SideBar::removeDockWidget(), setTitle(), KDDockWidgets::Core::DockWidgetViewInterface::title(), and KDDockWidgets::DockWidgetInstantiator::title().
Core::TitleBar * DockWidget::titleBar | ( | ) | const |
Returns this dock widget's title bar.
Note that several dock widgets can have the same title bar, in case they are tabbed together. Hidden dock widgets have no associated title bar.
Definition at line 406 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__titleBar(), setFloating(), and setOptions().
Action * DockWidget::toggleAction | ( | ) | const |
Returns the Action that allows to hide/show the dock widget Useful to put in menus.
Definition at line 255 of file core/DockWidget.cpp.
References d.
Referenced by KDDockWidgets::QtQuick::DockWidget::floatAction(), KDDockWidgets::QtQuick::DockWidget::toggleAction(), and KDDockWidgets::QtWidgets::DockWidget::toggleAction().
QString DockWidget::uniqueName | ( | ) | const |
the dock widget's unique name.
Definition at line 265 of file core/DockWidget.cpp.
References d.
Referenced by KDDockWidgets::QtWidgets::MDIArea::addDockWidget(), byName(), c_KDDockWidgets__Core__DockWidget__uniqueName(), KDDockWidgets::DockRegistry::dockByName(), KDDockWidgets::DockRegistry::dockWidgetNames(), KDDockWidgets::DockRegistry::dockWidgets(), KDDockWidgets::Core::Group::insertWidget(), KDDockWidgets::DockRegistry::registerDockWidget(), KDDockWidgets::Core::SideBar::serialize(), and KDDockWidgets::Core::DockWidgetViewInterface::uniqueName().
int DockWidget::userType | ( | ) | const |
Definition at line 923 of file core/DockWidget.cpp.
References d.
Referenced by c_KDDockWidgets__Core__DockWidget__userType(), and setUserType().
bool DockWidget::wasRestored | ( | ) | const |
Returns whether this dock widget was successfully restored in the last LayoutSaver::restore*() call Reasons for this to be false can be for example the DockWidget not existing at restore time
Definition at line 1186 of file core/DockWidget.cpp.
References d.
Private* const KDDockWidgets::Core::DockWidget::d |
Definition at line 495 of file core/DockWidget.h.
Referenced by KDDockWidgets::QtWidgets::DockWidget::DockWidget(), KDDockWidgets::QtQuick::DockWidget::DockWidget(), DockWidget(), ~DockWidget(), KDDockWidgets::Core::MDILayout::addDockWidget(), KDDockWidgets::Core::SideBar::addDockWidget(), KDDockWidgets::Core::DropArea::addDockWidget(), addDockWidgetAsTab(), addDockWidgetToContainingWindow(), affinities(), KDDockWidgets::DockWidgetInstantiator::componentComplete(), KDDockWidgets::Core::DropArea::containsDockWidget(), currentTabIndex(), deserialize(), KDDockWidgets::Core::Group::detachTab(), dptr(), KDDockWidgets::DockRegistry::ensureAllFloatingWidgetsAreMorphed(), floatAction(), floatingWindowFlags(), forceClose(), groupGeometry(), guestView(), KDDockWidgets::Core::Group::hasNestedMDIDockWidgets(), hasPreviousDockedLocation(), icon(), init(), KDDockWidgets::QtQuick::DockWidgetModel::insert(), KDDockWidgets::QtQuick::Group::insertDockWidget(), KDDockWidgets::Core::Group::insertDockWidget(), KDDockWidgets::Core::Stack::insertDockWidget(), KDDockWidgets::Core::TabBar::insertDockWidget(), KDDockWidgets::Core::Group::insertWidget(), isCurrentTab(), isFocused(), isInMainWindow(), isOpen(), isPersistentCentralDockWidget(), isTabbed(), lastOverlayedSize(), KDDockWidgets::Core::DropArea::layoutParentContainerEqually(), layoutSaverOptions(), mainWindow(), KDDockWidgets::Core::MDILayout::moveDockWidget(), onResize(), open(), options(), raise(), KDDockWidgets::Core::SideBar::removeDockWidget(), KDDockWidgets::Core::MDILayout::resizeDockWidget(), resizeInLayout(), setAffinities(), setAsCurrentTab(), setFloating(), setFloatingGeometry(), setFloatingWindowFlags(), setGuestView(), setIcon(), setMDIPosition(), setMDISize(), setMDIZ(), setOptions(), setParentView_impl(), setTitle(), setUserType(), sizeInLayout(), skipsRestore(), startDragging(), tabIndex(), title(), titleBar(), toggleAction(), uniqueName(), userType(), and wasRestored().