KDDockWidgets API Documentation 2.1
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
KDDockWidgets::Core::Layout Class Reference

The widget (QWidget or QQuickItem) which holds a layout of dock widgets. More...

#include <Layout.h>

Inheritance diagram for KDDockWidgets::Core::Layout:
Inheritance graph
[legend]
Collaboration diagram for KDDockWidgets::Core::Layout:
Collaboration graph
[legend]

Public Member Functions

 Layout (ViewType, View *)
 
 ~Layout ()
 
Core::DropAreaasDropArea () const
 
LayoutingHost * asLayoutingHost () const
 
Core::MDILayoutasMDILayout () 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::FloatingWindowfloatingWindow () 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::MainWindowmainWindow (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.
 
Viewview () const
 Returns the view associated with this controller, if any.
 
int width () const
 
std::shared_ptr< Viewwindow () const
 
int x () const
 
int y () const
 

Static Public Member Functions

static LayoutfromLayoutingHost (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
 

Detailed Description

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 56 of file Layout.h.

Constructor & Destructor Documentation

◆ Layout()

Layout::Layout ( ViewType  type,
View view 
)
explicit

◆ ~Layout()

Layout::~Layout ( )

Definition at line 46 of file Layout.cpp.

References viewAboutToBeDeleted().

Member Function Documentation

◆ asDropArea()

Core::DropArea * Layout::asDropArea ( ) const

◆ asLayoutingHost()

LayoutingHost * Layout::asLayoutingHost ( ) const

◆ asMDILayout()

MDILayout * Layout::asMDILayout ( ) const

◆ checkSanity()

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().

◆ clearLayout()

void Layout::clearLayout ( )

◆ containsGroup()

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().

◆ containsItem()

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().

◆ count()

int Layout::count ( ) const

Returns the number of Item objects in this layout. This includes non-visible (placeholder) Items too.

See also
visibleCount

Definition at line 209 of file Layout.cpp.

Referenced by c_KDDockWidgets__Core__Layout__count(), placeholderCount(), and setRootItem().

◆ d_ptr()

Layout::Private * Layout::d_ptr ( )

◆ deserialize()

bool Layout::deserialize ( const LayoutSaver::MultiSplitter &  l)
virtual

◆ dockWidgets()

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().

◆ dumpLayout()

void Layout::dumpLayout ( ) const

◆ floatingWindow()

Core::FloatingWindow * Layout::floatingWindow ( ) const

◆ fromLayoutingHost()

Layout * Layout::fromLayoutingHost ( LayoutingHost *  host)
static

static

Definition at line 396 of file Layout.cpp.

Referenced by KDDockWidgets::DockRegistry::layoutForItem().

◆ groups()

Core::Group::List Layout::groups ( ) const

◆ groupsFrom()

Core::Group::List Layout::groupsFrom ( View groupOrMultiSplitter) const
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().

◆ isInMainWindow()

bool Layout::isInMainWindow ( bool  honourNesting = false) const

Returns whether this layout is in a MainWindow.

Parameters
honourNestingIf 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().

◆ itemForGroup()

Core::Item * Layout::itemForGroup ( const Core::Group group) const

◆ items()

Core::Item::List Layout::items ( ) const

◆ layoutHeight()

int KDDockWidgets::Core::Layout::layoutHeight ( ) const
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().

◆ layoutMaximumSizeHint()

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().

◆ layoutMinimumSize()

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().

◆ layoutSize()

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().

◆ layoutWidth()

int KDDockWidgets::Core::Layout::layoutWidth ( ) const
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().

◆ mainWindow()

Core::MainWindow * Layout::mainWindow ( bool  honourNesting = false) const

◆ onCloseEvent()

void Layout::onCloseEvent ( CloseEvent *  e)

Definition at line 355 of file Layout.cpp.

References groups().

◆ placeholderCount()

int Layout::placeholderCount ( ) const

Returns the number of placeholder items in this layout. This is the same as count minus visibleCount.

See also
count, visibleCount

Definition at line 219 of file Layout.cpp.

References count(), and visibleCount().

Referenced by c_KDDockWidgets__Core__Layout__placeholderCount().

◆ removeItem()

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().

◆ restorePlaceholder()

void Layout::restorePlaceholder ( Core::DockWidget dw,
Core::Item *  item,
int  tabIndex 
)

◆ rootItem()

Core::ItemContainer * Layout::rootItem ( ) const

Definition at line 350 of file Layout.cpp.

◆ serialize()

LayoutSaver::MultiSplitter Layout::serialize ( ) const

◆ setLayoutMinimumSize()

void Layout::setLayoutMinimumSize ( Size  sz)
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().

◆ setLayoutSize()

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().

◆ setRootItem()

void Layout::setRootItem ( Core::ItemContainer *  root)
protected

◆ unrefOldPlaceholders()

void Layout::unrefOldPlaceholders ( const Vector< Core::Group * > &  groupsBeingAdded) const
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().

◆ updateSizeConstraints()

void Layout::updateSizeConstraints ( )

◆ viewAboutToBeDeleted()

void Layout::viewAboutToBeDeleted ( )

◆ visibleCount()

int Layout::visibleCount ( ) const

The documentation for this class was generated from the following files:

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated by doxygen 1.9.8