diff options
author | David Boddie <david.boddie@nokia.com> | 2010-12-07 16:29:04 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2010-12-07 16:29:04 (GMT) |
commit | 2c55c106839a4ba1a9d9c1d3f6f6cf7e835ccc1d (patch) | |
tree | f3889703def84c49b88bf8b670575328a0f40eb6 | |
parent | 146ea109f9980beda939088687b37549f4d7a125 (diff) | |
download | Qt-2c55c106839a4ba1a9d9c1d3f6f6cf7e835ccc1d.zip Qt-2c55c106839a4ba1a9d9c1d3f6f6cf7e835ccc1d.tar.gz Qt-2c55c106839a4ba1a9d9c1d3f6f6cf7e835ccc1d.tar.bz2 |
Doc: Added documentation about the use of null custom title bar widgets.
Task-number: QTBUG-15516
-rw-r--r-- | src/gui/widgets/qdockwidget.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp index df9b171..0a6269d 100644 --- a/src/gui/widgets/qdockwidget.cpp +++ b/src/gui/widgets/qdockwidget.cpp @@ -1531,8 +1531,11 @@ QAction * QDockWidget::toggleViewAction() const /*! \since 4.3 + Sets an arbitrary \a widget as the dock widget's title bar. If \a widget - is 0, the title bar widget is removed, but not deleted. + is 0, any custom title bar widget previously set on the dock widget is + removed, but not deleted, and the default title bar will be used + instead. If a title bar widget is set, QDockWidget will not use native window decorations when it is floated. @@ -1540,23 +1543,27 @@ QAction * QDockWidget::toggleViewAction() const Here are some tips for implementing custom title bars: \list - \i Mouse events that are not explicitly handled by the title bar widget + \o Mouse events that are not explicitly handled by the title bar widget must be ignored by calling QMouseEvent::ignore(). These events then propagate to the QDockWidget parent, which handles them in the usual manner, moving when the title bar is dragged, docking and undocking when it is double-clicked, etc. - \i When DockWidgetVerticalTitleBar is set on QDockWidget, the title + \o When DockWidgetVerticalTitleBar is set on QDockWidget, the title bar widget is repositioned accordingly. In resizeEvent(), the title bar should check what orientation it should assume: \snippet doc/src/snippets/code/src_gui_widgets_qdockwidget.cpp 0 - \i The title bar widget must have a valid QWidget::sizeHint() and + \o The title bar widget must have a valid QWidget::sizeHint() and QWidget::minimumSizeHint(). These functions should take into account the current orientation of the title bar. + + \o It is not possible to remove a title bar from a dock widget. However, + a similar effect can be achieved by setting a default constructed + QWidget as the title bar widget. \endlist - Using qobject_cast as shown above, the title bar widget has full access + 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. |