KDDockWidgets API Documentation 2.1
|
#include <DropArea.h>
Public Member Functions | |
DropArea (View *parent, MainWindowOptions options, bool isMDIWrapper=false) | |
~DropArea () | |
void | _addDockWidget (DockWidget *dw, KDDockWidgets::Location location, Item *relativeTo, const InitialOption &initialOption) |
void | addDockWidget (DockWidget *dw, KDDockWidgets::Location location, DockWidget *relativeTo, const InitialOption &initialOption={}) |
void | addMultiSplitter (Core::DropArea *splitter, KDDockWidgets::Location location, Core::Group *relativeToGroup=nullptr, const InitialOption &option=DefaultSizeMode::Fair) |
void | addWidget (View *widget, KDDockWidgets::Location location, Core::Item *relativeToItem=nullptr, const InitialOption &option=DefaultSizeMode::Fair) |
Adds a widget to this MultiSplitter. | |
Vector< QString > | affinities () const |
Core::Item * | centralFrame () const |
bool | containsDockWidget (DockWidget *) const |
DropLocation | currentDropLocation () const |
bool | deserialize (const LayoutSaver::MultiSplitter &) override |
bool | drop (WindowBeingDragged *droppedWindow, Point globalPos) |
Called when a user drops a widget via DND. | |
DropIndicatorOverlay * | dropIndicatorOverlay () const |
Vector< Core::Group * > | groups () const |
bool | hasSingleFloatingGroup () const |
bool | hasSingleGroup () const |
DropLocation | hover (WindowBeingDragged *draggedWindow, Point globalPos) |
bool | isMDIWrapper () const |
void | layoutEqually () |
See docs for MainWindowBase::layoutEqually() | |
void | layoutEqually (Core::ItemBoxContainer *) |
overload that just resizes widgets within a sub-tree | |
void | layoutParentContainerEqually (DockWidget *) |
Core::DockWidget * | mdiDockWidgetWrapper () const |
Returns the helper dock widget for implementing DockWidgetOption_MDINestable. | |
int | numSideBySide_recursive (Qt::Orientation) const |
Returns the number of items layed-out horizontally or vertically But honours nesting. | |
Rect | rectForDrop (const WindowBeingDragged *wbd, KDDockWidgets::Location location, const Core::Item *relativeTo) const |
void | removeHover () |
Core::ItemBoxContainer * | rootItem () const |
Vector< Core::LayoutingSeparator * > | separators () const |
returns the list of separators | |
Public Member Functions inherited from KDDockWidgets::Core::Layout | |
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 () |
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 Core::Group * | createCentralGroup (MainWindowOptions options) |
Static Public Member Functions inherited from KDDockWidgets::Core::Layout | |
static Layout * | fromLayoutingHost (LayoutingHost *) |
Additional Inherited Members | |
Protected Member Functions inherited from KDDockWidgets::Core::Layout | |
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) |
Protected Attributes inherited from KDDockWidgets::Core::Controller | |
bool | m_inDtor = false |
MultiSplitter is simply a wrapper around Core::Item in which the hosted widgets are of class KDDockWidgets::Frame. The stuff in Core:: being agnostic and generic, not specific to KDDW.
A MultiSplitter is like a QSplitter but supports mixing vertical and horizontal splitters in any combination.
It supports adding a widget to the left/top/bottom/right of the whole MultiSplitter or adding relative to a single widget.
Definition at line 54 of file core/DropArea.h.
|
explicit |
Definition at line 82 of file core/DropArea.cpp.
References addWidget(), KDDockWidgets::Core::Layout::asLayoutingHost(), KDDockWidgets::Core::Layout::d_ptr(), KDDockWidgets::Location_OnTop, mdiDockWidgetWrapper(), KDDockWidgets::Core::Layout::setLayoutSize(), KDDockWidgets::Core::View::size(), KDDockWidgets::Core::Layout::updateSizeConstraints(), and KDDockWidgets::Core::Layout::visibleCount().
DropArea::~DropArea | ( | ) |
Definition at line 119 of file core/DropArea.cpp.
void DropArea::_addDockWidget | ( | Core::DockWidget * | dw, |
KDDockWidgets::Location | location, | ||
Core::Item * | relativeToItem, | ||
const InitialOption & | initialOption | ||
) |
Definition at line 197 of file core/DropArea.cpp.
References KDDockWidgets::Core::Group::addTab(), addWidget(), containsDockWidget(), KDDockWidgets::Core::Group::containsDockWidget(), KDDockWidgets::Core::DockWidget::d, KDDockWidgets::Core::Group::hasSingleDockWidget(), hasSingleFloatingGroup(), KDDockWidgets::Location_None, KDDockWidgets::StartHidden, KDDockWidgets::InitialOption::startsHidden(), KDDockWidgets::Core::Controller::view(), and KDDockWidgets::InitialOption::visibility.
Referenced by KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DropArea_wrapper::_addDockWidget(), addDockWidget(), and c_KDDockWidgets__Core__DropArea___addDockWidget_DockWidget_Location_Item_InitialOption().
void DropArea::addDockWidget | ( | Core::DockWidget * | dw, |
KDDockWidgets::Location | location, | ||
Core::DockWidget * | relativeTo, | ||
const InitialOption & | initialOption = {} |
||
) |
Definition at line 184 of file core/DropArea.cpp.
References _addDockWidget(), KDDockWidgets::Core::DockWidget::d, KDDockWidgets::Core::Group::layoutItem(), and KDDockWidgets::Location_None.
Referenced by KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DropArea_wrapper::addDockWidget(), and c_KDDockWidgets__Core__DropArea__addDockWidget_DockWidget_Location_DockWidget_InitialOption().
void DropArea::addMultiSplitter | ( | Core::DropArea * | splitter, |
KDDockWidgets::Location | location, | ||
Core::Group * | relativeToGroup = nullptr , |
||
const InitialOption & | option = DefaultSizeMode::Fair |
||
) |
Adds an entire MultiSplitter into this layout. The donor MultiSplitter will be deleted after all its Frames are stolen. All added Frames will preserve their original layout, so, if widgetFoo was at the left of widgetBar when in the donor splitter, then it will still be at left of widgetBar when the whole splitter is dropped into this one.
Definition at line 634 of file core/DropArea.cpp.
References addWidget(), KDDockWidgets::Core::Group::layoutItem(), and KDDockWidgets::Core::Controller::view().
Referenced by KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DropArea_wrapper::addMultiSplitter(), and c_KDDockWidgets__Core__DropArea__addMultiSplitter_DropArea_Location_Group_InitialOption().
void DropArea::addWidget | ( | View * | widget, |
KDDockWidgets::Location | location, | ||
Core::Item * | relativeToItem = nullptr , |
||
const InitialOption & | option = DefaultSizeMode::Fair |
||
) |
Adds a widget to this MultiSplitter.
Definition at line 577 of file core/DropArea.cpp.
References KDDockWidgets::Core::View::asDockWidgetController(), KDDockWidgets::Core::View::asDropAreaController(), KDDockWidgets::Core::View::asGroupController(), KDDockWidgets::Core::Layout::asLayoutingHost(), groups(), KDDockWidgets::Core::Layout::groupsFrom(), KDDockWidgets::Core::Layout::itemForGroup(), KDDockWidgets::Core::Controller::setParentView(), KDDockWidgets::InitialOption::startsHidden(), and KDDockWidgets::Core::Layout::unrefOldPlaceholders().
Referenced by DropArea(), _addDockWidget(), addMultiSplitter(), KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DropArea_wrapper::addWidget(), and c_KDDockWidgets__Core__DropArea__addWidget_View_Location_Item_InitialOption().
Definition at line 268 of file core/DropArea.cpp.
References KDDockWidgets::Core::Layout::floatingWindow(), and KDDockWidgets::Core::Layout::mainWindow().
Core::Item * DropArea::centralFrame | ( | ) | const |
Definition at line 167 of file core/DropArea.cpp.
References KDDockWidgets::Core::Group::fromItem(), and KDDockWidgets::Core::Layout::items().
Referenced by c_KDDockWidgets__Core__DropArea__centralFrame().
bool DropArea::containsDockWidget | ( | Core::DockWidget * | dw | ) | const |
Definition at line 252 of file core/DropArea.cpp.
References KDDockWidgets::Core::Layout::containsGroup(), and KDDockWidgets::Core::DockWidget::d.
Referenced by _addDockWidget(), and c_KDDockWidgets__Core__DropArea__containsDockWidget_DockWidget().
|
static |
DropLocation DropArea::currentDropLocation | ( | ) | const |
Returns the current drop location The user needs to be dragging a window and be over a drop indicator, otherwise DropLocation_None is returned
Definition at line 720 of file core/DropArea.cpp.
References KDDockWidgets::DropLocation_None.
|
overridevirtual |
Reimplemented from KDDockWidgets::Core::Layout.
Definition at line 709 of file core/DropArea.cpp.
References KDDockWidgets::Core::Layout::asLayoutingHost(), and KDDockWidgets::Core::Layout::deserialize().
bool DropArea::drop | ( | WindowBeingDragged * | droppedWindow, |
Point | globalPos | ||
) |
Called when a user drops a widget via DND.
Definition at line 322 of file core/DropArea.cpp.
References drop(), KDDockWidgets::DropLocation_None, KDDockWidgets::Core::View::equals(), hover(), isOutterLocation(), and KDDockWidgets::Core::Controller::window().
Referenced by drop().
DropIndicatorOverlay * DropArea::dropIndicatorOverlay | ( | ) | const |
Definition at line 179 of file core/DropArea.cpp.
Referenced by c_KDDockWidgets__Core__DropArea__dropIndicatorOverlay(), and KDDockWidgets::flutter::DropArea::indicatorWindow().
Core::Group::List DropArea::groups | ( | ) | const |
Definition at line 127 of file core/DropArea.cpp.
References KDDockWidgets::Core::Group::fromItem(), and groups().
Referenced by addWidget(), groups(), and hasSingleFloatingGroup().
bool DropArea::hasSingleFloatingGroup | ( | ) | const |
Returns whether this layout has a single dock widget which is floating Implies it's in a FloatingWindow and that it has only one dock widget
Definition at line 257 of file core/DropArea.cpp.
References groups(), and KDToolBox::StlContainerAdaptor::StdVectorAdaptor< T, Args >::size().
Referenced by _addDockWidget(), and c_KDDockWidgets__Core__DropArea__hasSingleFloatingGroup().
bool DropArea::hasSingleGroup | ( | ) | const |
Returns whether this drop area has only 1 group. See further explanation in FloatingWindow::hasSingleGroup()
Definition at line 263 of file core/DropArea.cpp.
References KDDockWidgets::Core::Layout::visibleCount().
Referenced by c_KDDockWidgets__Core__DropArea__hasSingleGroup().
DropLocation DropArea::hover | ( | WindowBeingDragged * | draggedWindow, |
Point | globalPos | ||
) |
Definition at line 290 of file core/DropArea.cpp.
References KDDockWidgets::DropLocation_None, and KDDockWidgets::Config::self().
Referenced by drop().
bool DropArea::isMDIWrapper | ( | ) | const |
When DockWidgetOption_MDINestable is used, docked MDI dock widgets will be wrapped inside a DropArea, so they accept drops This DropArea is created implicitly while docking, and this function will return true
Definition at line 490 of file core/DropArea.cpp.
Referenced by c_KDDockWidgets__Core__DropArea__isMDIWrapper().
void DropArea::layoutEqually | ( | ) |
See docs for MainWindowBase::layoutEqually()
Definition at line 664 of file core/DropArea.cpp.
References KDDockWidgets::Core::Layout::checkSanity(), and layoutEqually().
Referenced by c_KDDockWidgets__Core__DropArea__layoutEqually(), layoutEqually(), KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DropArea_wrapper::layoutEqually(), and layoutParentContainerEqually().
void DropArea::layoutEqually | ( | Core::ItemBoxContainer * | container | ) |
overload that just resizes widgets within a sub-tree
Definition at line 672 of file core/DropArea.cpp.
void DropArea::layoutParentContainerEqually | ( | Core::DockWidget * | dw | ) |
Definition at line 279 of file core/DropArea.cpp.
References KDDockWidgets::Core::DockWidget::d, KDDockWidgets::Core::Layout::itemForGroup(), and layoutEqually().
Referenced by c_KDDockWidgets__Core__DropArea__layoutParentContainerEqually_DockWidget(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DropArea_wrapper::layoutParentContainerEqually().
Core::DockWidget * DropArea::mdiDockWidgetWrapper | ( | ) | const |
Returns the helper dock widget for implementing DockWidgetOption_MDINestable.
Definition at line 495 of file core/DropArea.cpp.
References KDDockWidgets::Core::View::parentView(), and KDDockWidgets::Core::Controller::view().
Referenced by DropArea(), and c_KDDockWidgets__Core__DropArea__mdiDockWidgetWrapper().
int DropArea::numSideBySide_recursive | ( | Qt::Orientation | o | ) | const |
Returns the number of items layed-out horizontally or vertically But honours nesting.
Definition at line 715 of file core/DropArea.cpp.
Rect DropArea::rectForDrop | ( | const WindowBeingDragged * | wbd, |
KDDockWidgets::Location | location, | ||
const Core::Item * | relativeTo | ||
) | const |
Called by the indicators, so they draw the drop rubber band at the correct place. The rect for the rubberband when dropping a widget at the specified location. Excludes the Separator thickness, result is actually smaller than what needed. In other words, the result will be exactly the same as the geometry the widget will get.
Definition at line 692 of file core/DropArea.cpp.
Referenced by KDDockWidgets::Core::ClassicDropIndicatorOverlay::setCurrentDropLocation().
void DropArea::removeHover | ( | ) |
Definition at line 466 of file core/DropArea.cpp.
Referenced by c_KDDockWidgets__Core__DropArea__removeHover(), and KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::DropArea_wrapper::removeHover().
Core::ItemBoxContainer * DropArea::rootItem | ( | ) | const |
Definition at line 687 of file core/DropArea.cpp.
Vector< Core::LayoutingSeparator * > DropArea::separators | ( | ) | const |
returns the list of separators
Definition at line 646 of file core/DropArea.cpp.