org.kde.koala

Class KDockWidget

public class KDockWidget extends QWidget

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 = null;
 dock = mainWidget.createDockWidget( "Any window caption", nicePixmap, null, i18n("window caption")); // null==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. See KDockWidgetSignals for signals emitted by KDockWidget

Author: Max Judin (documentation: Falk Brettschneider).

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

Field Summary
static intDockBottom
static intDockCenter
static intDockCorner
static intDockDesktop
static intDockFullDocking
static intDockFullSite
static intDockLeft
static intDockNone
The possible positions where a dockwidget can dock to another dockwidget
static intDockRight
static intDockTop
static intDockToSpecialSites
Constructor Summary
protected KDockWidget(Class dummy)
KDockWidget(KDockManager dockManager, String name, QPixmap pixmap, QWidget parent, String strCaption, String strTabPageLabel, int f)
Construct a dockwidget.
KDockWidget(KDockManager dockManager, String name, QPixmap pixmap, QWidget parent, String strCaption, String strTabPageLabel)
KDockWidget(KDockManager dockManager, String name, QPixmap pixmap, QWidget parent, String strCaption)
KDockWidget(KDockManager dockManager, String name, QPixmap pixmap, QWidget parent)
KDockWidget(KDockManager dockManager, String name, QPixmap pixmap)
Method Summary
voidchangeHideShowState()
Toggles the visibility state of the dockwidget if it is able to be shown or to be hidden.
StringclassName()
intcurrentDockPosition()
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
voiddockBack()
Docks a dockwidget back to the dockwidget that was the neighbor widget before the current dock position.
KDockManagerdockManager()
intdockSite()
intenableDocking()
booleanevent(QEvent arg1)
Catches and processes some QWidget events that are interesting for dockwidgets.
protected voidfinalize()
Deletes the wrapped C++ instance
KDockWidgetfindNearestDockWidget(int pos)
Lookup the nearest dockwidget docked left/right/top/bottom to this one or return 0
intforcedFixedHeight()
intforcedFixedWidth()
KDockWidgetAbstractHeadergetHeader()
QWidgetgetWidget()
Get the embedded widget.
booleanisDisposed()
Has the wrapped C++ instance been deleted?
booleanisDockBackPossible()
protected QWidgetlatestKDockContainer()
protected voidleaveEvent(QEvent arg1)
protected voidloseFormerBrotherDockWidget()
Does several things here when it has noticed that the former brother widget (closest neighbor) gets lost.
voidmakeDockVisible()
Normally it simply shows the dockwidget.
KDockWidgetmanualDock(KDockWidget target, int dockPos, int spliPos, QPoint pos, boolean check, int tabIndex)
This is a key method of this class!
KDockWidgetmanualDock(KDockWidget target, int dockPos, int spliPos, QPoint pos, boolean check)
KDockWidgetmanualDock(KDockWidget target, int dockPos, int spliPos, QPoint pos)
KDockWidgetmanualDock(KDockWidget target, int dockPos, int spliPos)
KDockWidgetmanualDock(KDockWidget target, int dockPos)
booleanmayBeHide()
There are reasons that it's impossible:
  • It is a (tab) group.
  • booleanmayBeShow()
  • It is a (tab) group.
  • QMetaObjectmetaObject()
    protected voidmouseMoveEvent(QMouseEvent arg1)
    protected voidmousePressEvent(QMouseEvent arg1)
    protected voidmouseReleaseEvent(QMouseEvent arg1)
    protected voidpaintEvent(QPaintEvent arg1)
    QWidgetparentDockContainer()
    KDockTabGroupparentDockTabGroup()
    QPixmappixmap()
    Returns the dockwidget's associated caption/dock tab pixmap
    voidrestoreFromForcedFixedSize()
    voidsetDockSite(int pos)
    Specify where it is either possible or impossible for another dockwidget to dock to this.
    voidsetDockWindowTransient(QWidget parent, boolean transientEnabled)
    voidsetDockWindowType(int windowType)
    Sets the type of the dock window
    voidsetEnableDocking(int pos)
    Specify where it is either possible or impossible for this to dock to another dockwidget.
    voidsetForcedFixedHeight(int arg1)
    subject to changes.
    voidsetForcedFixedWidth(int arg1)
    subject to changes.
    protected voidsetFormerBrotherDockWidget(KDockWidget arg1)
    voidsetHeader(KDockWidgetAbstractHeader ah)
    Sets the header of this dockwidget.
    protected voidsetLatestKDockContainer(QWidget arg1)
    voidsetPixmap(QPixmap pixmap)
    Allows changing the pixmap which is used for the caption or dock tabs
    voidsetPixmap()
    voidsetTabPageLabel(String label)
    Sets a string that is used for the label of the tab page when in tab page mode
    voidsetToolTipString(String ttStr)
    Stores a string for a tooltip.
    voidsetWidget(QWidget w)
    Sets the embedded widget.
    voidshow()
    Add dockwidget management actions to QWidget.show.
    StringtabPageLabel()
    voidtoDesktop()
    Docks the widget to the desktop (as a toplevel widget)
    StringtoolTipString()
    QWidgettransientTo()
    Returns the widget this dockwidget is set transient to, otherwise 0
    voidundock()
    Undocks this.
    protected voidupdateHeader()
    Checks some conditions and shows or hides the dockwidget header (drag panel).

    Field Detail

    DockBottom

    public static final int DockBottom

    DockCenter

    public static final int DockCenter

    DockCorner

    public static final int DockCorner

    DockDesktop

    public static final int DockDesktop

    DockFullDocking

    public static final int DockFullDocking

    DockFullSite

    public static final int DockFullSite

    DockLeft

    public static final int DockLeft

    DockNone

    public static final int DockNone
    The possible positions where a dockwidget can dock to another dockwidget

    UNKNOWN: The possible positions where a dockwidget can dock to another dockwidget

    DockRight

    public static final int DockRight

    DockTop

    public static final int DockTop

    DockToSpecialSites

    public static final int DockToSpecialSites

    Constructor Detail

    KDockWidget

    protected KDockWidget(Class dummy)

    KDockWidget

    public KDockWidget(KDockManager dockManager, String name, QPixmap pixmap, QWidget parent, String strCaption, String strTabPageLabel, int f)
    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: dockManager The responsible manager (dock helper) name Object instance name pixmap An icon (for instance shown when docked centered) parent Parent widget strCaption Title of the dockwidget window (shown when toplevel) strTabPageLabel The title of the tab page (shown when in tab page mode), if it is "", only the icon will be shown, if it is null, the label is set to strCaption f Qt.WidgetFlags widget flags

    UNKNOWN: Construct a dockwidget.

    KDockWidget

    public KDockWidget(KDockManager dockManager, String name, QPixmap pixmap, QWidget parent, String strCaption, String strTabPageLabel)

    KDockWidget

    public KDockWidget(KDockManager dockManager, String name, QPixmap pixmap, QWidget parent, String strCaption)

    KDockWidget

    public KDockWidget(KDockManager dockManager, String name, QPixmap pixmap, QWidget parent)

    KDockWidget

    public KDockWidget(KDockManager dockManager, String name, QPixmap pixmap)

    Method Detail

    changeHideShowState

    public void changeHideShowState()
    Toggles the visibility state of the dockwidget if it is able to be shown or to be hidden.

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

    className

    public String className()

    currentDockPosition

    public int currentDockPosition()

    Returns: the current dock position.

    UNKNOWN:

    dispose

    public void dispose()
    Delete the wrapped C++ instance ahead of finalize()

    dockBack

    public void dockBack()
    Docks a dockwidget back to the dockwidget that was the neighbor widget before the current dock position.

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

    dockManager

    public KDockManager dockManager()

    Returns: The dockmanager that is responsible for this.

    UNKNOWN:

    dockSite

    public int dockSite()

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

    UNKNOWN:

    enableDocking

    public int enableDocking()

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

    UNKNOWN:

    event

    public boolean event(QEvent arg1)
    Catches and processes some QWidget events that are interesting for dockwidgets.

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

    finalize

    protected void finalize()
    Deletes the wrapped C++ instance

    findNearestDockWidget

    public KDockWidget findNearestDockWidget(int pos)
    Lookup the nearest dockwidget docked left/right/top/bottom to this one or return 0

    Parameters: pos is the position the wanted widget is docked to this one

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

    forcedFixedHeight

    public int forcedFixedHeight()

    forcedFixedWidth

    public int forcedFixedWidth()

    getHeader

    public KDockWidgetAbstractHeader getHeader()

    Since: 3.2 get the pointer to the header widget

    UNKNOWN: @since 3.

    getWidget

    public QWidget getWidget()
    Get the embedded widget.

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

    UNKNOWN: Get the embedded widget.

    isDisposed

    public boolean isDisposed()
    Has the wrapped C++ instance been deleted?

    isDockBackPossible

    public boolean isDockBackPossible()

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

    UNKNOWN:

    latestKDockContainer

    protected QWidget latestKDockContainer()

    leaveEvent

    protected void leaveEvent(QEvent arg1)

    loseFormerBrotherDockWidget

    protected void loseFormerBrotherDockWidget()
    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" ;-)

    UNKNOWN: Does several things here when it has noticed that the former brother widget (closest neighbor) gets lost.

    makeDockVisible

    public void 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.

    UNKNOWN: Normally it simply shows the dockwidget.

    manualDock

    public KDockWidget manualDock(KDockWidget target, int dockPos, int spliPos, QPoint pos, boolean check, int tabIndex)
    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: target The dockwidget to dock to dockPos One of the DockPositions this is going to dock to spliPos The split relation (in percent, or percent*100 in high resolution) between both dockwidgets, target and this pos The dock position, mainly of interest for docking to the desktop (as toplevel dockwidget) check Only for internal use; tabIndex The 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.

    UNKNOWN: 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. 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.

    manualDock

    public KDockWidget manualDock(KDockWidget target, int dockPos, int spliPos, QPoint pos, boolean check)

    manualDock

    public KDockWidget manualDock(KDockWidget target, int dockPos, int spliPos, QPoint pos)

    manualDock

    public KDockWidget manualDock(KDockWidget target, int dockPos, int spliPos)

    manualDock

    public KDockWidget manualDock(KDockWidget target, int dockPos)

    mayBeHide

    public boolean mayBeHide()
    There are reasons that it's impossible:
  • It is a (tab) group.
  • It is already invisible ;-)
  • The parent of this is the KDockMainWindow.
  • It isn't able to dock to another widget.
  • @return If it may be possible to hide this.

    UNKNOWN:

    mayBeShow

    public boolean mayBeShow()
  • It is a (tab) group.
  • It is already visible ;-)
  • The parent of this is the KDockMainWindow.
  • @return If it may be possible to show this. There are reasons that it's impossible:

    UNKNOWN:

    metaObject

    public QMetaObject metaObject()

    mouseMoveEvent

    protected void mouseMoveEvent(QMouseEvent arg1)

    mousePressEvent

    protected void mousePressEvent(QMouseEvent arg1)

    mouseReleaseEvent

    protected void mouseReleaseEvent(QMouseEvent arg1)

    paintEvent

    protected void paintEvent(QPaintEvent arg1)

    parentDockContainer

    public QWidget parentDockContainer()

    parentDockTabGroup

    public KDockTabGroup parentDockTabGroup()

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

    UNKNOWN:

    pixmap

    public QPixmap pixmap()
    Returns the dockwidget's associated caption/dock tab pixmap

    UNKNOWN: Returns the dockwidget's associated caption/dock tab pixmap

    restoreFromForcedFixedSize

    public void restoreFromForcedFixedSize()

    setDockSite

    public void setDockSite(int pos)
    Specify where it is either possible or impossible for another dockwidget to dock to this.

    Parameters: pos An OR'ed set of DockPositions

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

    setDockWindowTransient

    public void setDockWindowTransient(QWidget parent, boolean transientEnabled)

    setDockWindowType

    public void setDockWindowType(int windowType)
    Sets the type of the dock window

    Parameters: windowType is type of dock window

    UNKNOWN: Sets the type of the dock window

    setEnableDocking

    public void setEnableDocking(int pos)
    Specify where it is either possible or impossible for this to dock to another dockwidget.

    Parameters: pos An OR'ed set of DockPositions

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

    setForcedFixedHeight

    public void setForcedFixedHeight(int arg1)
    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

    UNKNOWN: subject to changes.

    setForcedFixedWidth

    public void setForcedFixedWidth(int arg1)
    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

    UNKNOWN: subject to changes.

    setFormerBrotherDockWidget

    protected void setFormerBrotherDockWidget(KDockWidget arg1)

    setHeader

    public void setHeader(KDockWidgetAbstractHeader 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: ah A base class pointer to the dockwidget header

    UNKNOWN: Sets the header of this dockwidget.

    setLatestKDockContainer

    protected void setLatestKDockContainer(QWidget arg1)

    setPixmap

    public void setPixmap(QPixmap pixmap)
    Allows changing the pixmap which is used for the caption or dock tabs

    Parameters: pixmap is the pixmap to set

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

    setPixmap

    public void setPixmap()

    setTabPageLabel

    public void setTabPageLabel(String label)
    Sets a string that is used for the label of the tab page when in tab page mode

    Parameters: label The new tab page label.

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

    setToolTipString

    public void setToolTipString(String 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: ttStr A string for the tooltip on the tab.

    UNKNOWN: Stores a string for a tooltip.

    setWidget

    public void setWidget(QWidget w)
    Sets the embedded widget. A QLayout takes care about proper resizing, automatically.

    Parameters: w The pointer to the dockwidget's child widget.

    UNKNOWN: Sets the embedded widget.

    show

    public void show()
    Add dockwidget management actions to QWidget.show.

    UNKNOWN: Add dockwidget management actions to QWidget.show.

    tabPageLabel

    public String tabPageLabel()

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

    UNKNOWN:

    toDesktop

    public void toDesktop()
    Docks the widget to the desktop (as a toplevel widget)

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

    toolTipString

    public String toolTipString()

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

    UNKNOWN:

    transientTo

    public QWidget transientTo()
    Returns the widget this dockwidget is set transient to, otherwise 0

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

    undock

    public void undock()
    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).

    UNKNOWN: Undocks this.

    updateHeader

    protected void updateHeader()
    Checks some conditions and shows or hides the dockwidget header (drag panel). The header is hidden if:
  • the parent widget is the KDockMainWindow
  • this is a (tab) group dockwidget
  • it is not able to dock to another dockwidget
  • @short Checks some conditions and shows or hides the dockwidget header (drag panel).