KDockWidget Class Reference
Floatable widget that can be dragged around with the mouse and encapsulate the actual widgets (and member of the dockwidget class set). More...
#include <kdockwidget.h>
Inheritance diagram for KDockWidget:

Public Types | |
enum | DockPosition { DockNone = 0, DockTop = 0x0001, DockLeft = 0x0002, DockRight = 0x0004, DockBottom = 0x0008, DockCenter = 0x0010, DockDesktop = 0x0020, DockToSpecialSites = 0x0040, DockCorner = DockTop | DockLeft | DockRight | DockBottom, DockFullSite = DockCorner | DockCenter, DockFullDocking = DockFullSite | DockDesktop } |
Public Slots | |
void | setForcedFixedWidth (int) |
void | setForcedFixedHeight (int) |
void | restoreFromForcedFixedSize () |
int | forcedFixedWidth () |
int | forcedFixedHeight () |
void | dockBack () |
void | changeHideShowState () |
void | undock () |
void | toDesktop () |
Signals | |
void | widgetSet (QWidget *) |
void | docking (KDockWidget *dw, KDockWidget::DockPosition dp) |
void | setDockDefaultPos () |
void | headerCloseButtonClicked () |
void | headerDockbackButtonClicked () |
void | iMBeingClosed () |
void | hasUndocked () |
Public Member Functions | |
KDockWidget (KDockManager *dockManager, const char *name, const QPixmap &pixmap, QWidget *parent=0L, const QString &strCaption=QString::null, const QString &strTabPageLabel=QString::fromLatin1(" "), WFlags f=0) | |
virtual | ~KDockWidget () |
KDockWidget * | manualDock (KDockWidget *target, DockPosition dockPos, int spliPos=50, QPoint pos=QPoint(0, 0), bool check=false, int tabIndex=-1) |
void | setEnableDocking (int pos) |
int | enableDocking () const |
void | setDockSite (int pos) |
int | dockSite () const |
void | setWidget (QWidget *w) |
QWidget * | getWidget () const |
void | setHeader (KDockWidgetAbstractHeader *ah) |
KDockWidgetAbstractHeader * | getHeader () |
void | makeDockVisible () |
bool | mayBeHide () const |
bool | mayBeShow () const |
KDockManager * | dockManager () const |
void | setToolTipString (const QString &ttStr) |
const QString & | toolTipString () const |
bool | isDockBackPossible () const |
void | setTabPageLabel (const QString &label) |
const QString & | tabPageLabel () const |
virtual bool | event (QEvent *) |
virtual void | show () |
KDockTabGroup * | parentDockTabGroup () const |
QWidget * | parentDockContainer () const |
void | setDockWindowType (NET::WindowType windowType) |
void | setDockWindowTransient (QWidget *parent, bool transientEnabled) |
QWidget * | transientTo () |
KDockWidget * | findNearestDockWidget (DockPosition pos) |
void | setPixmap (const QPixmap &pixmap=QPixmap()) |
const QPixmap & | pixmap () const |
Protected Slots | |
void | loseFormerBrotherDockWidget () |
virtual void | paintEvent (QPaintEvent *) |
virtual void | mousePressEvent (QMouseEvent *) |
virtual void | mouseReleaseEvent (QMouseEvent *) |
virtual void | mouseMoveEvent (QMouseEvent *) |
virtual void | leaveEvent (QEvent *) |
Protected Member Functions | |
void | updateHeader () |
void | setLatestKDockContainer (QWidget *) |
QWidget * | latestKDockContainer () |
void | setFormerBrotherDockWidget (KDockWidget *) |
virtual void | virtual_hook (int id, void *data) |
Protected Attributes | |
KDockWidget * | formerBrotherDockWidget |
DockPosition | currentDockPos |
DockPosition | formerDockPos |
QString | toolTipStr |
QString | tabPageTitle |
Detailed Description
Floatable widget that can be dragged around with the mouse and encapsulate the actual widgets (and member of the dockwidget class set).You just grip the double-lined panel, tear it off its parent widget, drag it somewhere and let it loose. Depending on the position where you leave it, the dockwidget becomes a toplevel window on the desktop (floating mode) or docks to a new widget (dock mode). Note: A KDockWidget can only be docked to a KDockWidget.
If you want to use this kind of widget, your main application window has to be a KDockMainWindow. That is because it has got several additional dock management features, for instance a KDockManager that has an overview over all dockwidgets and and a dockmovemanager (internal class) that handles the dock process.
Usually you create an KDockWidget that covers the actual widget in this way:
... KDockMainWindow* mainWidget; ... KDockWidget* dock = 0L; dock = mainWidget->createDockWidget( "Any window caption", nicePixmap, 0L, i18n("window caption")); // 0L==no parent QWidget* actualWidget = new QWidget( dock); dock->setWidget( actualWidget); // embed it dock->setToolTipString(i18n("That's me")); // available when appearing as tab page ...
See KDockMainWindow how a dockwidget is docked in.
- Author:
- Max Judin (documentation: Falk Brettschneider).
Definition at line 412 of file kdockwidget.h.
Member Enumeration Documentation
|
The possible positions where a dockwidget can dock to another dockwidget. Definition at line 448 of file kdockwidget.h. Referenced by manualDock(), and KDockManager::readConfig(). |
Constructor & Destructor Documentation
|
Construct a dockwidget.
Initially, docking to another and docking to this is allowed for every
References QObject::connect(), and QObject::installEventFilter(). Referenced by manualDock(). |
|
Destructs a dockwidget. Definition at line 548 of file kdockwidget.cpp. References KDockWidgetPrivate::blockHasUndockedSignal, KDockManager::childDock, KDockManager::d, iMBeingClosed(), latestKDockContainer(), KDockWidgetPrivate::pendingDtor, undock(), and KDockManager::undockProcess. |
Member Function Documentation
|
This is a key method of this class! Use it to dock dockwidgets to another dockwidget at the right position within its KDockMainWindow or a toplevel dockwidget. If the target is null, it will become a toplevel dockwidget at position pos; Note: Docking to another dockwidget means exactly: A new parent dockwidget will be created, that replaces the target dockwidget and contains another single helper widget (tab widget or panner) which contains both dockwidgets, this and the target dockwidget. So consider parent<->child relationships change completely during such actions.
References KDockSplitter::activate(), applyToWidget(), KDockWidgetPrivate::blockHasUndockedSignal, KDockManager::change(), QObject::connect(), currentDockPos, KDockManager::d, KDockSplitter::deactivate(), docking(), dockManager(), DockPosition, eDocking, formerBrotherDockWidget, formerDockPos, QWidget::frameGeometry(), QWidget::geometry(), KDockSplitter::getFirst(), QWidget::icon(), QTabWidget::insertTab(), QString::isEmpty(), isGroup, isTabGroup, KDockWidget(), latestKDockContainer(), loseFormerBrotherDockWidget(), QWidget::move(), parentDockContainer(), parentDockTabGroup(), QWidget::parentWidget(), KDockManager::replaceDock(), QWidget::resize(), sDocking, setDockWindowTransient(), QWidget::setFocusPolicy(), setFormerBrotherDockWidget(), QWidget::setGeometry(), KDockSplitter::setKeepSize(), setLatestKDockContainer(), KDockSplitter::setOpaqueResize(), QTabWidget::setTabToolTip(), setWidget(), QWidget::show(), show(), KDockManager::splitterHighResolution(), KDockManager::splitterKeepSize(), KDockManager::splitterOpaqueResize(), tabPageLabel(), toolTipStr, toolTipString(), KDockTabGroup::transientTo(), undock(), and widget. Referenced by dockBack(), KDockManager::readConfig(), and toDesktop(). |
|
Specify where it is either possible or impossible for this to dock to another dockwidget.
References updateHeader(). Referenced by setHeader(). |
|
|
|
Specify where it is either possible or impossible for another dockwidget to dock to this.
|
|
Referenced by isDockBackPossible(). |
|
Sets the embedded widget. A QLayout takes care about proper resizing, automatically.
References KDockManager::d, KDockWidgetPrivate::isContainer, QWidget::ownCursor(), QWidget::reparent(), QWidget::setCursor(), updateHeader(), and widgetSet(). Referenced by manualDock(), and setHeader(). |
|
Get the embedded widget.
Referenced by findNearestDockWidget(), and KDockManager::readConfig(). |
|
Sets the header of this dockwidget. A QLayout takes care about proper resizing, automatically. The header contains the drag panel, the close button and the stay button.
References QWidget::caption(), endl(), kdDebug(), setEnableDocking(), and setWidget(). |
|
Definition at line 737 of file kdockwidget.cpp. |
|
Normally it simply shows the dockwidget.
But additionally, if it is docked to a tab widget ( References dockBack(), QWidget::isVisible(), parentDockContainer(), parentDockTabGroup(), QWidget::parentWidget(), show(), QWidget::show(), and QTabWidget::showPage(). Referenced by changeHideShowState(), dockBack(), KDockMainWindow::makeDockVisible(), and show(). |
|
References QWidget::isVisible(), and KDockManager::main. Referenced by changeHideShowState(). |
|
References QWidget::isVisible(), and KDockManager::main. Referenced by changeHideShowState(). |
|
Referenced by manualDock(). |
|
Stores a string for a tooltip. That tooltip string has only a meaning when this dockwidget is shown as tab page. In this case the tooltip is shown when one holds the mouse cursor on the tab page header. Such tooltip will for instance be useful, if you use only icons there. Note: Setting an empty string switches the tooltip off.
Referenced by KDockManager::readConfig(). |
|
Referenced by manualDock(), and KDockManager::writeConfig(). |
|
References dockSite(), formerBrotherDockWidget, and formerDockPos. Referenced by KDockWidgetHeader::setTopLevel(). |
|
Sets a string that is used for the label of the tab page when in tab page mode.
Referenced by KDockManager::readConfig(). |
|
Referenced by event(), manualDock(), and KDockManager::writeConfig(). |
|
Catches and processes some QWidget events that are interesting for dockwidgets.
Reimplemented from QWidget. Definition at line 874 of file kdockwidget.cpp. References KDockManager::change(), QWidget::event(), QWidget::hide(), iMBeingClosed(), parentDockTabGroup(), QWidget::parentWidget(), KDockWidgetPrivate::pendingFocusInEvent, QWidget::setFocus(), QTabWidget::setTabLabel(), QWidget::show(), and tabPageLabel(). |
|
Add dockwidget management actions to QWidget::show.
Reimplemented from QWidget. Definition at line 837 of file kdockwidget.cpp. References QWidget::isVisible(), KDockManager::main, makeDockVisible(), setDockDefaultPos(), KDockManager::setDockDefaultPos(), and QWidget::show(). Referenced by KDockManager::activate(), makeDockVisible(), manualDock(), KDockManager::readConfig(), and undock(). |
|
References QWidget::parentWidget(). Referenced by KDockManager::activate(), event(), makeDockVisible(), manualDock(), setPixmap(), and undock(). |
|
Definition at line 1204 of file kdockwidget.cpp. References QWidget::parentWidget(). Referenced by makeDockVisible(), manualDock(), and setPixmap(). |
|
Sets the type of the dock window.
References QWidget::parentWidget(), and KDockWidgetPrivate::windowType. |
|
Returns the widget this dockwidget is set transient to, otherwise 0
Definition at line 870 of file kdockwidget.cpp. References KDockWidgetPrivate::_parent, and KDockWidgetPrivate::transient. |
|
Lookup the nearest dockwidget docked left/right/top/bottom to this one or return 0.
References getWidget(). |
|
Allows changing the pixmap which is used for the caption or dock tabs.
References QTabWidget::changeTab(), parentDockContainer(), parentDockTabGroup(), QWidget::setIcon(), and QTabWidget::tabLabel(). |
|
Returns the dockwidget's associated caption/dock tab pixmap.
|
|
subject to changes. It doesn't completely work yet without small hacks from within the calling application (Perhaps KDE 3.1.x oder 3.2 width is in pixel. It only affects a widget, which is placed directly into a horizontal KDockSplitter
References KDockWidgetPrivate::forcedWidth, and QWidget::setFixedWidth(). |
|
subject to changes. It doesn't completely work yet without small hacks from within the calling application (Perhaps KDE 3.1.x oder 3.2 height is in pixel. It only affects a widget, which is placed directly into a vertical KDockSplitter
References KDockWidgetPrivate::forcedHeight, and QWidget::setFixedHeight(). |
|
Definition at line 1241 of file kdockwidget.cpp. References KDockWidgetPrivate::forcedWidth, QWidget::setMaximumHeight(), QWidget::setMaximumWidth(), QWidget::setMinimumHeight(), and QWidget::setMinimumWidth(). |
|
Definition at line 1231 of file kdockwidget.cpp. References KDockWidgetPrivate::forcedWidth. |
|
Definition at line 1236 of file kdockwidget.cpp. References KDockWidgetPrivate::forcedHeight. |
|
Docks a dockwidget back to the dockwidget that was the neighbor widget before the current dock position. Definition at line 1548 of file kdockwidget.cpp. References formerBrotherDockWidget, formerDockPos, KDockWidgetPrivate::index, KDockManager::main, makeDockVisible(), manualDock(), and KDockWidgetPrivate::splitPosInPercent. Referenced by KDockManager::eventFilter(), and makeDockVisible(). |
|
Toggles the visibility state of the dockwidget if it is able to be shown or to be hidden. Definition at line 1490 of file kdockwidget.cpp. References KDockManager::main, makeDockVisible(), mayBeHide(), mayBeShow(), and undock(). |
|
|
Docks the widget to the desktop (as a toplevel widget)
Definition at line 1253 of file kdockwidget.cpp. References manualDock(), QWidget::mapToGlobal(), QPoint::setX(), QPoint::setY(), QPoint::x(), and QPoint::y(). Referenced by KDockManager::eventFilter(). |
|
Checks some conditions and shows or hides the dockwidget header (drag panel). The header is hidden if:
References KDockManager::main, QWidget::setCursor(), QWidget::setMouseTracking(), KDockWidgetAbstractHeader::setTopLevel(), and QWidget::style(). Referenced by KDockManager::readConfig(), setEnableDocking(), and setWidget(). |
|
Definition at line 717 of file kdockwidget.cpp. References KDockWidgetPrivate::container. Referenced by manualDock(). |
|
Definition at line 728 of file kdockwidget.cpp. References KDockWidgetPrivate::container. Referenced by manualDock(), and ~KDockWidget(). |
|
Definition at line 1531 of file kdockwidget.cpp. References QObject::connect(), formerBrotherDockWidget, iMBeingClosed(), and loseFormerBrotherDockWidget(). Referenced by manualDock(), KDockManager::readConfig(), and undock(). |
|
Referenced by setWidget(). |
|
Emitted when another dock widget is docking to this.
Referenced by manualDock(). |
|
Signals that the dock default position is set.
Referenced by show(). |
|
Emitted when the close button of the panel ( KDockWidgetHeader) has been clicked.
|
|
Emitted when the dockback button of the panel ( KDockWidgetHeader) has been clicked.
|
|
Emitted when the widget processes a close event.
Referenced by event(), loseFormerBrotherDockWidget(), setFormerBrotherDockWidget(), undock(), and ~KDockWidget(). |
|
Emitted when the widget has undocked.
Referenced by undock(). |
|
Does several things here when it has noticed that the former brother widget (closest neighbor) gets lost. The former brother widget is needed for a possible dockback action, to speak with the Beatles: "To get back to where you once belonged" ;-) Definition at line 1539 of file kdockwidget.cpp. References QObject::disconnect(), formerBrotherDockWidget, iMBeingClosed(), and QWidget::repaint(). Referenced by manualDock(), and setFormerBrotherDockWidget(). |
Member Data Documentation
|
earlier closest neighbor widget, so it's possible to dock back to it. Definition at line 786 of file kdockwidget.h. Referenced by dockBack(), isDockBackPossible(), loseFormerBrotherDockWidget(), manualDock(), setFormerBrotherDockWidget(), and KDockManager::writeConfig(). |
|
the current dock position. Definition at line 790 of file kdockwidget.h. Referenced by KDockManager::eventFilter(), manualDock(), and undock(). |
|
the former dock position when it really was at another position before. Definition at line 794 of file kdockwidget.h. Referenced by dockBack(), isDockBackPossible(), manualDock(), KDockManager::readConfig(), undock(), and KDockManager::writeConfig(). |
|
a string used as tooltip for the tab page header when in dock-centered mode. Definition at line 798 of file kdockwidget.h. Referenced by manualDock(). |
|
a string used as title of the tab page when in tab page mode Definition at line 802 of file kdockwidget.h. |
The documentation for this class was generated from the following files: