KDDockWidgets API Documentation  1.0.1
Public Member Functions | Protected Member Functions | List of all members
KDDockWidgets::DockWidget Class Reference

Represents a dock widget. More...

#include <DockWidget.h>

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

Public Member Functions

 DockWidget (const QString &uniqueName, Options options=DockWidgetBase::Options())
 constructs a new DockWidget More...
 
 ~DockWidget () override
 destructor
 
- Public Member Functions inherited from KDDockWidgets::DockWidgetBase
 DockWidgetBase (const QString &uniqueName, Options options=DockWidgetBase::Options())
 constructs a new DockWidget More...
 
 ~DockWidgetBase () override
 destructor
 
void addDockWidgetAsTab (DockWidgetBase *other, AddingOption addingOption=AddingOption_None)
 docks other widget into this one. Tabs will be shown if not already. More...
 
void addDockWidgetToContainingWindow (DockWidgetBase *other, KDDockWidgets::Location location, DockWidgetBase *relativeTo=nullptr)
 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. More...
 
QStringList affinities () const
 Returns the affinity name. Empty by default.
 
QActionfloatAction () const
 Returns the QAction that allows to dock/undock the dock widget Useful to put in menus.
 
void forceClose ()
 Like QWidget::close() but the hosted widget won't be asked if we should close.
 
QIcon icon () const
 Returns the dock widget's icon.
 
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 isMainWindow () const
 Returns whether widget() is a KDDockWidget::MainWindow. More...
 
bool isOpen () const
 Returns whether this dock widget is open. Equivalent to calling toggleAction().isChecked() or isVisible()
 
bool isTabbed () const
 returns if this dock widget is tabbed into another More...
 
Options options () const
 Returns the dock widget's options which control behaviour. More...
 
void raise ()
 Brings the dock widget to the front. More...
 
LayoutSaver::DockWidget::Ptr serialize () const
 Serializes this dock widget into an intermediate form.
 
void setAffinities (const QStringList &)
 Sets the affinity names. Dock widgets can only dock into dock widgets of the same affinity. More...
 
void setAffinityName (const QString &name)
 
void setAsCurrentTab ()
 Makes this dock widget current in its tab group.
 
void setFloating (bool floats)
 setter to make the dock widget float or dock. More...
 
void setIcon (const QIcon &icon)
 Sets an icon to show on title bars and tab bars. By default none is shown.
 
void setOptions (Options)
 Setter for the options. Only Option_NotClosable is allowed to change after construction. For the other options use the constructor only. More...
 
void setTitle (const QString &title)
 setter for the dock widget's title More...
 
void setWidget (QWidgetOrQuick *widget)
 sets the widget which this dock widget hosts. More...
 
void show ()
 Equivalent to QWidget::show(), but it's optimized to reduce flickering on some platforms.
 
QString title () const
 Returns the dock widget's title. This title is visible in title bars and tab bars. More...
 
TitleBar * titleBar () const
 Returns this dock widget's title bar. More...
 
QActiontoggleAction () const
 Returns the QAction that allows to hide/show the dock widget Useful to put in menus.
 
QString uniqueName () const
 the dock widget's unique name. More...
 
QWidgetOrQuickwidget () const
 returns the widget which this dock widget hosts
 

Protected Member Functions

void closeEvent (QCloseEvent *) override
 
bool event (QEvent *) override
 
- Protected Member Functions inherited from KDDockWidgets::DockWidgetBase
void onClosed (QCloseEvent *e)
 
void onHidden (bool spontaneous)
 
void onParentChanged ()
 
void onShown (bool spontaneous)
 

Additional Inherited Members

- Public Types inherited from KDDockWidgets::DockWidgetBase
typedef QVector< DockWidgetBase * > List
 
enum  Option { Option_None = 0, Option_NotClosable = 1, Option_NotDockable = 2 }
 DockWidget options to pass at construction time. More...
 
- Signals inherited from KDDockWidgets::DockWidgetBase
void hidden ()
 signal emitted when the DockWidget is hidden. As in QEvent::Hide.
 
void iconChanged ()
 signal emitted when the icon changed
 
void optionsChanged (KDDockWidgets::DockWidgetBase::Options)
 emitted when the options change More...
 
void parentChanged ()
 signal emitted when the parent changed
 
void shown ()
 signal emitted when the DockWidget is shown. As in QEvent::Show.
 
void titleChanged ()
 signal emitted when the title changed
 
void widgetChanged (KDDockWidgets::QWidgetOrQuick *)
 emitted when the hosted widget changed
 
- Static Public Member Functions inherited from KDDockWidgets::DockWidgetBase
static DockWidgetBasedeserialize (const LayoutSaver::DockWidget::Ptr &)
 Constructs a dock widget from its serialized form. More...
 

Detailed Description

Represents a dock widget.

Most of the interface lives in DockWidgetBase, to facilitate sharing with QtQuick.

Constructor & Destructor Documentation

KDDockWidgets::DockWidget::DockWidget ( const QString uniqueName,
Options  options = DockWidgetBase::Options() 
)
explicit

constructs a new DockWidget

Parameters
uniqueNameMandatory name that should be unique between all DockWidget instances. This name won't be user visible and just used internally for the save/restore. Use setTitle() for user visible text.
optionsoptional options controlling behaviour

There's no parent argument. The DockWidget is either parented to FloatingWindow or MainWindow when visible, or stays without a parent when hidden. This allows to support docking to different main windows.


Klarälvdalens Datakonsult AB (KDAB)
"The Qt Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/