|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.gui.QDockWidget
public class QDockWidget
The QDockWidget class provides a widget that can be docked inside a QMainWindow or floated as a top-level window on the desktop.
QDockWidget provides the concept of dock widgets, also know as tool palettes or utility windows. Dock windows are secondary windows placed in the dock widget area around the central widget in a QMainWindow.
Dock windows can be moved inside their current area, moved into new areas and floated (e.g. undocked) by the end-user. The QDockWidget API allows the programmer to restrict the dock widgets ability to move, float and close, as well as the areas in which they can be placed.
A QDockWidget consists of a title bar and the content area. The title bar displays the dock widgets window title, a float button and a close button. Depending on the state of the QDockWidget, the float and close buttons may be either disabled or not shown at all.
The visual appearance of the title bar and buttons is dependent on the style in use.
A QDockWidget acts as a wrapper for its child widget, set with setWidget. Custom size hints, minimum and maximum sizes and size policies should be implemented in the child widget. QDockWidget will respect them, adjusting its own constraints to include the frame and title. Size constraints should not be set on the QDockWidget itself, because they change depending on wether it is docked; a docked QDockWidget has no frame and a smaller title bar.
Widgets Example
Nested Class Summary | |
---|---|
static class |
QDockWidget.DockWidgetFeature
Press link for info on QDockWidget.DockWidgetFeature |
static class |
QDockWidget.DockWidgetFeatures
This QFlag class provides flags for the int enum. |
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget |
---|
QWidget.RenderFlag, QWidget.RenderFlags |
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Field Summary | |
---|---|
QSignalEmitter.Signal1<Qt.DockWidgetAreas> |
allowedAreasChanged
This signal is emitted when the allowedAreas property changes. |
QSignalEmitter.Signal1<Qt.DockWidgetArea> |
dockLocationChanged
This signal is emitted when the dock widget is moved to another dock area, or is moved to a different location in its current dock area. |
QSignalEmitter.Signal1<QDockWidget.DockWidgetFeatures> |
featuresChanged
This signal is emitted when the features property changes. |
QSignalEmitter.Signal1<java.lang.Boolean> |
topLevelChanged
This signal is emitted when the floating property changes. |
QSignalEmitter.Signal1<java.lang.Boolean> |
visibilityChanged
This signal is emitted when the dock widget becomes visible (or invisible). |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Constructor Summary | |
---|---|
QDockWidget()
Equivalent to QDockWidget(0, 0). |
|
QDockWidget(QWidget parent)
Equivalent to QDockWidget(parent, 0). |
|
QDockWidget(QWidget parent,
Qt.WindowFlags flags)
Constructs a QDockWidget with parent parent and window flags flags. |
|
QDockWidget(java.lang.String title)
Equivalent to QDockWidget(title, 0, 0). |
|
QDockWidget(java.lang.String title,
QWidget parent)
Equivalent to QDockWidget(title, parent, 0). |
|
QDockWidget(java.lang.String title,
QWidget parent,
Qt.WindowFlags flags)
Constructs a QDockWidget with parent parent and window flags flags. |
Method Summary | |
---|---|
Qt.DockWidgetAreas |
allowedAreas()
Returns areas where the dock widget may be placed. |
protected void |
changeEvent(QEvent event)
This function is reimplemented for internal reasons. |
protected void |
closeEvent(QCloseEvent event)
This function is reimplemented for internal reasons. |
boolean |
event(QEvent event)
This function is reimplemented for internal reasons. |
QDockWidget.DockWidgetFeatures |
features()
Returns whether the dock widget is movable, closable, and floatable. |
static QDockWidget |
fromNativePointer(QNativePointer nativePointer)
This function returns the QDockWidget instance pointed to by nativePointer |
protected void |
initStyleOption(QStyleOptionDockWidget option)
Initialize option with the values from this QDockWidget. |
boolean |
isAreaAllowed(Qt.DockWidgetArea area)
Returns true if this dock widget can be placed in the given area; otherwise returns false. |
boolean |
isFloating()
Returns whether the dock widget is floating. |
protected void |
paintEvent(QPaintEvent event)
This function is reimplemented for internal reasons. |
void |
setAllowedAreas(Qt.DockWidgetArea... areas)
Sets areas where the dock widget may be placed to areas. |
void |
setAllowedAreas(Qt.DockWidgetAreas areas)
Sets areas where the dock widget may be placed to areas. |
void |
setFeatures(QDockWidget.DockWidgetFeature... features)
Sets whether the dock widget is movable, closable, and floatable to features. |
void |
setFeatures(QDockWidget.DockWidgetFeatures features)
Sets whether the dock widget is movable, closable, and floatable to features. |
void |
setFloating(boolean floating)
Sets whether the dock widget is floating to floating. |
void |
setTitleBarWidget(QWidget widget)
Sets an arbitrary widget as the dock widget's title bar. |
void |
setWidget(QWidget widget)
Sets the widget for the dock widget to widget. |
QWidget |
titleBarWidget()
Returns the custom title bar widget set on the QDockWidget, or 0 if no custom title bar has been set. |
QAction |
toggleViewAction()
Returns a checkable action that can be used to show or close this dock widget. |
QWidget |
widget()
Returns the widget for the dock widget. |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
disconnect, disconnect, signalSender |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Field Detail |
---|
public final QSignalEmitter.Signal1<Qt.DockWidgetAreas> allowedAreasChanged
This signal is emitted when the allowedAreas property changes. The allowedAreas parameter gives the new value of the property.
public final QSignalEmitter.Signal1<Qt.DockWidgetArea> dockLocationChanged
This signal is emitted when the dock widget is moved to another dock area, or is moved to a different location in its current dock area. This happens when the dock widget is moved programmatically or is dragged to a new location by the user.
public final QSignalEmitter.Signal1<QDockWidget.DockWidgetFeatures> featuresChanged
This signal is emitted when the features property changes. The features parameter gives the new value of the property.
public final QSignalEmitter.Signal1<java.lang.Boolean> topLevelChanged
This signal is emitted when the floating property changes. The topLevel parameter is true if the dock widget is now floating; otherwise it is false.
public final QSignalEmitter.Signal1<java.lang.Boolean> visibilityChanged
This signal is emitted when the dock widget becomes visible (or invisible). This happens when the widget is hidden or shown, as well as when it is docked in a tabbed dock area and its tab becomes selected or unselected.
Constructor Detail |
---|
public QDockWidget(java.lang.String title, QWidget parent)
Equivalent to QDockWidget(title, parent, 0).
public QDockWidget(java.lang.String title)
Equivalent to QDockWidget(title, 0, 0).
public QDockWidget(java.lang.String title, QWidget parent, Qt.WindowFlags flags)
Constructs a QDockWidget with parent parent and window flags flags. The dock widget will be placed in the left dock widget area.
The window title is set to title. This title is used when the QDockWidget is docked and undocked. It is also used in the context menu provided by QMainWindow.
public QDockWidget(QWidget parent)
Equivalent to QDockWidget(parent, 0).
public QDockWidget()
Equivalent to QDockWidget(0, 0).
public QDockWidget(QWidget parent, Qt.WindowFlags flags)
Constructs a QDockWidget with parent parent and window flags flags. The dock widget will be placed in the left dock widget area.
Method Detail |
---|
public final Qt.DockWidgetAreas allowedAreas()
Returns areas where the dock widget may be placed.
The default is Qt::AllDockWidgetAreas.
public final QDockWidget.DockWidgetFeatures features()
Returns whether the dock widget is movable, closable, and floatable.
public final boolean isAreaAllowed(Qt.DockWidgetArea area)
Returns true if this dock widget can be placed in the given area; otherwise returns false.
public final boolean isFloating()
Returns whether the dock widget is floating.
A floating dock widget is presented to the user as an independent window "on top" of its parent QMainWindow, instead of being docked in the QMainWindow.
public final void setAllowedAreas(Qt.DockWidgetArea... areas)
Sets areas where the dock widget may be placed to areas.
The default is Qt::AllDockWidgetAreas.
public final void setAllowedAreas(Qt.DockWidgetAreas areas)
Sets areas where the dock widget may be placed to areas.
The default is Qt::AllDockWidgetAreas.
public final void setFeatures(QDockWidget.DockWidgetFeature... features)
Sets whether the dock widget is movable, closable, and floatable to features.
public final void setFeatures(QDockWidget.DockWidgetFeatures features)
Sets whether the dock widget is movable, closable, and floatable to features.
public final void setFloating(boolean floating)
Sets whether the dock widget is floating to floating.
A floating dock widget is presented to the user as an independent window "on top" of its parent QMainWindow, instead of being docked in the QMainWindow.
public final void setTitleBarWidget(QWidget widget)
Sets an arbitrary widget as the dock widget's title bar. If widget is 0, the title bar widget is removed, but not deleted.
If a title bar widget is set, QDockWidget will not use native window decorations when it is floated.
Here are some tips for implementing custom title bars:
QDockWidget *dockWidget = qobject_cast<QDockWidget*>(parentWidget()); if (dockWidget->features() & QDockWidget::DockWidgetVerticalTitleBar) { // I need to be vertical } else { // I need to be horizontal }
Using qobject_cast as shown above, the title bar widget has full access to its parent QDockWidget. Hence it can perform such operations as docking and hiding in response to user actions.
public final void setWidget(QWidget widget)
Sets the widget for the dock widget to widget.
public final QWidget titleBarWidget()
Returns the custom title bar widget set on the QDockWidget, or 0 if no custom title bar has been set.
public final QAction toggleViewAction()
Returns a checkable action that can be used to show or close this dock widget.
The action's text is set to the dock widget's window title.
public final QWidget widget()
Returns the widget for the dock widget. This function returns zero if the widget has not been set.
protected void changeEvent(QEvent event)
This function is reimplemented for internal reasons.
changeEvent
in class QWidget
protected void closeEvent(QCloseEvent event)
This function is reimplemented for internal reasons.
closeEvent
in class QWidget
public boolean event(QEvent event)
This function is reimplemented for internal reasons.
event
in class QWidget
protected void paintEvent(QPaintEvent event)
This function is reimplemented for internal reasons.
paintEvent
in class QWidget
public static QDockWidget fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.protected final void initStyleOption(QStyleOptionDockWidget option)
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |