class KDockWidget

Floatable widget that can be dragged around with the mouse and encapsulate the actual widgets (and member of the dockwidget class set). More...

Definition#include <kdockwidget.h>
InheritsQWidget (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Slots

Signals

Protected Methods

Protected Slots

Protected Members


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.

 KDockWidget ( KDockManager* dockManager, const char* name, const QPixmap &pixmap, QWidget* parent = 0L, const QString& strCaption = 0L, const QString& strTabPageLabel = " ", WFlags f = 0)

KDockWidget

Construct a dockwidget.

Initially, docking to another and docking to this is allowed for every DockPosition. It is supposed to be no (tab) group. It will taken under control of its dockmanager.

Parameters:
dockManagerThe responsible manager (dock helper)
nameObject instance name
pixmapAn icon (for instance shown when docked centered)
parentParent widget
strCaptionTitle of the dockwidget window (shown when toplevel)
strTabPageLabelThe title of the tab page (shown when in tab page mode), if it is "", only the icon will be shown, if it is 0L, the label is set to strCaption

 ~KDockWidget ()

~KDockWidget

[virtual]

Destructs a dockwidget.

enum DockPosition { DockNone = 0, DockTop = 0x0001, DockLeft = 0x0002, DockRight = 0x0004, DockBottom = 0x0008, DockCenter = 0x0010, DockDesktop= 0x0020, DockCorner = DockTop | DockLeft | DockRight | DockBottom, DockFullSite = DockCorner | DockCenter, DockFullDocking = DockFullSite | DockDesktop }

DockPosition

The possible positions where a dockwidget can dock to another dockwidget

KDockWidget*  manualDock ( KDockWidget* target, DockPosition dockPos, int spliPos = 50, QPoint pos = QPoint(0,0), bool check = false, int tabIndex = -1)

manualDock

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.

Parameters:
targetThe dockwidget to dock to
dockPosOne of the DockPositions this is going to dock to
spliPosThe split relation (in percent, or percent*100 in high resolution) between both dockwidgets, target and this
posThe dock position, mainly of interest for docking to the desktop (as toplevel dockwidget)
checkOnly for internal use;
tabIndexThe position index of the tab widget (when in tab page mode), -1 (default) means append

Returns: result The group dockwidget that replaces the target dockwidget and will be grandparent of target and this.

void  setEnableDocking ( int pos )

setEnableDocking

Specify where it is either possible or impossible for this to dock to another dockwidget.

Parameters:
posAn OR'ed set of DockPositions

int  enableDocking ()

enableDocking

Returns: Where it is either possible or impossible for this to dock to another dockwidget (an OR'ed set of DockPositions).

void  setDockSite ( int pos )

setDockSite

Specify where it is either possible or impossible for another dockwidget to dock to this.

Parameters:
posAn OR'ed set of DockPositions

int  dockSite ()

dockSite

Returns: There it is either possible or impossible for another dockwidget to dock to this (an OR'ed set of DockPositions).

void  setWidget ( QWidget* w)

setWidget

Set the embedded widget.

A QLayout takes care about proper resizing, automatically.

Parameters:
wThe pointer to the dockwidget's child widget.

QWidget*  getWidget ()

getWidget

Get the embedded widget.

Returns: The pointer to the dockwidget's child widget, 0L if there's no such child.

void  setHeader ( KDockWidgetAbstractHeader* ah)

setHeader

Set 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.

Parameters:
ahA base class pointer to the dockwidget header

void  makeDockVisible ()

makeDockVisible

Normally it simply shows the dockwidget.

But additionally, if it is docked to a tab widget (DockCenter), it is set as the active (visible) tab page.

bool  mayBeHide ()

mayBeHide

There are reasons that it's impossible:

Returns: If it may be possible to hide this.

bool  mayBeShow ()

mayBeShow

Returns: If it may be possible to show this. There are reasons that it's impossible:

KDockManager*  dockManager ()

dockManager

Returns: The dockmanager that is responsible for this.

void  setToolTipString (const QString& ttStr)

setToolTipString

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.

Parameters:
ttStrA string for the tooltip on the tab.

const QString&  toolTipString ()

toolTipString

Returns: The tooltip string being shown on the appropriate tab page header when in dock-centered mode.

bool  isDockBackPossible ()

isDockBackPossible

Returns: result true, if a dockback is possible, otherwise false.

void  setTabPageLabel ( const QString& label)

setTabPageLabel

Set a string that is used for the label of the tab page when in tab page mode

Parameters:
labelThe new tab page label.

const QString&  tabPageLabel ()

tabPageLabel

Returns: A string that is used for the label of the tab page when in tab page mode.

bool  event ( QEvent * )

event

[virtual]

Catches and processes some QWidget events that are interesting for dockwidgets.

Reimplemented from QWidget.

void  show ()

show

[virtual]

Add dockwidget management actions to QWidget::show.

Reimplemented from QWidget.

KDockTabGroup*  parentDockTabGroup ()

parentDockTabGroup

Returns: the parent widget of this if it inherits class KDockTabGroup

void  setDockWindowType (NET::WindowType windowType)

setDockWindowType

Sets the type of the dock window

Parameters:
windowTypeis type of dock window

void  setDockWindowTransient (QWidget *parent, bool transientEnabled)

setDockWindowTransient

Sets the type of the dock window

Parameters:
windowTypeis type of dock window

void  dockBack ()

dockBack

[slot]

void  changeHideShowState ()

changeHideShowState

[slot]

Toggles the visibility state of the dockwidget if it is able to be shown or to be hidden.

void  undock ()

undock

[slot]

Undocks this. It means it becomes a toplevel widget framed by the system window manager. A small panel at the top of this undocked widget gives the possibility to drag it into another dockwidget by mouse (docking).

KDockTabGroup*  parentTabGroup ()

parentTabGroup

[protected]

Returns: the parent widget of this if it inherits class KDockTabGroup Warning: This will be removed in KDE-3.0. Use parentDockTabGroup instead.

void  updateHeader ()

updateHeader

[protected]

Check some conditions and show or hide the dockwidget header (drag panel). The header is hidden if:

void  docking ( KDockWidget* dw, KDockWidget::DockPosition dp)

docking

[signal]

Emits that another dockwidget is docking to this.

Parameters:
dwthe dockwidget that is docking to this
dpthe DockPosition where it wants to dock to

void  setDockDefaultPos ()

setDockDefaultPos

[signal]

Signals that the dock default position is set.

void  headerCloseButtonClicked ()

headerCloseButtonClicked

[signal]

Signals that the close button of the panel (KDockWidgetHeader) has been clicked.

void  headerDockbackButtonClicked ()

headerDockbackButtonClicked

[signal]

Signals that the dockback button of the panel (KDockWidgetHeader) has been clicked.

void  iMBeingClosed ()

iMBeingClosed

[signal]

Signals that the widget processes a close event.

void  hasUndocked ()

hasUndocked

[signal]

Signals that the widget is undocked now.

void  loseFormerBrotherDockWidget ()

loseFormerBrotherDockWidget

[protected slots slot]

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" ;-)

KDockWidget* formerBrotherDockWidget

formerBrotherDockWidget

[protected]

DockPosition currentDockPos

currentDockPos

[protected]

DockPosition formerDockPos

formerDockPos

[protected]

QString toolTipStr

toolTipStr

[protected]

QString tabPageTitle

tabPageTitle

[protected]