KDDockWidgets API Documentation 2.1
|
The widget (QWidget or QQuickItem) which holds a layout of dock widgets. More...
#include <Layout.h>
Public Member Functions | |
Layout (ViewType, View *) | |
~Layout () | |
Core::DropArea * | asDropArea () const |
LayoutingHost * | asLayoutingHost () const |
Core::MDILayout * | asMDILayout () const |
bool | checkSanity () const |
Runs some sanity checks. Returns true if everything is OK. | |
void | clearLayout () |
clears the layout | |
bool | containsGroup (const Core::Group *) const |
Returns true if this layout contains the specified group. | |
bool | containsItem (const Core::Item *) const |
Returns true if this layout contains the specified item. | |
int | count () const |
Returns the number of Item objects in this layout. This includes non-visible (placeholder) Items too. | |
Layout::Private * | d_ptr () |
virtual bool | deserialize (const LayoutSaver::MultiSplitter &) |
Vector< Core::DockWidget * > | dockWidgets () const |
Returns the list of dock widgets contained in this layout. | |
void | dumpLayout () const |
dumps the layout to stderr | |
Core::FloatingWindow * | floatingWindow () const |
Vector< Core::Group * > | groups () const |
Returns this list of Group objects contained in this layout. | |
bool | isInMainWindow (bool honourNesting=false) const |
Returns whether this layout is in a MainWindow. | |
Core::Item * | itemForGroup (const Core::Group *group) const |
returns the Item that holds group in this layout | |
Vector< Core::Item * > | items () const |
The list of items in this layout. | |
int | layoutHeight () const |
returns the contents height. Usually it's the same height as the respective parent MultiSplitter. | |
Size | layoutMaximumSizeHint () const |
returns the layout's maximum size hint | |
Size | layoutMinimumSize () const |
returns the layout's minimum size setLayoutMinimumSize | |
Size | layoutSize () const |
Returns the size of the contents. | |
int | layoutWidth () const |
returns the contents width. Usually it's the same width as the respective parent MultiSplitter. | |
Core::MainWindow * | mainWindow (bool honourNesting=false) const |
void | onCloseEvent (CloseEvent *) |
int | placeholderCount () const |
Returns the number of placeholder items in this layout. This is the same as count minus visibleCount. | |
void | removeItem (Core::Item *item) |
Removes an item from this MultiSplitter. | |
void | restorePlaceholder (Core::DockWidget *dw, Core::Item *, int tabIndex) |
restores the dockwidget dw to its previous position | |
Core::ItemContainer * | rootItem () const |
LayoutSaver::MultiSplitter | serialize () const |
void | setLayoutSize (Size) |
setter for the contents size The "contents size" is just the size() of this layout. However, since resizing QWidgets is async and we need it to be sync. As sometimes adding widgets will increase the MultiSplitter size (due to widget's min-size constraints). | |
void | updateSizeConstraints () |
Updates the min size of this layout. | |
void | viewAboutToBeDeleted () |
int | visibleCount () const |
Returns the number of visible Items in this layout. Which is count minus placeholderCount. | |
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 | isFixedHeight () const |
bool | isFixedWidth () const |
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 Layout * | fromLayoutingHost (LayoutingHost *) |
Protected Member Functions | |
Vector< Core::Group * > | groupsFrom (View *groupOrMultiSplitter) const |
returns the groups contained in groupOrMultiSplitter- If groupOrMultiSplitter- is a Group, it returns a list of 1 element, with that group If groupOrMultiSplitter- is a MultiSplitter then it returns a list of all groups it contains | |
void | setLayoutMinimumSize (Size) |
setter for the minimum size minimumSize | |
void | setRootItem (Core::ItemContainer *root) |
void | unrefOldPlaceholders (const Vector< Core::Group * > &groupsBeingAdded) const |
Removes unneeded placeholder items when adding new groups. | |
Protected Member Functions inherited from KDDockWidgets::Core::Controller | |
virtual void | setParentView_impl (View *parent) |
Additional Inherited Members | |
Protected Attributes inherited from KDDockWidgets::Core::Controller | |
bool | m_inDtor = false |
The widget (QWidget or QQuickItem) which holds a layout of dock widgets.
Usually this would simply be MultiSplitter, but we've introduced this base class to support different layouts, like MDI layouts, which are very different than traditional dock widget layouts.
This class makes the bridge between the GUI world (QWidget) and Core::Item world. It's suitable to be set as a main window central widget for instance. The actual layouting is then done by the root Item.
Definition at line 36 of file Layout.cpp.
References KDDockWidgets::Core::View::d, updateSizeConstraints(), and KDDockWidgets::Core::Controller::view().
Layout::~Layout | ( | ) |
Definition at line 46 of file Layout.cpp.
References viewAboutToBeDeleted().
Core::DropArea * Layout::asDropArea | ( | ) | const |
Definition at line 337 of file Layout.cpp.
References KDDockWidgets::Core::View::asDropAreaController(), and KDDockWidgets::Core::Controller::view().
Referenced by c_KDDockWidgets__Core__Layout__asDropArea().
LayoutingHost * Layout::asLayoutingHost | ( | ) | const |
Definition at line 367 of file Layout.cpp.
Referenced by KDDockWidgets::Core::DropArea::DropArea(), KDDockWidgets::Core::MDILayout::addDockWidget(), KDDockWidgets::Core::DropArea::addWidget(), and KDDockWidgets::Core::DropArea::deserialize().
MDILayout * Layout::asMDILayout | ( | ) | const |
Definition at line 342 of file Layout.cpp.
References KDDockWidgets::Core::Controller::view().
Referenced by KDDockWidgets::Core::Group::mdiLayout().
bool Layout::checkSanity | ( | ) | const |
Runs some sanity checks. Returns true if everything is OK.
Definition at line 141 of file Layout.cpp.
Referenced by c_KDDockWidgets__Core__Layout__checkSanity(), and KDDockWidgets::Core::DropArea::layoutEqually().
void Layout::clearLayout | ( | ) |
clears the layout
Definition at line 136 of file Layout.cpp.
Referenced by c_KDDockWidgets__Core__Layout__clearLayout(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::Layout_wrapper::clearLayout().
bool Layout::containsGroup | ( | const Core::Group * | group | ) | const |
Returns true if this layout contains the specified group.
Definition at line 204 of file Layout.cpp.
References itemForGroup().
Referenced by c_KDDockWidgets__Core__Layout__containsGroup_Group(), and KDDockWidgets::Core::DropArea::containsDockWidget().
bool Layout::containsItem | ( | const Core::Item * | item | ) | const |
Returns true if this layout contains the specified item.
Definition at line 199 of file Layout.cpp.
Referenced by c_KDDockWidgets__Core__Layout__containsItem_Item().
int Layout::count | ( | ) | const |
Returns the number of Item objects in this layout. This includes non-visible (placeholder) Items too.
Definition at line 209 of file Layout.cpp.
Referenced by c_KDDockWidgets__Core__Layout__count(), placeholderCount(), and setRootItem().
Layout::Private * Layout::d_ptr | ( | ) |
Definition at line 372 of file Layout.cpp.
Referenced by KDDockWidgets::Core::DropArea::DropArea(), and KDDockWidgets::Core::Group::setLayout().
|
virtual |
Reimplemented in KDDockWidgets::Core::DropArea.
Definition at line 285 of file Layout.cpp.
References KDDockWidgets::Core::Group::asLayoutingGuest(), KDDockWidgets::Core::Group::deserialize(), groups(), KDDockWidgets::Core::View::size(), updateSizeConstraints(), and KDDockWidgets::Core::Controller::view().
Referenced by KDDockWidgets::Core::DropArea::deserialize().
Core::DockWidget::List Layout::dockWidgets | ( | ) | const |
Returns the list of dock widgets contained in this layout.
Definition at line 232 of file Layout.cpp.
References dockWidgets(), and groups().
Referenced by dockWidgets().
void Layout::dumpLayout | ( | ) | const |
dumps the layout to stderr
Definition at line 146 of file Layout.cpp.
Referenced by c_KDDockWidgets__Core__Layout__dumpLayout(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::Layout_wrapper::dumpLayout().
Core::FloatingWindow * Layout::floatingWindow | ( | ) | const |
Definition at line 95 of file Layout.cpp.
References KDDockWidgets::Core::View::rootView(), and KDDockWidgets::Core::Controller::view().
Referenced by KDDockWidgets::Core::DropArea::affinities(), and c_KDDockWidgets__Core__Layout__floatingWindow().
|
static |
static
Definition at line 396 of file Layout.cpp.
Referenced by KDDockWidgets::DockRegistry::layoutForItem().
Core::Group::List Layout::groups | ( | ) | const |
Returns this list of Group objects contained in this layout.
Definition at line 253 of file Layout.cpp.
References KDDockWidgets::Core::Group::fromItem(), items(), and KDToolBox::StlContainerAdaptor::StdVectorAdaptor< T, Args >::reserve().
Referenced by deserialize(), dockWidgets(), KDDockWidgets::DockRegistry::groupInMDIResize(), and onCloseEvent().
|
protected |
returns the groups contained in groupOrMultiSplitter-
If groupOrMultiSplitter- is a Group, it returns a list of 1 element, with that group If groupOrMultiSplitter- is a MultiSplitter then it returns a list of all groups it contains
Definition at line 242 of file Layout.cpp.
References KDDockWidgets::Core::View::asDropAreaController(), and KDDockWidgets::Core::View::asGroupController().
Referenced by KDDockWidgets::Core::DropArea::addWidget().
bool Layout::isInMainWindow | ( | bool | honourNesting = false | ) | const |
Returns whether this layout is in a MainWindow.
honourNesting | If true, then we'll count DropAreas/MDIAreas which are nested into DropAreas/MDIAreas as inside the main window. otherwise, only direct parenting is considered |
Definition at line 68 of file Layout.cpp.
References mainWindow().
Referenced by c_KDDockWidgets__Core__Layout__isInMainWindow_bool().
Core::Item * Layout::itemForGroup | ( | const Core::Group * | group | ) | const |
returns the Item that holds group
in this layout
Definition at line 224 of file Layout.cpp.
References KDDockWidgets::Core::Group::asLayoutingGuest().
Referenced by KDDockWidgets::Core::MDILayout::addDockWidget(), KDDockWidgets::Core::DropArea::addWidget(), c_KDDockWidgets__Core__Layout__itemForGroup_Group(), containsGroup(), KDDockWidgets::Core::DropArea::layoutParentContainerEqually(), KDDockWidgets::Core::MDILayout::moveDockWidget(), KDDockWidgets::Core::MDILayout::resizeDockWidget(), KDDockWidgets::Core::ClassicDropIndicatorOverlay::setCurrentDropLocation(), and KDDockWidgets::Core::MDILayout::setDockWidgetGeometry().
Core::Item::List Layout::items | ( | ) | const |
The list of items in this layout.
Definition at line 194 of file Layout.cpp.
Referenced by KDDockWidgets::Core::DropArea::centralFrame(), groups(), serialize(), and KDDockWidgets::Core::ClassicDropIndicatorOverlay::setCurrentDropLocation().
|
inline |
returns the contents height. Usually it's the same height as the respective parent MultiSplitter.
Definition at line 96 of file Layout.h.
Referenced by c_KDDockWidgets__Core__Layout__layoutHeight().
Size Layout::layoutMaximumSizeHint | ( | ) | const |
returns the layout's maximum size hint
Definition at line 117 of file Layout.cpp.
Referenced by c_KDDockWidgets__Core__Layout__layoutMaximumSizeHint().
Size Layout::layoutMinimumSize | ( | ) | const |
returns the layout's minimum size setLayoutMinimumSize
Definition at line 112 of file Layout.cpp.
Referenced by c_KDDockWidgets__Core__Layout__layoutMinimumSize(), and setRootItem().
Size Layout::layoutSize | ( | ) | const |
Returns the size of the contents.
Definition at line 131 of file Layout.cpp.
Referenced by c_KDDockWidgets__Core__Layout__layoutSize(), setLayoutMinimumSize(), and setLayoutSize().
|
inline |
returns the contents width. Usually it's the same width as the respective parent MultiSplitter.
Definition at line 87 of file Layout.h.
Referenced by c_KDDockWidgets__Core__Layout__layoutWidth().
Core::MainWindow * Layout::mainWindow | ( | bool | honourNesting = false | ) | const |
Definition at line 73 of file Layout.cpp.
References KDDockWidgets::Core::MainWindow, KDDockWidgets::Core::View::parentView(), and KDDockWidgets::Core::Controller::view().
Referenced by KDDockWidgets::Core::DropArea::affinities(), c_KDDockWidgets__Core__Layout__mainWindow_bool(), isInMainWindow(), and KDDockWidgets::Core::Group::mainWindow().
void Layout::onCloseEvent | ( | CloseEvent * | e | ) |
Definition at line 355 of file Layout.cpp.
References groups().
int Layout::placeholderCount | ( | ) | const |
Returns the number of placeholder items in this layout. This is the same as count minus visibleCount.
Definition at line 219 of file Layout.cpp.
References count(), and visibleCount().
Referenced by c_KDDockWidgets__Core__Layout__placeholderCount().
void Layout::removeItem | ( | Core::Item * | item | ) |
Removes an item from this MultiSplitter.
Definition at line 269 of file Layout.cpp.
Referenced by c_KDDockWidgets__Core__Layout__removeItem_Item(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::Layout_wrapper::removeItem().
void Layout::restorePlaceholder | ( | Core::DockWidget * | dw, |
Core::Item * | item, | ||
int | tabIndex | ||
) |
restores the dockwidget dw
to its previous position
Definition at line 151 of file Layout.cpp.
References KDDockWidgets::Core::Group::fromItem(), and KDDockWidgets::Core::Controller::view().
Referenced by c_KDDockWidgets__Core__Layout__restorePlaceholder_DockWidget_Item_int(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::Layout_wrapper::restorePlaceholder().
Core::ItemContainer * Layout::rootItem | ( | ) | const |
Definition at line 350 of file Layout.cpp.
LayoutSaver::MultiSplitter Layout::serialize | ( | ) | const |
Definition at line 320 of file Layout.cpp.
References KDDockWidgets::Core::Group::fromItem(), and items().
Referenced by KDDockWidgets::Core::FloatingWindow::serialize().
|
protected |
setter for the minimum size minimumSize
Definition at line 122 of file Layout.cpp.
References layoutSize(), and setLayoutSize().
Referenced by KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::Layout_wrapper::setLayoutMinimumSize(), and updateSizeConstraints().
void Layout::setLayoutSize | ( | Size | size | ) |
setter for the contents size The "contents size" is just the size() of this layout. However, since resizing QWidgets is async and we need it to be sync. As sometimes adding widgets will increase the MultiSplitter size (due to widget's min-size constraints).
Definition at line 185 of file Layout.cpp.
References layoutSize(), KDDockWidgets::Core::View::resize(), KDDockWidgets::LayoutSaver::restoreInProgress(), KDDockWidgets::Core::Controller::size(), and KDDockWidgets::Core::Controller::view().
Referenced by KDDockWidgets::Core::DropArea::DropArea(), c_KDDockWidgets__Core__Layout__setLayoutSize_Size(), setLayoutMinimumSize(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::Layout_wrapper::setLayoutSize().
|
protected |
Definition at line 101 of file Layout.cpp.
References count(), layoutMinimumSize(), KDDockWidgets::Core::View::setMinimumSize(), and KDDockWidgets::Core::Controller::view().
Referenced by KDDockWidgets::Core::MDILayout::MDILayout().
|
protected |
Removes unneeded placeholder items when adding new groups.
A floating group A might have a placeholder in the main window (for example to remember its position on the Left), but then the user might attach it to the right, so the left placeholder is no longer need. Right before adding the group to the right we remove the left placeholder, otherwise it's unrefed while we're adding causing a segfault. So what this does is making the unrefing happen a bit earlier.
Definition at line 175 of file Layout.cpp.
Referenced by KDDockWidgets::Core::DropArea::addWidget().
void Layout::updateSizeConstraints | ( | ) |
Updates the min size of this layout.
Definition at line 279 of file Layout.cpp.
References setLayoutMinimumSize().
Referenced by KDDockWidgets::Core::DropArea::DropArea(), Layout(), c_KDDockWidgets__Core__Layout__updateSizeConstraints(), deserialize(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::Layout_wrapper::updateSizeConstraints().
void Layout::viewAboutToBeDeleted | ( | ) |
Definition at line 56 of file Layout.cpp.
References KDDockWidgets::Core::Controller::view().
Referenced by KDDockWidgets::flutter::DropArea::~DropArea(), KDDockWidgets::QtQuick::DropArea::~DropArea(), KDDockWidgets::QtWidgets::DropArea::~DropArea(), ~Layout(), KDDockWidgets::QtQuick::MDILayout::~MDILayout(), KDDockWidgets::QtWidgets::MDILayout::~MDILayout(), c_KDDockWidgets__Core__Layout__viewAboutToBeDeleted(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::Layout_wrapper::viewAboutToBeDeleted().
int Layout::visibleCount | ( | ) | const |
Returns the number of visible Items in this layout. Which is count minus placeholderCount.
Definition at line 214 of file Layout.cpp.
Referenced by KDDockWidgets::Core::DropArea::DropArea(), c_KDDockWidgets__Core__Layout__visibleCount(), KDDockWidgets::Core::DropArea::hasSingleGroup(), KDDockWidgets::Core::Group::isTheOnlyGroup(), and placeholderCount().