KDDockWidgets API Documentation 2.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
KDDockWidgets::DockRegistry Class Reference

#include <DockRegistry.h>

Inheritance diagram for KDDockWidgets::DockRegistry:
Inheritance graph
[legend]
Collaboration diagram for KDDockWidgets::DockRegistry:
Collaboration graph
[legend]

Public Types

enum class  DockByNameFlag { None = 0 , ConsultRemapping = 1 , CreateIfNotFound }
 

Public Member Functions

 ~DockRegistry ()
 
bool affinitiesMatch (const Vector< QString > &affinities1, const Vector< QString > &affinities2) const
 
void checkSanityAll (bool dumpDebug=false)
 Calls Layout::checkSanity() on all layouts.
 
void clear (const Vector< Core::DockWidget * > &dockWidgets, const Vector< Core::MainWindow * > &mainWindows, const Vector< QString > &affinities)
 clear Overload that only clears the specified dockWidgets and main windows.
 
Q_INVOKABLE void clear (const Vector< QString > &affinities={})
 Closes all dock widgets, and destroys all FloatingWindows This is called before restoring a layout.
 
Vector< Core::DockWidget * > closedDockwidgets (bool honourSkipped) const
 returns all closed DockWidget instances
 
Q_INVOKABLE bool containsDockWidget (const QString &uniqueName) const
 
Q_INVOKABLE bool containsMainWindow (const QString &uniqueName) const
 
Q_INVOKABLE KDDockWidgets::Core::DockWidgetdockByName (const QString &, KDDockWidgets::DockRegistry::DockByNameFlags={}) const
 
Vector< QStringdockWidgetNames () const
 Returns a list of all known dock widget unique names.
 
Vector< Core::DockWidget * > dockwidgets () const
 returns all DockWidget instances
 
Vector< Core::DockWidget * > dockWidgets (const Vector< QString > &names)
 overload returning only the ones with the specified names
 
Private * dptr () const
 
void ensureAllFloatingWidgetsAreMorphed ()
 Ensures that all floating DockWidgets have a FloatingWindow as a window.
 
Vector< std::shared_ptr< Core::Window > > floatingQWindows () const
 overload that returns list of QWindow. This is more friendly for supporting both QtWidgets and QtQuick
 
Core::FloatingWindowfloatingWindowForHandle (Core::WId hwnd) const
 returns the FloatingWindow with handle hwnd
 
Core::FloatingWindowfloatingWindowForHandle (std::shared_ptr< Core::Window > windowHandle) const
 returns the FloatingWindow with handle windowHandle
 
Vector< Core::FloatingWindow * > floatingWindows (bool includeBeingDeleted=false, bool honourSkipped=false) const
 returns all FloatingWindow instances. Not necessarily all floating dock widgets, As there might be DockWidgets which weren't morphed yet.
 
Q_INVOKABLE KDDockWidgets::Core::DockWidgetfocusedDockWidget () const
 
Core::GroupgroupInMDIResize () const
 Returns the Group which is being resized in a MDI layout. nullptr if none.
 
Vector< Core::Group * > groups () const
 returns a list of all Frame instances
 
Q_INVOKABLE bool hasFloatingWindows () const
 returns whether if there's at least one floating window
 
bool isEmpty (bool excludeBeingDeleted=false) const
 returns true if there's 0 dockwidgets, 0 main windows
 
bool isProbablyObscured (std::shared_ptr< Core::Window > target, Core::FloatingWindow *exclude) const
 returns if the specified window has some other window on top (with higher Z) This is an approximation, as we don't have ways to compare Z, so we mostly intersect geometries.
 
bool isProbablyObscured (std::shared_ptr< Core::Window > target, Core::WindowBeingDragged *exclude) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool isSane () const
 
bool itemIsInMainWindow (const Core::Item *) const
 Returns whether the item is in a main window. Nesting is honoured. (MDIArea inside DropArea inside MainWindow, for example)
 
Core::LayoutlayoutForItem (const Core::Item *) const
 Returns the Layout where the specified item is in.
 
Vector< Core::Layout * > layouts () const
 returns the list of Layout instances
 
Vector< Core::MainWindowViewInterface * > mainDockingAreas () const
 returns all MainWindow instances Like mainwindows(), but with better suited for QtQuick and better terminology as we're phasing out the "MainWindow" name there
 
Q_INVOKABLE KDDockWidgets::Core::MainWindowmainWindowByName (const QString &) const
 
Core::MainWindowmainWindowForHandle (std::shared_ptr< Core::Window > windowHandle) const
 returns the MainWindow with handle windowHandle
 
Vector< Core::MainWindow * > mainwindows () const
 returns all MainWindow instances
 
Vector< Core::MainWindow * > mainWindows (const Vector< QString > &names)
 overload returning only the ones with the specified names
 
Vector< QStringmainWindowsNames () const
 Returns a list of all known main window unique names.
 
Vector< Core::MainWindow * > mainWindowsWithAffinity (const Vector< QString > &affinities) const
 Returns all main windows which match at least one of the affinities.
 
void registerDockWidget (Core::DockWidget *)
 
void registerFloatingWindow (Core::FloatingWindow *)
 
void registerGroup (Core::Group *)
 
void registerLayout (Core::Layout *)
 
void registerLayoutSaver ()
 
void registerMainWindow (Core::MainWindow *)
 
Core::SideBarsideBarForDockWidget (const Core::DockWidget *) const
 Overload that returns the SideBar itself.
 
SideBarLocation sideBarLocationForDockWidget (const Core::DockWidget *) const
 Returns whether the specified 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.
 
Vector< std::shared_ptr< Core::Window > > topLevels (bool excludeFloatingDocks=false) const
 Returns the list with all visiblye top-level parents of our FloatingWindow and MainWindow instances.
 
void unregisterDockWidget (Core::DockWidget *)
 
void unregisterFloatingWindow (Core::FloatingWindow *)
 
void unregisterGroup (Core::Group *)
 
void unregisterLayout (Core::Layout *)
 
void unregisterLayoutSaver ()
 
void unregisterMainWindow (Core::MainWindow *)
 
- Public Member Functions inherited from KDDockWidgets::Core::EventFilterInterface
 EventFilterInterface ()=default
 
 EventFilterInterface (const EventFilterInterface &)=delete
 
virtual ~EventFilterInterface ()
 
virtual bool onDnDEvent (View *, Event *)
 Override to handle drag enter, drag leave, drag move and drop events.
 
virtual bool onExposeEvent (std::shared_ptr< Window >)
 Override to handle expose events for a certain window.
 
virtual bool onMouseButtonMove (View *, MouseEvent *)
 Override to handle when a view receives a mouse press event.
 
virtual bool onMouseButtonRelease (View *, MouseEvent *)
 Override to handle when a view receives a mouse press event.
 
virtual bool onMouseDoubleClick (View *, MouseEvent *)
 Override to handle when a view receives a mouse double click event.
 
virtual bool onMouseEvent (View *, MouseEvent *)
 Provided for convenience, aggregates all other overloads receives all mouse event types, if you return true here then the specialized counterparts won't be called Example, if true is returned here for a mouse press, then onMouseButtonPress() won't be called.
 
virtual bool onMoveEvent (View *)
 Override to handle a move event.
 
EventFilterInterfaceoperator= (const EventFilterInterface &)=delete
 

Static Public Member Functions

static DockRegistryself ()
 

Detailed Description

Definition at line 48 of file DockRegistry.h.

Member Enumeration Documentation

◆ DockByNameFlag

Enumerator
None 
ConsultRemapping 
CreateIfNotFound 

Creates the dock widget via the user's widget factory in case it doesn't exist.

Definition at line 53 of file DockRegistry.h.

Constructor & Destructor Documentation

◆ ~DockRegistry()

DockRegistry::~DockRegistry ( )

Member Function Documentation

◆ affinitiesMatch()

bool DockRegistry::affinitiesMatch ( const Vector< QString > &  affinities1,
const Vector< QString > &  affinities2 
) const

◆ checkSanityAll()

void DockRegistry::checkSanityAll ( bool  dumpDebug = false)

Calls Layout::checkSanity() on all layouts.

Parameters
dumpDebugIf true then each layout is dumped too

This is called by the unit-tests. If during this the framework throws an error then the app will qFatal()

Definition at line 144 of file DockRegistry.cpp.

Referenced by c_KDDockWidgets__DockRegistry__checkSanityAll_bool(), and KDDockWidgetsBindings_wrappersNS::DockRegistry_wrapper::checkSanityAll().

◆ clear() [1/2]

void KDDockWidgets::DockRegistry::clear ( const Vector< Core::DockWidget * > &  dockWidgets,
const Vector< Core::MainWindow * > &  mainWindows,
const Vector< QString > &  affinities 
)

clear Overload that only clears the specified dockWidgets and main windows.

◆ clear() [2/2]

void DockRegistry::clear ( const Vector< QString > &  affinities = {})

Closes all dock widgets, and destroys all FloatingWindows This is called before restoring a layout.

Parameters
affinitiesif specified only closes dock widgets and main windows with the specified affinities

Definition at line 676 of file DockRegistry.cpp.

References clear().

Referenced by c_KDDockWidgets__DockRegistry__clear(), KDDockWidgetsBindings_wrappersNS::DockRegistry_wrapper::clear(), and clear().

◆ closedDockwidgets()

DockWidget::List DockRegistry::closedDockwidgets ( bool  honourSkipped) const

returns all closed DockWidget instances

Parameters
honourSkippedIf true, won't include dock widgets with LayoutSaverOption::Skip

Definition at line 528 of file DockRegistry.cpp.

References KDDockWidgets::Core::Controller::isVisible(), KDDockWidgets::Core::DockWidget::layoutSaverOptions(), KDToolBox::StlContainerAdaptor::StdVectorAdaptor< T, Args >::reserve(), and KDDockWidgets::Skip.

◆ containsDockWidget()

bool DockRegistry::containsDockWidget ( const QString uniqueName) const

Definition at line 407 of file DockRegistry.cpp.

References dockByName().

Referenced by c_KDDockWidgets__DockRegistry__containsDockWidget_QString().

◆ containsMainWindow()

bool DockRegistry::containsMainWindow ( const QString uniqueName) const

◆ dockByName()

Core::DockWidget * DockRegistry::dockByName ( const QString ,
KDDockWidgets::DockRegistry::DockByNameFlags  = {} 
) const

◆ dockWidgetNames()

Vector< QString > DockRegistry::dockWidgetNames ( ) const

Returns a list of all known dock widget unique names.

Definition at line 179 of file DockRegistry.cpp.

References KDToolBox::StlContainerAdaptor::StdVectorAdaptor< T, Args >::reserve(), and KDDockWidgets::Core::DockWidget::uniqueName().

◆ dockwidgets()

Core::DockWidget::List DockRegistry::dockwidgets ( ) const

returns all DockWidget instances

Definition at line 497 of file DockRegistry.cpp.

Referenced by KDDockWidgets::Debug::DebugWindow::DebugWindow(), and KDDockWidgets::LayoutSaver::restoredDockWidgets().

◆ dockWidgets()

Core::DockWidget::List DockRegistry::dockWidgets ( const Vector< QString > &  names)

◆ dptr()

DockRegistry::Private * DockRegistry::dptr ( ) const

◆ ensureAllFloatingWidgetsAreMorphed()

void DockRegistry::ensureAllFloatingWidgetsAreMorphed ( )

Ensures that all floating DockWidgets have a FloatingWindow as a window.

This is to simplify things before saving a layout. So we don't have to care about the case where the window is a DockWidget.

Definition at line 700 of file DockRegistry.cpp.

References KDDockWidgets::Core::DockWidget::d, KDDockWidgets::Core::Controller::isVisible(), KDDockWidgets::Core::View::rootView(), and KDDockWidgets::Core::Controller::view().

Referenced by c_KDDockWidgets__DockRegistry__ensureAllFloatingWidgetsAreMorphed(), and KDDockWidgetsBindings_wrappersNS::DockRegistry_wrapper::ensureAllFloatingWidgetsAreMorphed().

◆ floatingQWindows()

Window::List DockRegistry::floatingQWindows ( ) const

◆ floatingWindowForHandle() [1/2]

Core::FloatingWindow * DockRegistry::floatingWindowForHandle ( Core::WId  hwnd) const

returns the FloatingWindow with handle hwnd

Definition at line 622 of file DockRegistry.cpp.

References KDDockWidgets::Core::Controller::view(), and KDDockWidgets::Core::View::window().

◆ floatingWindowForHandle() [2/2]

Core::FloatingWindow * KDDockWidgets::DockRegistry::floatingWindowForHandle ( std::shared_ptr< Core::Window >  windowHandle) const

returns the FloatingWindow with handle windowHandle

◆ floatingWindows()

Vector< Core::FloatingWindow * > DockRegistry::floatingWindows ( bool  includeBeingDeleted = false,
bool  honourSkipped = false 
) const

returns all FloatingWindow instances. Not necessarily all floating dock widgets, As there might be DockWidgets which weren't morphed yet.

Definition at line 571 of file DockRegistry.cpp.

References KDDockWidgets::Core::FloatingWindow::allDockWidgetsHave(), KDDockWidgets::Core::FloatingWindow::beingDeleted(), KDToolBox::StlContainerAdaptor::StdVectorAdaptor< T, Args >::reserve(), and KDDockWidgets::Skip.

Referenced by KDDockWidgets::Debug::DebugWindow::DebugWindow().

◆ focusedDockWidget()

Core::DockWidget * DockRegistry::focusedDockWidget ( ) const

Definition at line 402 of file DockRegistry.cpp.

Referenced by c_KDDockWidgets__DockRegistry__focusedDockWidget().

◆ groupInMDIResize()

Core::Group * DockRegistry::groupInMDIResize ( ) const

Returns the Group which is being resized in a MDI layout. nullptr if none.

Definition at line 254 of file DockRegistry.cpp.

References groups(), and KDDockWidgets::Core::Layout::groups().

Referenced by c_KDDockWidgets__DockRegistry__groupInMDIResize().

◆ groups()

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

returns a list of all Frame instances

Definition at line 566 of file DockRegistry.cpp.

Referenced by groupInMDIResize().

◆ hasFloatingWindows()

bool DockRegistry::hasFloatingWindows ( ) const

returns whether if there's at least one floating window

Definition at line 606 of file DockRegistry.cpp.

Referenced by c_KDDockWidgets__DockRegistry__hasFloatingWindows(), and isEmpty().

◆ isEmpty()

bool DockRegistry::isEmpty ( bool  excludeBeingDeleted = false) const

returns true if there's 0 dockwidgets, 0 main windows

Parameters
excludeBeingDeletedif true, any window currently being deleted won't count

Definition at line 136 of file DockRegistry.cpp.

References hasFloatingWindows().

Referenced by c_KDDockWidgets__DockRegistry__isEmpty_bool().

◆ isProbablyObscured() [1/2]

bool KDDockWidgets::DockRegistry::isProbablyObscured ( std::shared_ptr< Core::Window >  target,
Core::FloatingWindow exclude 
) const

returns if the specified window has some other window on top (with higher Z) This is an approximation, as we don't have ways to compare Z, so we mostly intersect geometries.

Parameters
targetThe window which we want to know if it's probably obscured
excludeThis window should not be counted as an obscurer. (It's being dragged).

◆ isProbablyObscured() [2/2]

bool KDDockWidgets::DockRegistry::isProbablyObscured ( std::shared_ptr< Core::Window >  target,
Core::WindowBeingDragged *  exclude 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ isSane()

bool DockRegistry::isSane ( ) const

Definition at line 461 of file DockRegistry.cpp.

References QString::isEmpty().

Referenced by c_KDDockWidgets__DockRegistry__isSane().

◆ itemIsInMainWindow()

bool DockRegistry::itemIsInMainWindow ( const Core::Item *  item) const

Returns whether the item is in a main window. Nesting is honoured. (MDIArea inside DropArea inside MainWindow, for example)

Definition at line 298 of file DockRegistry.cpp.

References layoutForItem().

Referenced by c_KDDockWidgets__DockRegistry__itemIsInMainWindow_Item().

◆ layoutForItem()

Core::Layout * DockRegistry::layoutForItem ( const Core::Item *  item) const

Returns the Layout where the specified item is in.

Definition at line 293 of file DockRegistry.cpp.

References KDDockWidgets::Core::Layout::fromLayoutingHost().

Referenced by c_KDDockWidgets__DockRegistry__layoutForItem_Item(), and itemIsInMainWindow().

◆ layouts()

Vector< Core::Layout * > DockRegistry::layouts ( ) const

returns the list of Layout instances

Definition at line 561 of file DockRegistry.cpp.

Referenced by KDDockWidgets::Debug::DebugWindow::DebugWindow().

◆ mainDockingAreas()

Vector< Core::MainWindowViewInterface * > DockRegistry::mainDockingAreas ( ) const

returns all MainWindow instances Like mainwindows(), but with better suited for QtQuick and better terminology as we're phasing out the "MainWindow" name there

Definition at line 547 of file DockRegistry.cpp.

◆ mainWindowByName()

Core::MainWindow * DockRegistry::mainWindowByName ( const QString name) const

◆ mainWindowForHandle()

Core::MainWindow * DockRegistry::mainWindowForHandle ( std::shared_ptr< Core::Window >  windowHandle) const

returns the MainWindow with handle windowHandle

Definition at line 633 of file DockRegistry.cpp.

Referenced by KDDockWidgets::Core::FloatingWindow::serialize().

◆ mainwindows()

Core::MainWindow::List DockRegistry::mainwindows ( ) const

◆ mainWindows()

Core::MainWindow::List DockRegistry::mainWindows ( const Vector< QString > &  names)

◆ mainWindowsNames()

Vector< QString > DockRegistry::mainWindowsNames ( ) const

Returns a list of all known main window unique names.

Definition at line 169 of file DockRegistry.cpp.

References KDToolBox::StlContainerAdaptor::StdVectorAdaptor< T, Args >::reserve().

◆ mainWindowsWithAffinity()

Core::MainWindow::List DockRegistry::mainWindowsWithAffinity ( const Vector< QString > &  affinities) const

Returns all main windows which match at least one of the affinities.

Definition at line 279 of file DockRegistry.cpp.

References affinitiesMatch(), and KDToolBox::StlContainerAdaptor::StdVectorAdaptor< T, Args >::reserve().

Referenced by hackFindParentHarder().

◆ registerDockWidget()

void DockRegistry::registerDockWidget ( Core::DockWidget dock)

◆ registerFloatingWindow()

void DockRegistry::registerFloatingWindow ( Core::FloatingWindow fw)

◆ registerGroup()

void DockRegistry::registerGroup ( Core::Group group)

◆ registerLayout()

void DockRegistry::registerLayout ( Core::Layout layout)

◆ registerLayoutSaver()

void DockRegistry::registerLayoutSaver ( )

◆ registerMainWindow()

void DockRegistry::registerMainWindow ( Core::MainWindow mainWindow)

◆ self()

DockRegistry * DockRegistry::self ( )
static

Definition at line 307 of file DockRegistry.cpp.

Referenced by KDDockWidgets::Debug::DebugWindow::DebugWindow(), KDDockWidgets::Core::DockWidget::DockWidget(), KDDockWidgets::Core::DropArea::DropArea(), KDDockWidgets::Core::DropIndicatorOverlay::DropIndicatorOverlay(), KDDockWidgets::Core::FloatingWindow::FloatingWindow(), KDDockWidgets::Core::Group::Group(), KDDockWidgets::Core::DockWidget::~DockWidget(), KDDockWidgets::Core::FloatingWindow::~FloatingWindow(), KDDockWidgets::Core::Group::~Group(), KDDockWidgets::Core::Layout::~Layout(), KDDockWidgets::Core::MainWindowViewInterface::addDockWidget(), KDDockWidgets::Core::MainWindowViewInterface::addDockWidgetAsTab(), KDDockWidgets::Core::DockWidget::addDockWidgetAsTab(), KDDockWidgets::Core::DockWidget::addDockWidgetToContainingWindow(), KDDockWidgets::Core::DockWidget::byName(), KDDockWidgets::DockWidgetInstantiator::componentComplete(), KDDockWidgets::MainWindowInstantiator::componentComplete(), KDDockWidgets::MainWindowMDIInstantiator::componentComplete(), deepestDropAreaInTopLevel(), KDDockWidgets::Core::Group::deserialize(), KDDockWidgets::Core::DockWidget::deserialize(), KDDockWidgets::Core::DropIndicatorOverlay::dropIndicatorVisible(), KDDockWidgets::QtWidgets::FloatingWindow::event(), hackFindParentHarder(), KDDockWidgets::QtWidgets::FloatingWindow::init(), KDDockWidgets::QtWidgets::TitleBar::init(), KDDockWidgets::Core::MainWindowViewInterface::layoutParentContainerEqually(), KDDockWidgets::Core::MainWindowViewInterface::moveToSideBar(), KDDockWidgets::Core::MainWindowViewInterface::moveToSideBar(), KDDockWidgets::Core::TitleBar::onAutoHideClicked(), KDDockWidgets::Core::MainWindowViewInterface::overlayOnSideBar(), KDDockWidgets::LayoutSaver::restoredDockWidgets(), KDDockWidgets::Core::MainWindowViewInterface::restoreFromSideBar(), KDDockWidgets::LayoutSaver::restoreLayout(), KDDockWidgets::Core::FloatingWindow::scheduleDeleteLater(), KDDockWidgets::Core::FloatingWindow::serialize(), KDDockWidgets::QtQuick::Platform::setQmlEngine(), KDDockWidgets::Core::DockWidget::sideBarLocation(), and KDDockWidgets::Core::MainWindowViewInterface::toggleOverlayOnSideBar().

◆ sideBarForDockWidget()

Core::SideBar * DockRegistry::sideBarForDockWidget ( const Core::DockWidget dw) const

Overload that returns the SideBar itself.

Definition at line 244 of file DockRegistry.cpp.

Referenced by c_KDDockWidgets__DockRegistry__sideBarForDockWidget_DockWidget(), and sideBarLocationForDockWidget().

◆ sideBarLocationForDockWidget()

SideBarLocation DockRegistry::sideBarLocationForDockWidget ( const Core::DockWidget dw) const

Returns whether the specified 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 236 of file DockRegistry.cpp.

References KDDockWidgets::None, and sideBarForDockWidget().

Referenced by KDDockWidgets::Core::DockWidget::sideBarLocation().

◆ topLevels()

Window::List DockRegistry::topLevels ( bool  excludeFloatingDocks = false) const

Returns the list with all visiblye top-level parents of our FloatingWindow and MainWindow instances.

Typically these are the FloatingWindows and MainWindows themselves. However, since a MainWindow can be embedded into another widget (for whatever reason, like a QWinWidget), it means that a top-level can be something else.

Every returned widget is either a FloatingWindow, MainWindow, or something that contains a MainWindow.

If excludeFloatingDocks is true then FloatingWindow won't be returned

Definition at line 646 of file DockRegistry.cpp.

References KDDockWidgets::Core::Controller::isVisible(), KDDockWidgets::Core::Controller::view(), and KDDockWidgets::Core::View::window().

◆ unregisterDockWidget()

void DockRegistry::unregisterDockWidget ( Core::DockWidget dock)

◆ unregisterFloatingWindow()

void DockRegistry::unregisterFloatingWindow ( Core::FloatingWindow fw)

◆ unregisterGroup()

void DockRegistry::unregisterGroup ( Core::Group group)

◆ unregisterLayout()

void DockRegistry::unregisterLayout ( Core::Layout layout)

◆ unregisterLayoutSaver()

void DockRegistry::unregisterLayoutSaver ( )

◆ unregisterMainWindow()

void DockRegistry::unregisterMainWindow ( Core::MainWindow mainWindow)

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