• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDE3Support

Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
K3DockWidget Class Reference

#include <k3dockwidget.h>

Inheritance diagram for K3DockWidget:
Inheritance graph
[legend]

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 changeHideShowState ()
 
void dockBack ()
 
int forcedFixedHeight ()
 
int forcedFixedWidth ()
 
void restoreFromForcedFixedSize ()
 
void setForcedFixedHeight (int)
 
void setForcedFixedWidth (int)
 
void toDesktop ()
 
void undock ()
 

Signals

void docking (K3DockWidget *dw, K3DockWidget::DockPosition dp)
 
void hasUndocked ()
 
void headerCloseButtonClicked ()
 
void headerDockbackButtonClicked ()
 
void iMBeingClosed ()
 
void setDockDefaultPos ()
 
void widgetSet (QWidget *)
 

Public Member Functions

 K3DockWidget (K3DockManager *dockManager, const char *name, const QPixmap &pixmap, QWidget *parent=0L, const QString &strCaption=QString(), const QString &strTabPageLabel=QLatin1String(" "), Qt::WindowFlags f=0)
 
virtual ~K3DockWidget ()
 
K3DockWidget::DockPosition currentDockPosition () const
 
K3DockManager * dockManager () const
 
int dockSite () const
 
int enableDocking () const
 
virtual bool event (QEvent *)
 
K3DockWidget * findNearestDockWidget (DockPosition pos)
 
K3DockWidgetAbstractHeader * getHeader ()
 
QWidget * getWidget () const
 
bool isDockBackPossible () const
 
void makeDockVisible ()
 
K3DockWidget * manualDock (K3DockWidget *target, DockPosition dockPos, int spliPos=50, QPoint pos=QPoint(0, 0), bool check=false, int tabIndex=-1)
 
bool mayBeHide () const
 
bool mayBeShow () const
 
QWidget * parentDockContainer () const
 
K3DockTabGroup * parentDockTabGroup () const
 
const QPixmap & pixmap () const
 
void setDockSite (int pos)
 
void setDockWindowTransient (QWidget *parent, bool transientEnabled)
 
void setDockWindowType (NET::WindowType windowType)
 
void setEnableDocking (int pos)
 
void setHeader (K3DockWidgetAbstractHeader *ah)
 
void setPixmap (const QPixmap &pixmap=QPixmap())
 
void setTabPageLabel (const QString &label)
 
void setToolTipString (const QString &ttStr)
 
void setWidget (QWidget *w)
 
virtual void show ()
 
const QString & tabPageLabel () const
 
const QString & toolTipString () const
 
QWidget * transientTo ()
 

Protected Slots

virtual void leaveEvent (QEvent *)
 
void loseFormerBrotherDockWidget ()
 
virtual void mouseMoveEvent (QMouseEvent *)
 
virtual void mousePressEvent (QMouseEvent *)
 
virtual void mouseReleaseEvent (QMouseEvent *)
 
virtual void paintEvent (QPaintEvent *)
 

Protected Member Functions

QWidget * latestK3DockContainer ()
 
void setFormerBrotherDockWidget (K3DockWidget *)
 
void setLatestK3DockContainer (QWidget *)
 
void updateHeader ()
 
virtual void virtual_hook (int id, void *data)
 

Protected Attributes

DockPosition currentDockPos
 
K3DockWidget * formerBrotherDockWidget
 
DockPosition formerDockPos
 
QString tabPageTitle
 
QString toolTipStr
 

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 K3DockWidget can only be docked to a K3DockWidget.

If you want to use this kind of widget, your main application window has to be a K3DockMainWindow. That is because it has got several additional dock management features, for instance a K3DockManager that has an overview over all dockwidgets and and a dockmovemanager (internal class) that handles the dock process.

Usually you create an K3DockWidget that covers the actual widget in this way:

...
K3DockMainWindow* mainWidget;
...
K3DockWidget* 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 K3DockMainWindow how a dockwidget is docked in.

Author
Max Judin (documentation: Falk Brettschneider).

Definition at line 415 of file k3dockwidget.h.

Member Enumeration Documentation

enum K3DockWidget::DockPosition

The possible positions where a dockwidget can dock to another dockwidget.

Enumerator
DockNone 
DockTop 
DockLeft 
DockRight 
DockBottom 
DockCenter 
DockDesktop 
DockToSpecialSites 
DockCorner 
DockFullSite 
DockFullDocking 

Definition at line 451 of file k3dockwidget.h.

Constructor & Destructor Documentation

K3DockWidget::K3DockWidget ( K3DockManager *  dockManager,
const char *  name,
const QPixmap &  pixmap,
QWidget *  parent = 0L,
const QString &  strCaption = QString(),
const QString &  strTabPageLabel = QLatin1String( " " ),
Qt::WindowFlags  f = 0 
)

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
fQt::WidgetFlags widget flags

Definition at line 534 of file k3dockwidget.cpp.

K3DockWidget::~K3DockWidget ( )
virtual

Destructs a dockwidget.

Definition at line 604 of file k3dockwidget.cpp.

Member Function Documentation

void K3DockWidget::changeHideShowState ( )
slot

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

Definition at line 1622 of file k3dockwidget.cpp.

K3DockWidget::DockPosition K3DockWidget::currentDockPosition ( ) const
Returns
the current dock position.

Definition at line 1363 of file k3dockwidget.cpp.

void K3DockWidget::dockBack ( )
slot

Docks a dockwidget back to the dockwidget that was the neighbor widget before the current dock position.

Definition at line 1680 of file k3dockwidget.cpp.

void K3DockWidget::docking ( K3DockWidget *  dw,
K3DockWidget::DockPosition  dp 
)
signal

Emitted when another dock widget is docking to this.

Parameters
dwthe dockwidget that is docking to this
dpthe DockPosition where it wants to dock to
K3DockManager * K3DockWidget::dockManager ( ) const
Returns
The dockmanager that is responsible for this.

Definition at line 1607 of file k3dockwidget.cpp.

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

Definition at line 840 of file k3dockwidget.cpp.

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

Definition at line 830 of file k3dockwidget.cpp.

bool K3DockWidget::event ( QEvent *  event)
virtual

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

Definition at line 952 of file k3dockwidget.cpp.

K3DockWidget * K3DockWidget::findNearestDockWidget ( DockPosition  pos)

Lookup the nearest dockwidget docked left/right/top/bottom to this one or return 0.

Parameters
posis the position the wanted widget is docked to this one

Definition at line 995 of file k3dockwidget.cpp.

int K3DockWidget::forcedFixedHeight ( )
slot

Definition at line 1335 of file k3dockwidget.cpp.

int K3DockWidget::forcedFixedWidth ( )
slot

Definition at line 1330 of file k3dockwidget.cpp.

K3DockWidgetAbstractHeader * K3DockWidget::getHeader ( )

get the pointer to the header widget

Definition at line 796 of file k3dockwidget.cpp.

QWidget * K3DockWidget::getWidget ( ) const

Get the embedded widget.

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

Definition at line 1569 of file k3dockwidget.cpp.

void K3DockWidget::hasUndocked ( )
signal

Emitted when the widget has undocked.

void K3DockWidget::headerCloseButtonClicked ( )
signal

Emitted when the close button of the panel ( K3DockWidgetHeader) has been clicked.

void K3DockWidget::headerDockbackButtonClicked ( )
signal

Emitted when the dockback button of the panel ( K3DockWidgetHeader) has been clicked.

void K3DockWidget::iMBeingClosed ( )
signal

Emitted when the widget processes a close event.

bool K3DockWidget::isDockBackPossible ( ) const
Returns
result true, if a dockback is possible, otherwise false.

Definition at line 1710 of file k3dockwidget.cpp.

QWidget * K3DockWidget::latestK3DockContainer ( )
protected

Definition at line 787 of file k3dockwidget.cpp.

void K3DockWidget::leaveEvent ( QEvent *  e)
protectedvirtualslot

Definition at line 639 of file k3dockwidget.cpp.

void K3DockWidget::loseFormerBrotherDockWidget ( )
protectedslot

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 1671 of file k3dockwidget.cpp.

void K3DockWidget::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.

Definition at line 1638 of file k3dockwidget.cpp.

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

This is a key method of this class! Use it to dock dockwidgets to another dockwidget at the right position within its K3DockMainWindow 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.
Note
Since KDE 3.5 the splitter position spliPos is always a value between [0..100]. If the value is > 100, it will be treated like the old code and normalized to a value between 0 and 100. Example: If the value was 4000, it will be fixed to 40. In short: The old and the new behavior both work, so it is compatible with older KDE-versions.

Definition at line 1023 of file k3dockwidget.cpp.

bool K3DockWidget::mayBeHide ( ) const
Returns
If it may be possible to hide this.

There are reasons that it's impossible:

  • It is a (tab) group.
  • It is already invisible ;-)
  • The parent of this is the K3DockMainWindow.
  • It isn't able to dock to another widget.

Definition at line 1595 of file k3dockwidget.cpp.

bool K3DockWidget::mayBeShow ( ) const
Returns
If it may be possible to show this. There are reasons that it's impossible:
  • It is a (tab) group.
  • It is already visible ;-)
  • The parent of this is the K3DockMainWindow.

Definition at line 1601 of file k3dockwidget.cpp.

void K3DockWidget::mouseMoveEvent ( QMouseEvent *  mme)
protectedvirtualslot

Definition at line 717 of file k3dockwidget.cpp.

void K3DockWidget::mousePressEvent ( QMouseEvent *  mme)
protectedvirtualslot

Definition at line 648 of file k3dockwidget.cpp.

void K3DockWidget::mouseReleaseEvent ( QMouseEvent *  ev)
protectedvirtualslot

Definition at line 708 of file k3dockwidget.cpp.

void K3DockWidget::paintEvent ( QPaintEvent *  pe)
protectedvirtualslot

Definition at line 627 of file k3dockwidget.cpp.

QWidget * K3DockWidget::parentDockContainer ( ) const

Definition at line 1303 of file k3dockwidget.cpp.

K3DockTabGroup * K3DockWidget::parentDockTabGroup ( ) const
Returns
the parent widget of this if it inherits class K3DockTabGroup

Definition at line 1295 of file k3dockwidget.cpp.

const QPixmap & K3DockWidget::pixmap ( ) const

Returns the dockwidget's associated caption/dock tab pixmap.

Definition at line 600 of file k3dockwidget.cpp.

void K3DockWidget::restoreFromForcedFixedSize ( )
slot

Definition at line 1340 of file k3dockwidget.cpp.

void K3DockWidget::setDockDefaultPos ( )
signal

Signals that the dock default position is set.

void K3DockWidget::setDockSite ( int  pos)

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

Parameters
posAn OR'ed set of DockPositions

Definition at line 835 of file k3dockwidget.cpp.

void K3DockWidget::setDockWindowTransient ( QWidget *  parent,
bool  transientEnabled 
)

Definition at line 941 of file k3dockwidget.cpp.

void K3DockWidget::setDockWindowType ( NET::WindowType  windowType)

Sets the type of the dock window.

Parameters
windowTypeis type of dock window

Definition at line 933 of file k3dockwidget.cpp.

void K3DockWidget::setEnableDocking ( int  pos)

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

Parameters
posAn OR'ed set of DockPositions

Definition at line 820 of file k3dockwidget.cpp.

void K3DockWidget::setForcedFixedHeight ( int  h)
slot

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 K3DockSplitter

Definition at line 1321 of file k3dockwidget.cpp.

void K3DockWidget::setForcedFixedWidth ( int  w)
slot

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 K3DockSplitter

Definition at line 1312 of file k3dockwidget.cpp.

void K3DockWidget::setFormerBrotherDockWidget ( K3DockWidget *  dockWidget)
protected

Definition at line 1663 of file k3dockwidget.cpp.

void K3DockWidget::setHeader ( K3DockWidgetAbstractHeader *  ah)

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.

Parameters
ahA base class pointer to the dockwidget header

Definition at line 800 of file k3dockwidget.cpp.

void K3DockWidget::setLatestK3DockContainer ( QWidget *  container)
protected

Definition at line 776 of file k3dockwidget.cpp.

void K3DockWidget::setPixmap ( const QPixmap &  pixmap = QPixmap())

Allows changing the pixmap which is used for the caption or dock tabs.

Parameters
pixmapis the pixmap to set

Definition at line 584 of file k3dockwidget.cpp.

void K3DockWidget::setTabPageLabel ( const QString &  label)

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

Parameters
labelThe new tab page label.

Definition at line 1718 of file k3dockwidget.cpp.

void K3DockWidget::setToolTipString ( const QString &  ttStr)

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.

Definition at line 1612 of file k3dockwidget.cpp.

void K3DockWidget::setWidget ( QWidget *  w)

Sets the embedded widget.

A QLayout takes care about proper resizing, automatically.

Parameters
wThe pointer to the dockwidget's child widget.

Definition at line 1525 of file k3dockwidget.cpp.

void K3DockWidget::show ( void  )
virtual

Add dockwidget management actions to QWidget::show.

Definition at line 914 of file k3dockwidget.cpp.

const QString & K3DockWidget::tabPageLabel ( ) const
Returns
A string that is used for the label of the tab page when in tab page mode.

Definition at line 1723 of file k3dockwidget.cpp.

void K3DockWidget::toDesktop ( )
slot

Docks the widget to the desktop (as a toplevel widget)

Definition at line 1353 of file k3dockwidget.cpp.

const QString & K3DockWidget::toolTipString ( ) const
Returns
The tooltip string being shown on the appropriate tab page header when in dock-centered mode.

Definition at line 1617 of file k3dockwidget.cpp.

QWidget * K3DockWidget::transientTo ( )

Returns the widget this dockwidget is set transient to, otherwise 0.

Definition at line 948 of file k3dockwidget.cpp.

void K3DockWidget::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).

Definition at line 1368 of file k3dockwidget.cpp.

void K3DockWidget::updateHeader ( )
protected

Checks some conditions and shows or hides the dockwidget header (drag panel).

The header is hidden if:

  • the parent widget is the K3DockMainWindow
  • this is a (tab) group dockwidget
  • it is not able to dock to another dockwidget

Definition at line 845 of file k3dockwidget.cpp.

void K3DockWidget::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 3457 of file k3dockwidget.cpp.

void K3DockWidget::widgetSet ( QWidget *  )
signal

is emitted after the setWidget method has finished

Member Data Documentation

DockPosition K3DockWidget::currentDockPos
protected

the current dock position.

Definition at line 789 of file k3dockwidget.h.

K3DockWidget* K3DockWidget::formerBrotherDockWidget
protected

earlier closest neighbor widget, so it's possible to dock back to it.

Definition at line 785 of file k3dockwidget.h.

DockPosition K3DockWidget::formerDockPos
protected

the former dock position when it really was at another position before.

Definition at line 793 of file k3dockwidget.h.

QString K3DockWidget::tabPageTitle
protected

a string used as title of the tab page when in tab page mode

Definition at line 801 of file k3dockwidget.h.

QString K3DockWidget::toolTipStr
protected

a string used as tooltip for the tab page header when in dock-centered mode.

Definition at line 797 of file k3dockwidget.h.


The documentation for this class was generated from the following files:
  • k3dockwidget.h
  • k3dockwidget.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDE3Support

Skip menu "KDE3Support"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal