#include <q3dockwindow.h>
Inheritance diagram for Q3DockWindow:


This class handles moving, resizing, docking and undocking dock windows. Q3ToolBar is a subclass of Q3DockWindow so the functionality provided for dock windows is available with the same API for toolbars.
qmainwindow-qdockareas.png Q3DockWindows in a Q3DockArea Two Q3DockWindows ({Q3ToolBar}s) in a Q3DockArea
qdockwindow.png A Q3DockWindow A Floating Q3DockWindow
If the user drags the dock window into the dock area the dock window will be docked. If the user drags the dock area outside any dock areas the dock window will be undocked (floated) and will become a top level window. Double clicking a floating dock window's title bar will dock the dock window to the last dock area it was docked in. Double clicking a docked dock window's handle will undock (float) the dock window. Single clicking a docked dock window's handle will minimize the dock window (only its handle will appear, below the menu bar). Single clicking the minimized handle will restore the dock window to the last dock area that it was docked in. If the user clicks the close button (which appears on floating dock windows by default) the dock window will disappear. You can control whether or not a dock window has a close button with setCloseMode().
Q3MainWindow provides four dock areas (top, left, right and bottom) which can be used by dock windows. For many applications using the dock areas provided by Q3MainWindow is sufficient. (See the Q3DockArea documentation if you want to create your own dock areas.) In Q3MainWindow a right-click popup menu (the dock window menu) is available which lists dock windows and can be used to show or hide them. (The popup menu only lists dock windows that have a caption.)
When you construct a dock window you must pass it a Q3DockArea or a Q3MainWindow as its parent if you want it docked. Pass 0 for the parent if you want it floated.
In the example above we create a new Q3ToolBar in the constructor of a Q3MainWindow subclass (so that the this pointer points to the Q3MainWindow). By default the toolbar will be added to the Top dock area, but we've moved it to the Left dock area.
A dock window is often used to contain a single widget. In these cases the widget can be set by calling setWidget(). If you're constructing a dock window that contains multiple widgets, e.g. a toolbar, arrange the widgets within a box layout inside the dock window. To do this use the boxLayout() function to get a pointer to the dock window's box layout, then add widgets to the layout using the box layout's QBoxLayout::addWidget() function. The dock window will dynamically set the orientation of the layout to be vertical or horizontal as necessary, although you can control this yourself with setOrientation().
Although a common use of dock windows is for toolbars, they can be used with any widgets. When using larger widgets it may make sense for the dock window to be resizable by calling setResizeEnabled(). Resizable dock windows are given splitter-like handles to allow the user to resize them within their dock area. When resizable dock windows are undocked they become top level windows and can be resized like any other top level windows, e.g. by dragging a corner or edge.
Qt::Dock windows can be docked and undocked using dock() and undock(). A dock window's orientation can be set with setOrientation(). You can also use Q3DockArea::moveDockWindow(). If you're using a Q3MainWindow, Q3MainWindow::moveDockWindow() and Q3MainWindow::removeDockWindow() are available.
A dock window can have some preferred settings, for example, you can set a preferred offset from the left edge (or top edge for vertical dock areas) of the dock area using setOffset(). If you'd prefer a dock window to start on a new line when it is docked use setNewLine(). The setFixedExtentWidth() and setFixedExtentHeight() functions can be used to define the dock window's preferred size, and the setHorizontallyStretchable() and setVerticallyStretchable() functions set whether the dock window can be stretched or not. Dock windows can be moved by default, but this can be changed with setMovingEnabled(). When a dock window is moved it is shown as a rectangular outline, but it can be shown normally using setOpaqueMoving().
When a dock window's visibility changes, i.e. it is shown or hidden, the visibilityChanged() signal is emitted. When a dock window is docked, undocked or moved inside the dock area the placeChanged() signal is emitted.
Definition at line 51 of file q3dockwindow.h.
| enum Q3DockWindow::Place |
This enum specifies the possible locations for a Q3DockWindow:
InDock Inside a Q3DockArea. OutsideDock Floating as a top level window on the desktop.
Definition at line 76 of file q3dockwindow.h.
00076 { InDock, OutsideDock };
This enum type specifies when (if ever) a dock window has a close button.
Never The dock window never has a close button and cannot be closed by the user. Docked The dock window has a close button only when docked. Undocked The dock window has a close button only when floating. Always The dock window always has a close button. Note that dock windows can always be minimized if the user clicks their dock window handle when they are docked.
Definition at line 77 of file q3dockwindow.h.
| Q3DockWindow::Q3DockWindow | ( | Place | p = InDock, |
|
| QWidget * | parent = 0, |
|||
| const char * | name = 0, |
|||
| Qt::WindowFlags | f = 0 | |||
| ) |
Constructs a Q3DockWindow with parent parent, called name and with widget flags f.
If p is InDock, the dock window is docked into a dock area and parent must be a Q3DockArea or a Q3MainWindow. If the parent is a Q3MainWindow the dock window will be docked in the main window's Top dock area.
If p is OutsideDock, the dock window is created as a floating window.
We recommend creating the dock area InDock with a Q3MainWindow as parent then calling Q3MainWindow::moveDockWindow() to move the dock window where you want it.
Definition at line 957 of file q3dockwindow.cpp.
References curPlace, init(), and isToolbar.
00958 : Q3Frame(parent, name, f | Qt::WType_Dialog | Qt::WStyle_Customize | Qt::WStyle_NoBorder) 00959 { 00960 curPlace = p; 00961 isToolbar = false; 00962 init(); 00963 }
Here is the call graph for this function:

| Q3DockWindow::Q3DockWindow | ( | QWidget * | parent, | |
| const char * | name = 0, |
|||
| Qt::WindowFlags | f = 0 | |||
| ) |
Constructs a Q3DockWindow with parent parent, called name and with widget flags f.
Definition at line 932 of file q3dockwindow.cpp.
References curPlace, InDock, init(), and isToolbar.
00933 : Q3Frame(parent, name, f | Qt::WType_Dialog | Qt::WStyle_Customize | Qt::WStyle_NoBorder) 00934 { 00935 curPlace = InDock; 00936 isToolbar = false; 00937 init(); 00938 }
Here is the call graph for this function:

| Q3DockWindow::~Q3DockWindow | ( | ) |
Destroys the dock window and its child widgets.
Definition at line 1140 of file q3dockwindow.cpp.
References a, area(), dockWindowData, qApp, Q3DockArea::removeDockWindow(), and Q3MainWindow::removeDockWindow().
01141 { 01142 qApp->removeEventFilter(this); 01143 if (area()) 01144 area()->removeDockWindow(this, false, false); 01145 Q3DockArea *a = area(); 01146 if (!a && dockWindowData) 01147 a = ((Q3DockArea::DockWindowData*)dockWindowData)->area; 01148 Q3MainWindow *mw = a ? qobject_cast<Q3MainWindow*>(a->parentWidget()) : 0; 01149 if (mw) 01150 mw->removeDockWindow(this); 01151 01152 delete (Q3DockArea::DockWindowData*)dockWindowData; 01153 }
Here is the call graph for this function:

| Q3DockWindow::Q3DockWindow | ( | Place | p, | |
| QWidget * | parent, | |||
| const char * | name, | |||
| Qt::WindowFlags | f, | |||
| bool | toolbar | |||
| ) | [private] |
Definition at line 968 of file q3dockwindow.cpp.
References curPlace, init(), and isToolbar.
00969 : Q3Frame(parent, name, f | Qt::WType_Dialog | Qt::WStyle_Customize | Qt::WStyle_NoBorder) 00970 { 00971 curPlace = p; 00972 isToolbar = toolbar; 00973 init(); 00974 }
Here is the call graph for this function:

| void Q3DockWindow::setWidget | ( | QWidget * | w | ) | [virtual] |
Sets the dock window's main widget to w.
Definition at line 1442 of file q3dockwindow.cpp.
References QBoxLayout::addWidget(), boxLayout(), updateGui(), w, and wid.
Here is the call graph for this function:

| QWidget * Q3DockWindow::widget | ( | ) | const |
Returns the dock window's main widget.
Definition at line 1455 of file q3dockwindow.cpp.
References wid.
01456 { 01457 return wid; 01458 }
| Place Q3DockWindow::place | ( | ) | const [inline] |
Definition at line 86 of file q3dockwindow.h.
Referenced by dock(), drawFrame(), event(), Q3ToolBar::event(), eventFilter(), handleMove(), init(), isCloseEnabled(), minimumSize(), minimumSizeHint(), Q3DockWindowTitleBar::mouseReleaseEvent(), setCloseMode(), sizeHint(), startRectDraw(), and undock().
00086 { return curPlace; }
| Q3DockArea * Q3DockWindow::area | ( | ) | const [inline] |
Returns the dock area in which this dock window is docked, or 0 if the dock window is floating.
Definition at line 208 of file q3dockwindow.h.
References dockArea.
Referenced by dock(), Q3DockWindowResizeHandle::drawLine(), handleMove(), Q3DockWindowHandle::minimize(), minimumSize(), minimumSizeHint(), Q3DockWindowResizeHandle::mouseMoveEvent(), Q3DockWindowResizeHandle::mouseReleaseEvent(), Q3MainWindow::moveDockWindow(), Q3DockWindowHandle::paintEvent(), QHideDock::paintEvent(), Q3MainWindow::removeDockWindow(), sizeHint(), Q3DockWindowResizeHandle::sizeHint(), undock(), Q3DockWindowHandle::updateGui(), updateGui(), updateSplitterVisibility(), and ~Q3DockWindow().
00209 { 00210 return dockArea; 00211 }
| void Q3DockWindow::setCloseMode | ( | int | m | ) | [virtual] |
Definition at line 1574 of file q3dockwindow.cpp.
References cMode, horHandle, InDock, place(), titleBar, Q3DockWindowHandle::updateGui(), Q3DockWindowTitleBar::updateGui(), and verHandle.
01575 { 01576 cMode = m; 01577 if (place() == InDock) { 01578 horHandle->updateGui(); 01579 verHandle->updateGui(); 01580 } else { 01581 titleBar->updateGui(); 01582 } 01583 }
Here is the call graph for this function:

| bool Q3DockWindow::isCloseEnabled | ( | ) | const |
Returns true if the dock window has a close button; otherwise returns false. The result depends on the dock window's Place and its CloseMode.
Definition at line 1593 of file q3dockwindow.cpp.
References cMode, Docked, InDock, OutsideDock, place(), and Undocked.
Referenced by Q3DockWindowHandle::minimumSizeHint(), Q3DockWindowHandle::paintEvent(), QHideDock::paintEvent(), Q3DockWindowResizeHandle::sizeHint(), Q3DockWindowHandle::updateGui(), and Q3DockWindowTitleBar::updateGui().
01594 { 01595 return ((cMode & Docked) == Docked && place() == InDock || 01596 (cMode & Undocked) == Undocked && place() == OutsideDock); 01597 }
Here is the call graph for this function:

| int Q3DockWindow::closeMode | ( | ) | const |
Definition at line 1599 of file q3dockwindow.cpp.
References cMode.
01600 { 01601 return cMode; 01602 }
| void Q3DockWindow::setResizeEnabled | ( | bool | b | ) | [virtual] |
Definition at line 1532 of file q3dockwindow.cpp.
References resizeEnabled, and updateGui().
01533 { 01534 resizeEnabled = b; 01535 updateGui(); 01536 }
Here is the call graph for this function:

| void Q3DockWindow::setMovingEnabled | ( | bool | b | ) | [virtual] |
Definition at line 1547 of file q3dockwindow.cpp.
References moveEnabled, and updateGui().
01548 { 01549 moveEnabled = b; 01550 updateGui(); 01551 }
Here is the call graph for this function:

| bool Q3DockWindow::isResizeEnabled | ( | ) | const |
Definition at line 1553 of file q3dockwindow.cpp.
References resizeEnabled.
Referenced by init(), isHorizontallyStretchable(), isVerticallyStretchable(), Q3DockAreaLayout::layoutItems(), Q3DockWindowTitleBar::mousePressEvent(), place_line(), updateGui(), and updateSplitterVisibility().
01554 { 01555 return resizeEnabled; 01556 }
| bool Q3DockWindow::isMovingEnabled | ( | ) | const |
Definition at line 1558 of file q3dockwindow.cpp.
References moveEnabled.
01559 { 01560 return moveEnabled; 01561 }
| void Q3DockWindow::setHorizontallyStretchable | ( | bool | b | ) | [virtual] |
Definition at line 1618 of file q3dockwindow.cpp.
References Qt::Horizontal, and stretchable.
01619 { 01620 stretchable[Qt::Horizontal] = b; 01621 }
| void Q3DockWindow::setVerticallyStretchable | ( | bool | b | ) | [virtual] |
Definition at line 1637 of file q3dockwindow.cpp.
References stretchable, and Qt::Vertical.
01638 { 01639 stretchable[Qt::Vertical] = b; 01640 }
| bool Q3DockWindow::isHorizontallyStretchable | ( | ) | const |
Definition at line 1642 of file q3dockwindow.cpp.
References Qt::Horizontal, isResizeEnabled(), and stretchable.
Referenced by isStretchable().
01643 { 01644 return isResizeEnabled() || stretchable[Qt::Horizontal]; 01645 }
Here is the call graph for this function:

| bool Q3DockWindow::isVerticallyStretchable | ( | ) | const |
Definition at line 1647 of file q3dockwindow.cpp.
References isResizeEnabled(), stretchable, and Qt::Vertical.
Referenced by isStretchable().
01648 { 01649 return isResizeEnabled() || stretchable[Qt::Vertical]; 01650 }
Here is the call graph for this function:

| void Q3DockWindow::setHorizontalStretchable | ( | bool | b | ) | [inline] |
If b is true the dock window is set to be horizontally stretchable.
Definition at line 103 of file q3dockwindow.h.
Referenced by Q3ToolBar::setStretchableWidget().
00103 { setHorizontallyStretchable(b); }
| void Q3DockWindow::setVerticalStretchable | ( | bool | b | ) | [inline] |
If b is true the dock window is set to be vertically stretchable.
Definition at line 104 of file q3dockwindow.h.
Referenced by Q3ToolBar::setStretchableWidget().
00104 { setVerticallyStretchable(b); }
| bool Q3DockWindow::isHorizontalStretchable | ( | ) | const [inline] |
Returns true if the dock window can be stretched horizontally; otherwise returns false.
Definition at line 105 of file q3dockwindow.h.
Referenced by Q3ToolBar::setStretchableWidget().
00105 { return isHorizontallyStretchable(); }
| bool Q3DockWindow::isVerticalStretchable | ( | ) | const [inline] |
Returns true if the dock window can be stretched vertically; otherwise returns false.
Definition at line 106 of file q3dockwindow.h.
Referenced by Q3ToolBar::setStretchableWidget().
00106 { return isVerticallyStretchable(); }
| bool Q3DockWindow::isStretchable | ( | ) | const |
Definition at line 1667 of file q3dockwindow.cpp.
References Qt::Horizontal, isHorizontallyStretchable(), isVerticallyStretchable(), and orientation().
Referenced by place_line().
01668 { 01669 if (orientation() == Qt::Horizontal) 01670 return isHorizontallyStretchable(); 01671 return isVerticallyStretchable(); 01672 }
Here is the call graph for this function:

| void Q3DockWindow::setOffset | ( | int | o | ) | [virtual] |
Definition at line 1704 of file q3dockwindow.cpp.
References offs.
Referenced by Q3DockArea::invalidNextOffset(), Q3DockArea::lineUp(), and Q3MainWindow::moveDockWindow().
| int Q3DockWindow::offset | ( | ) | const |
Definition at line 1691 of file q3dockwindow.cpp.
References offs.
Referenced by swapRect().
01692 { 01693 return offs; 01694 }
| void Q3DockWindow::setFixedExtentWidth | ( | int | w | ) | [virtual] |
Sets the dock window's preferred width for its fixed extent (size) to w.
Definition at line 1727 of file q3dockwindow.cpp.
References fExtent, and QSize::setWidth().
Referenced by Q3DockArea::invalidateFixedSizes(), Q3DockWindowResizeHandle::mouseReleaseEvent(), and Q3DockArea::moveDockWindow().
Here is the call graph for this function:

| void Q3DockWindow::setFixedExtentHeight | ( | int | h | ) | [virtual] |
Sets the dock window's preferred height for its fixed extent (size) to h.
Definition at line 1739 of file q3dockwindow.cpp.
References fExtent, and QSize::setHeight().
Referenced by Q3DockWindowResizeHandle::mouseReleaseEvent().
Here is the call graph for this function:

| QSize Q3DockWindow::fixedExtent | ( | ) | const |
Returns the dock window's preferred size (fixed extent).
Definition at line 1715 of file q3dockwindow.cpp.
References fExtent.
Referenced by minimumSize(), minimumSizeHint(), and sizeHint().
01716 { 01717 return fExtent; 01718 }
| void Q3DockWindow::setNewLine | ( | bool | b | ) | [virtual] |
Definition at line 1753 of file q3dockwindow.cpp.
References nl.
Referenced by Q3MainWindow::addDockWindow(), Q3DockArea::dockWindow(), Q3DockArea::moveDockWindow(), Q3MainWindow::moveDockWindow(), and Q3DockArea::removeDockWindow().
| bool Q3DockWindow::newLine | ( | ) | const |
Definition at line 1758 of file q3dockwindow.cpp.
References nl.
Referenced by Q3DockArea::dockWindow(), and Q3DockArea::moveDockWindow().
01759 { 01760 return nl; 01761 }
| Qt::Orientation Q3DockWindow::orientation | ( | ) | const |
Returns the orientation of the dock window.
Definition at line 1680 of file q3dockwindow.cpp.
References boxLayout(), direction, dockArea, Qt::Horizontal, QBoxLayout::LeftToRight, Q3DockArea::orientation(), QBoxLayout::RightToLeft, and Qt::Vertical.
Referenced by Q3ToolBar::actionEvent(), Q3ToolBar::addSeparator(), Q3ToolBar::checkForExtension(), Q3ToolBar::createPopup(), dock(), Q3DockWindowResizeHandle::drawLine(), isStretchable(), Q3ToolBar::minimumSize(), minimumSize(), Q3ToolBar::minimumSizeHint(), Q3DockWindowHandle::minimumSizeHint(), minimumSizeHint(), Q3MainWindow::moveDockWindow(), Q3ToolBar::setStretchableWidget(), sizeHint(), startRectDraw(), undock(), updateGui(), updatePosition(), and updateSplitterVisibility().
01681 { 01682 if (dockArea) 01683 return dockArea->orientation(); 01684 if (qobject_cast<const Q3ToolBar*>(this)) 01685 return Qt::Horizontal; 01686 return (((Q3DockWindow*)this)->boxLayout()->direction() == QBoxLayout::LeftToRight || 01687 ((Q3DockWindow*)this)->boxLayout()->direction() == QBoxLayout::RightToLeft ? 01688 Qt::Horizontal : Qt::Vertical); 01689 }
Here is the call graph for this function:

| QSize Q3DockWindow::sizeHint | ( | ) | const [virtual] |
Reimplemented from QFrame.
Definition at line 1783 of file q3dockwindow.cpp.
References area(), QSize::expandedTo(), fixedExtent(), QSize::height(), hHandleBottom, Qt::Horizontal, InDock, QWidget::isVisible(), orientation(), QStyle::pixelMetric(), place(), QStyle::PM_SplitterWidth, QSize::setHeight(), QSize::setWidth(), QFrame::sizeHint(), QWidget::style(), Qt::Vertical, vHandleRight, and QSize::width().
Referenced by Q3ToolBar::checkForExtension(), and shrink_extend().
01784 { 01785 QSize sh(Q3Frame::sizeHint()); 01786 if (place() == InDock) 01787 sh = sh.expandedTo(fixedExtent()); 01788 sh = sh.expandedTo(QSize(16, 16)); 01789 if (area()) { 01790 if (area()->orientation() == Qt::Horizontal && !vHandleRight->isVisible()) 01791 sh.setWidth(sh.width() + 2 * style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this) / 3); 01792 else if (area()->orientation() == Qt::Vertical && !hHandleBottom->isVisible()) 01793 sh.setHeight(sh.height() + 2 * style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this) / 3); 01794 } 01795 return sh; 01796 }
Here is the call graph for this function:

| QSize Q3DockWindow::minimumSize | ( | ) | const |
Reimplemented from QWidget.
Definition at line 1801 of file q3dockwindow.cpp.
References area(), QSize::expandedTo(), fixedExtent(), QSize::height(), hHandleBottom, Qt::Horizontal, InDock, QWidget::isVisible(), QWidget::minimumSize(), orientation(), QStyle::pixelMetric(), place(), QStyle::PM_SplitterWidth, QSize::setHeight(), QSize::setWidth(), QWidget::style(), Qt::Vertical, vHandleRight, and QSize::width().
Referenced by Q3ToolBar::minimumSize().
01802 { 01803 QSize ms(Q3Frame::minimumSize()); 01804 if (place() == InDock) 01805 ms = ms.expandedTo(fixedExtent()); 01806 ms = ms.expandedTo(QSize(16, 16)); 01807 if (area()) { 01808 if (area()->orientation() == Qt::Horizontal && !vHandleRight->isVisible()) 01809 ms.setWidth(ms.width() + 2 * style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this) / 3); 01810 else if (area()->orientation() == Qt::Vertical && !hHandleBottom->isVisible()) 01811 ms.setHeight(ms.height() + 2 * style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this) / 3); 01812 } 01813 return ms; 01814 }
Here is the call graph for this function:

| QSize Q3DockWindow::minimumSizeHint | ( | ) | const [virtual] |
Reimplemented from QWidget.
Definition at line 1819 of file q3dockwindow.cpp.
References area(), QSize::expandedTo(), fixedExtent(), QSize::height(), hHandleBottom, Qt::Horizontal, InDock, QWidget::isVisible(), QWidget::minimumSize(), orientation(), QStyle::pixelMetric(), place(), QStyle::PM_SplitterWidth, QSize::setHeight(), QSize::setWidth(), QWidget::style(), Qt::Vertical, vHandleRight, and QSize::width().
Referenced by Q3ToolBar::minimumSizeHint().
01820 { 01821 QSize msh(Q3Frame::minimumSize()); 01822 if (place() == InDock) 01823 msh = msh.expandedTo(fixedExtent()); 01824 msh = msh.expandedTo(QSize(16, 16)); 01825 if (area()) { 01826 if (area()->orientation() == Qt::Horizontal && !vHandleRight->isVisible()) 01827 msh.setWidth(msh.width() + 2 * style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this) / 3); 01828 else if (area()->orientation() == Qt::Vertical && !hHandleBottom->isVisible()) 01829 msh.setHeight(msh.height() + 2 * style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this) / 3); 01830 } 01831 return msh; 01832 }
Here is the call graph for this function:

| QBoxLayout * Q3DockWindow::boxLayout | ( | ) |
Returns the layout which is used for adding widgets to the dock window. The layout's orientation is set automatically to match the orientation of the dock window. You can add widgets to the layout using the box layout's QBoxLayout::addWidget() function.
If the dock window only needs to contain a single widget use setWidget() instead.
Definition at line 1775 of file q3dockwindow.cpp.
References childBox.
Referenced by Q3ToolBar::event(), handleMove(), orientation(), setOrientation(), Q3ToolBar::setStretchableWidget(), and setWidget().
01776 { 01777 return childBox; 01778 }
| void Q3DockWindow::setOpaqueMoving | ( | bool | b | ) | [virtual] |
Definition at line 1979 of file q3dockwindow.cpp.
References horHandle, opaque, Q3DockWindowHandle::setOpaqueMoving(), Q3DockWindowTitleBar::setOpaqueMoving(), titleBar, and verHandle.
Referenced by Q3MainWindow::addDockWindow().
01980 { 01981 opaque = b; 01982 horHandle->setOpaqueMoving(b); 01983 verHandle->setOpaqueMoving(b); 01984 titleBar->setOpaqueMoving(b); 01985 }
Here is the call graph for this function:

| bool Q3DockWindow::opaqueMoving | ( | ) | const |
Definition at line 1987 of file q3dockwindow.cpp.
References opaque.
Referenced by Q3DockWindowResizeHandle::mouseMoveEvent(), Q3DockWindowResizeHandle::mousePressEvent(), Q3DockWindowTitleBar::mousePressEvent(), Q3DockWindowResizeHandle::mouseReleaseEvent(), and Q3DockWindowTitleBar::mouseReleaseEvent().
01988 { 01989 return opaque; 01990 }
Reimplemented from QObject.
Definition at line 2012 of file q3dockwindow.cpp.
References endRectDraw(), event(), horHandle, QWidget::isWindow(), QKeyEvent::key(), Qt::Key_Escape, QEvent::KeyPress, Q3DockWindowTitleBar::mousePressed, Q3DockWindowHandle::mousePressed, o, opaque, OutsideDock, place(), qApp, titleBar, QEvent::type(), verHandle, QWidget::window(), QEvent::WindowActivate, and QEvent::WindowDeactivate.
02013 { 02014 if (!o->isWidgetType()) 02015 return false; 02016 02017 if (e->type() == QEvent::KeyPress && 02018 (horHandle->mousePressed || 02019 verHandle->mousePressed || 02020 titleBar->mousePressed)) { 02021 QKeyEvent *ke = (QKeyEvent*)e; 02022 if (ke->key() == Qt::Key_Escape) { 02023 horHandle->mousePressed = 02024 verHandle->mousePressed = 02025 titleBar->mousePressed = false; 02026 endRectDraw(!opaque); 02027 qApp->removeEventFilter(this); 02028 return true; 02029 } 02030 } else if (((QWidget*)o)->window() != this && place() == OutsideDock && isWindow()) { 02031 if ((e->type() == QEvent::WindowDeactivate || 02032 e->type() == QEvent::WindowActivate)) 02033 event(e); 02034 } 02035 return false; 02036 }
Here is the call graph for this function:

| QString Q3DockWindow::windowTitle | ( | ) | const |
Returns the dock window's title.
Reimplemented from QWidget.
Definition at line 2072 of file q3dockwindow.cpp.
References titleBar, and QWidget::windowTitle().
Referenced by loadDockArea(), Q3MainWindow::operator<<(), saveDockArea(), and Q3DockWindowHandle::windowTitle().
02073 { 02074 return titleBar->windowTitle(); 02075 }
Here is the call graph for this function:

| void Q3DockWindow::orientationChanged | ( | Qt::Orientation | o | ) | [signal] |
This signal is emitted when the orientation of the dock window is changed. The new orientation is o.
Referenced by dock(), init(), undock(), and updatePosition().
| void Q3DockWindow::placeChanged | ( | Q3DockWindow::Place | p | ) | [signal] |
This signal is emitted when the dock window is docked (p is InDock), undocked (p is OutsideDock) or moved inside the the dock area.
Referenced by dock(), undock(), and updatePosition().
| void Q3DockWindow::visibilityChanged | ( | bool | visible | ) | [signal] |
This signal is emitted when the visibility of the dock window relatively to its dock area is changed. If visible is true, the Q3DockWindow is now visible to the dock area, otherwise it has been hidden.
A dock window can be hidden if it has a close button which the user has clicked. In the case of a Q3MainWindow a dock window can have its visibility changed (hidden or shown) by clicking its name in the dock window menu that lists the Q3MainWindow's dock windows.
Referenced by event().
| void Q3DockWindow::undock | ( | QWidget * | widget | ) | [virtual, slot] |
Undocks the specified widget from its current dock area if it is docked; otherwise does nothing.
Definition at line 1855 of file q3dockwindow.cpp.
References QWidget::adjustSize(), area(), curPlace, dockArea, dockWindowData, Q3DockArea::dockWindowData(), emit, QWidget::height(), Qt::Horizontal, Q3MainWindow::isDockEnabled(), QWidget::isVisible(), QWidget::isWindow(), lastPos, lastSize, QWidget::move(), orientation(), orientationChanged(), OutsideDock, p, QWidget::parentWidget(), place(), placeChanged(), QWidget::pos(), Q3DockArea::removeDockWindow(), QWidget::resize(), QCoreApplication::sendPostedEvents(), QWidget::setAttribute(), QWidget::setParent(), QWidget::show(), updateGui(), w, Qt::WA_Resized, QWidget::width(), QWidget::window(), QPoint::x(), and QPoint::y().
Referenced by Q3MainWindow::moveDockWindow().
01856 { 01857 Q3MainWindow *mw = 0; 01858 if (area()) 01859 mw = qobject_cast<Q3MainWindow*>(area()->parentWidget()); 01860 if (mw && !mw->isDockEnabled(this, Qt::DockTornOff)) 01861 return; 01862 if ((place() == OutsideDock && !w)) 01863 return; 01864 01865 QPoint p(50, 50); 01866 if (window()) 01867 p = window()->pos() + QPoint(20, 20); 01868 if (dockArea) { 01869 delete (Q3DockArea::DockWindowData*)dockWindowData; 01870 dockWindowData = dockArea->dockWindowData(this); 01871 dockArea->removeDockWindow(this, true, orientation() != Qt::Horizontal && qobject_cast<Q3ToolBar*>(this)); 01872 } 01873 dockArea = 0; 01874 if (lastPos != QPoint(-1, -1) && lastPos.x() > 0 && lastPos.y() > 0) 01875 move(lastPos); 01876 else 01877 move(p); 01878 if (lastSize != QSize(-1, -1)) 01879 resize(lastSize); 01880 curPlace = OutsideDock; 01881 updateGui(); 01882 emit orientationChanged(orientation()); 01883 QApplication::sendPostedEvents(this, QEvent::LayoutHint); 01884 if (qobject_cast<Q3ToolBar*>(this)) 01885 adjustSize(); 01886 if (!w) { 01887 if (!parentWidget() || parentWidget()->isVisible()) { 01888 if (lastSize == QSize(-1, -1)) 01889 setAttribute(Qt::WA_Resized, false);// Ensures size is recalculated (opaque). 01890 show(); 01891 } 01892 } else { 01893 setParent(w, 0); 01894 move(-width() - 5, -height() - 5); 01895 resize(1, 1); 01896 show(); 01897 } 01898 if (parentWidget() && isWindow()) 01899 parentWidget()->setActiveWindow(); 01900 emit placeChanged(place()); 01901 }
| void Q3DockWindow::undock | ( | ) | [inline, virtual, slot] |
Undocks the Q3DockWindow from its current dock area if it is docked; otherwise does nothing.
Definition at line 141 of file q3dockwindow.h.
Referenced by handleMove(), and init().
00141 { undock(0); }
| void Q3DockWindow::dock | ( | ) | [virtual, slot] |
Docks the dock window into the last dock area in which it was docked.
If the dock window has no last dock area (e.g. it was created as a floating window and has never been docked), or if the last dock area it was docked in does not exist (e.g. the dock area has been deleted), nothing happens.
The dock window will dock with the dock area regardless of the return value of Q3DockArea::isDockWindowAccepted().
Definition at line 1927 of file q3dockwindow.cpp.
References area(), curPlace, Q3DockArea::dockWindow(), dockWindowData, emit, InDock, lastPos, lastSize, orientation(), orientationChanged(), place(), placeChanged(), QWidget::pos(), and QWidget::size().
Referenced by init(), and QHideDock::mouseReleaseEvent().
01928 { 01929 if (!(Q3DockArea::DockWindowData*)dockWindowData || 01930 !((Q3DockArea::DockWindowData*)dockWindowData)->area) 01931 return; 01932 curPlace = InDock; 01933 lastPos = pos(); 01934 lastSize = size(); 01935 ((Q3DockArea::DockWindowData*)dockWindowData)-> 01936 area->dockWindow(this, (Q3DockArea::DockWindowData*)dockWindowData); 01937 emit orientationChanged(orientation()); 01938 emit placeChanged(place()); 01939 }
| void Q3DockWindow::setOrientation | ( | Qt::Orientation | o | ) | [virtual, slot] |
Sets the orientation of the dock window to o. The orientation is propagated to the layout boxLayout().
Definition at line 1103 of file q3dockwindow.cpp.
References boxLayout(), hHandleBottom, hHandleTop, Qt::Horizontal, QWidget::layout(), QBoxLayout::LeftToRight, QCoreApplication::postEvent(), QLayout::removeWidget(), QCoreApplication::sendPostedEvents(), QBoxLayout::setDirection(), QBoxLayout::TopToBottom, vHandleLeft, and vHandleRight.
Referenced by init(), Q3MainWindow::moveDockWindow(), and Q3ToolBar::setOrientation().
01104 { 01105 QGridLayout *glayout = (QGridLayout*)layout(); 01106 glayout->removeWidget(hHandleTop); 01107 glayout->removeWidget(hHandleBottom); 01108 glayout->removeWidget(vHandleLeft); 01109 glayout->removeWidget(vHandleRight); 01110 01111 if (o == Qt::Horizontal) { 01112 // Set up the new layout as 01113 // 3 3 3 1 = vHandleLeft 4 = hHandleBottom 01114 // 1 X 2 2 = vHandleRight X = Inner Layout 01115 // 4 4 4 3 = hHandleTop 01116 glayout->addMultiCellWidget(hHandleTop, 0, 0, 0, 2); 01117 glayout->addMultiCellWidget(hHandleBottom, 2, 2, 0, 2); 01118 glayout->addMultiCellWidget(vHandleLeft, 1, 1, 0, 0); 01119 glayout->addMultiCellWidget(vHandleRight, 1, 1, 2, 2); 01120 } else { 01121 // Set up the new layout as 01122 // 1 3 2 1 = vHandleLeft 4 = hHandleBottom 01123 // 1 X 2 2 = vHandleRight X = Inner Layout 01124 // 1 4 2 3 = hHandleTop 01125 glayout->addMultiCellWidget(hHandleTop, 0, 0, 1, 1); 01126 glayout->addMultiCellWidget(hHandleBottom, 2, 2, 1, 1); 01127 glayout->addMultiCellWidget(vHandleLeft, 0, 2, 0, 0); 01128 glayout->addMultiCellWidget(vHandleRight, 0, 2, 2, 2); 01129 } 01130 boxLayout()->setDirection(o == Qt::Horizontal ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom); 01131 QApplication::sendPostedEvents(this, QEvent::LayoutHint); 01132 QEvent *e = new QEvent(QEvent::LayoutHint); 01133 QApplication::postEvent(this, e); 01134 }
| void Q3DockWindow::resizeEvent | ( | QResizeEvent * | e | ) | [protected, virtual] |
Reimplemented from Q3Frame.
Definition at line 1158 of file q3dockwindow.cpp.
References Q3Frame::resizeEvent(), and updateGui().
Referenced by Q3ToolBar::resizeEvent().
01159 { 01160 Q3Frame::resizeEvent(e); 01161 updateGui(); 01162 }
Here is the call graph for this function:

| void Q3DockWindow::showEvent | ( | QShowEvent * | e | ) | [protected, virtual] |
Reimplemented from QWidget.
Definition at line 1952 of file q3dockwindow.cpp.
References QRect::bottom(), QRect::contains(), curPlace, QWidget::height(), QWidget::move(), QObject::objectName(), OutsideDock, QObject::parent(), QWidget::pos(), qApp, qMax(), qMin(), QRect::right(), QWidget::showEvent(), QWidget::width(), QRect::x(), QWidget::x(), QRect::y(), and QWidget::y().
01953 { 01954 if (curPlace == OutsideDock && (parent() && parent()->objectName() == QLatin1String("qt_hide_dock"))) { 01955 QRect sr = qApp->desktop()->availableGeometry(this); 01956 if (!sr.contains(pos())) { 01957 int nx = qMin(qMax(x(), sr.x()), sr.right()-width()); 01958 int ny = qMin(qMax(y(), sr.y()), sr.bottom()-height()); 01959 move(nx, ny); 01960 } 01961 } 01962 01963 Q3Frame::showEvent(e); 01964 }
Here is the call graph for this function:

| void Q3DockWindow::hideEvent | ( | QHideEvent * | e | ) | [protected, virtual] |
Reimplemented from QWidget.
Definition at line 1944 of file q3dockwindow.cpp.
References QWidget::hideEvent().
01945 { 01946 Q3Frame::hideEvent(e); 01947 }
Here is the call graph for this function:

| void Q3DockWindow::contextMenuEvent | ( | QContextMenuEvent * | e | ) | [protected, virtual] |
Reimplemented from QWidget.
Definition at line 2078 of file q3dockwindow.cpp.
References QContextMenuEvent::globalPos(), QEvent::ignore(), and o.
02079 { 02080 QObject *o = this; 02081 while (o) { 02082 if (qobject_cast<Q3MainWindow*>(o)) 02083 break; 02084 o = o->parent(); 02085 } 02086 if (!o || ! ((Q3MainWindow*)o)->showDockMenu(e->globalPos())) 02087 e->ignore(); 02088 }
Here is the call graph for this function:

| void Q3DockWindow::drawFrame | ( | QPainter * | p | ) | [protected, virtual] |
Reimplemented from Q3Frame.
Definition at line 1484 of file q3dockwindow.cpp.
References Q3Frame::drawFrame(), QStyle::drawPrimitive(), InDock, Q3TitleBar::isActive(), QFrame::lineWidth(), QStyleOptionFrame::lineWidth, QFrame::midLineWidth(), QStyleOptionFrame::midLineWidth, p, QWidget::palette(), QStyleOption::palette, QStyle::PE_FrameWindow, place(), QStyleOption::rect, QWidget::rect(), QStyleOption::state, QStyle::State_Active, QStyle::State_None, QWidget::style(), and titleBar.
01485 { 01486 if (place() == InDock) { 01487 Q3Frame::drawFrame(p); 01488 return; 01489 } 01490 01491 QStyleOptionFrame opt; 01492 opt.rect = rect(); 01493 opt.palette = palette(); 01494 opt.state = QStyle::State_None; 01495 if (titleBar->isActive()) 01496 opt.state |= QStyle::State_Active; 01497 opt.lineWidth = lineWidth(); 01498 opt.midLineWidth = midLineWidth(); 01499 01500 style()->drawPrimitive(QStyle::PE_FrameWindow, &opt, p, this); 01501 }
Here is the call graph for this function:

| void Q3DockWindow::drawContents | ( | QPainter * | p | ) | [protected, virtual] |
Reimplemented from Q3Frame.
Definition at line 1506 of file q3dockwindow.cpp.
References QStyle::CE_Q3DockWindowEmptyArea, QStyle::drawControl(), QStyleOption::init(), Q3TitleBar::isActive(), p, QStyleOption::SO_Default, QStyleOption::state, QStyle::State_Active, QWidget::style(), and titleBar.
01507 { 01508 // This is only used by the PocketPC style. We probably need to revist later. 01509 QStyleOption opt(0, QStyleOption::SO_Default); 01510 opt.init(this); 01511 if (titleBar->isActive()) 01512 opt.state |= QStyle::State_Active; 01513 style()->drawControl(QStyle::CE_Q3DockWindowEmptyArea, &opt, p, this); 01514 }
Here is the call graph for this function:

| bool Q3DockWindow::event | ( | QEvent * | e | ) | [protected, virtual] |
Reimplemented from QFrame.
Definition at line 2039 of file q3dockwindow.cpp.
References emit, QFrame::event(), QEvent::HideToParent, horHandle, QWidget::isActiveWindow(), QWidget::isWindow(), OutsideDock, QWidget::parentWidget(), place(), s, QWidget::setToolTip(), QWidget::setWindowTitle(), QEvent::ShowToParent, titleBar, QEvent::type(), verHandle, visibilityChanged(), QEvent::WindowDeactivate, QWidget::windowTitle(), and QEvent::WindowTitleChange.
Referenced by Q3ToolBar::event(), and eventFilter().
02040 { 02041 switch (e->type()) { 02042 case QEvent::WindowDeactivate: 02043 if (place() == OutsideDock && isWindow() && parentWidget() 02044 && parentWidget()->isActiveWindow()) 02045 return true; 02046 break; 02047 case QEvent::HideToParent: 02048 emit visibilityChanged(false); 02049 break; 02050 case QEvent::ShowToParent: 02051 emit visibilityChanged(true); 02052 break; 02053 case QEvent::WindowTitleChange: 02054 { 02055 QString s = Q3Frame::windowTitle(); 02056 titleBar->setWindowTitle(s); 02057 #ifndef QT_NO_TOOLTIP 02058 horHandle->setToolTip(s); 02059 verHandle->setToolTip(s); 02060 #endif 02061 break; 02062 } 02063 default: 02064 break; 02065 } 02066 return Q3Frame::event(e); 02067 }
Here is the call graph for this function:

| void Q3DockWindow::toggleVisible | ( | ) | [inline, private, slot] |
Definition at line 157 of file q3dockwindow.h.
References QWidget::isVisible(), and QWidget::setVisible().
00157 { setVisible(!isVisible()); }
Definition at line 1200 of file q3dockwindow.cpp.
References area(), areaAt(), boxLayout(), Q3DockWindowHandle::ctrlDown, Q3DockWindowTitleBar::ctrlDown, currRect, QBoxLayout::direction(), QWidget::height(), horHandle, Qt::Horizontal, InDock, QWidget::isVisible(), Qt::LeftButton, QBoxLayout::LeftToRight, QWidget::mapToGlobal(), QEvent::MouseButtonPress, QWidget::move(), o, Q3DockArea::orientation(), OutsideDock, place(), QWidget::pos(), realWidgetPos(), QBoxLayout::RightToLeft, rubberBand, QCoreApplication::sendEvent(), QRubberBand::setGeometry(), QWidget::size(), startOffset, startOrientation, state, swapRect(), titleBar, tmpDockArea, undock(), verHandle, Qt::Vertical, w, QWidget::width(), QPoint::x(), and QPoint::y().
Referenced by Q3DockWindowTitleBar::keyPressEvent(), Q3DockWindowHandle::keyPressEvent(), Q3DockWindowHandle::keyReleaseEvent(), Q3DockWindowTitleBar::keyReleaseEvent(), Q3DockWindowHandle::mouseMoveEvent(), and Q3DockWindowTitleBar::mouseMoveEvent().
01201 { 01202 if (!rubberBand) 01203 return; 01204 01205 currRect = QRect(realWidgetPos(this), size()); 01206 QWidget *w = areaAt(gp); 01207 if (titleBar->ctrlDown || horHandle->ctrlDown || verHandle->ctrlDown) 01208 w = 0; 01209 currRect.moveBy(pos.x(), pos.y()); 01210 if (!qobject_cast<Q3DockArea*>(w)) { 01211 if (startOrientation != Qt::Horizontal && qobject_cast<Q3ToolBar*>(this)) 01212 swapRect(currRect, Qt::Horizontal, startOffset, (Q3DockArea*)w); 01213 if (drawRect) { 01214 rubberBand->setGeometry(currRect); 01215 } else { 01216 QPoint mp(mapToGlobal(pos)); 01217 if(place() == InDock) { 01218 undock(); 01219 if(titleBar) { 01220 mp = QPoint(titleBar->width() / 2, titleBar->height() / 2); 01221 QMouseEvent me(QEvent::MouseButtonPress, mp, Qt::LeftButton, 0); 01222 QApplication::sendEvent(titleBar, &me); 01223 mp = titleBar->mapToGlobal(mp); 01224 } 01225 } 01226 move(mp); 01227 } 01228 state = OutsideDock; 01229 return; 01230 } 01231 01232 Q3DockArea *area = (Q3DockArea*)w; 01233 if(area->isVisible()) { 01234 state = InDock; 01235 Qt::Orientation o = (area ? area->orientation() : 01236 (boxLayout()->direction() == QBoxLayout::LeftToRight || 01237 boxLayout()->direction() == QBoxLayout::RightToLeft ? 01238 Qt::Horizontal : Qt::Vertical)); 01239 if (startOrientation != o) 01240 swapRect(currRect, o, startOffset, area); 01241 if (drawRect) { 01242 rubberBand->setGeometry(currRect); 01243 } 01244 tmpDockArea = area; 01245 } 01246 }
Here is the call graph for this function:

| void Q3DockWindow::updateGui | ( | ) | [private] |
Definition at line 1248 of file q3dockwindow.cpp.
References area(), curPlace, QWidget::grabMouse(), hbox, hHandleBottom, hHandleTop, QWidget::hide(), horHandle, Qt::Horizontal, isResizeEnabled(), Q3DockWindowHandle::mousePressed, moveEnabled, Q3DockArea::Normal, orientation(), OutsideDock, QWidget::raise(), QWidgetResizeHandler::setActive(), QFrame::setLineWidth(), QLayout::setMargin(), QWidget::show(), titleBar, Q3DockWindowHandle::updateGui(), Q3DockWindowTitleBar::updateGui(), verHandle, vHandleLeft, vHandleRight, and widgetResizeHandler.
Referenced by init(), resizeEvent(), setMovingEnabled(), setResizeEnabled(), setWidget(), undock(), and updatePosition().
01249 { 01250 if (curPlace == OutsideDock) { 01251 hbox->setMargin(2); 01252 horHandle->hide(); 01253 verHandle->hide(); 01254 if (moveEnabled) 01255 titleBar->show(); 01256 else 01257 titleBar->hide(); 01258 titleBar->updateGui(); 01259 hHandleTop->hide(); 01260 vHandleLeft->hide(); 01261 hHandleBottom->hide(); 01262 vHandleRight->hide(); 01263 setLineWidth(2); 01264 widgetResizeHandler->setActive(isResizeEnabled()); 01265 } else { 01266 hbox->setMargin(0); 01267 titleBar->hide(); 01268 if (orientation() == Qt::Horizontal) { 01269 horHandle->hide(); 01270 if (moveEnabled) 01271 verHandle->show(); 01272 else 01273 verHandle->hide(); 01274 #ifdef Q_WS_MAC 01275 if(horHandle->mousePressed) { 01276 horHandle->mousePressed = false; 01277 verHandle->mousePressed = true; 01278 verHandle->grabMouse(); 01279 } 01280 #endif 01281 verHandle->updateGui(); 01282 } else { 01283 if (moveEnabled) 01284 horHandle->show(); 01285 else 01286 horHandle->hide(); 01287 horHandle->updateGui(); 01288 #ifdef Q_WS_MAC 01289 if(verHandle->mousePressed) { 01290 verHandle->mousePressed = false; 01291 horHandle->mousePressed = true; 01292 horHandle->grabMouse(); 01293 } 01294 #endif 01295 verHandle->hide(); 01296 } 01297 if (isResizeEnabled()) { 01298 if (orientation() == Qt::Horizontal) { 01299 hHandleBottom->raise(); 01300 hHandleTop->raise(); 01301 } else { 01302 vHandleRight->raise(); 01303 vHandleLeft->raise(); 01304 } 01305 01306 if (area()) { 01307 if (orientation() == Qt::Horizontal) { 01308 if (area()->handlePosition() == Q3DockArea::Normal) { 01309 hHandleBottom->show(); 01310 hHandleTop->hide(); 01311 } else { 01312 hHandleTop->show(); 01313 hHandleBottom->hide(); 01314 } 01315 if (!area()->isLastDockWindow(this)) 01316 vHandleRight->show(); 01317 else 01318 vHandleRight->hide(); 01319 vHandleLeft->hide(); 01320 } else { 01321 if ((area()->handlePosition() == Q3DockArea::Normal) != QApplication::reverseLayout()) { 01322 vHandleRight->show(); 01323 vHandleLeft->hide(); 01324 } else { 01325 vHandleLeft->show(); 01326 vHandleRight->hide(); 01327 } 01328 if (!area()->isLastDockWindow(this)) 01329 hHandleBottom->show(); 01330 else 01331 hHandleBottom->hide(); 01332 hHandleTop->hide(); 01333 } 01334 } 01335 } 01336 #ifndef Q_OS_TEMP 01337 if (moveEnabled) 01338 setLineWidth(1); 01339 else 01340 setLineWidth(0); 01341 #endif 01342 widgetResizeHandler->setActive(false); 01343 } 01344 }
Here is the call graph for this function:

| void Q3DockWindow::updateSplitterVisibility | ( | bool | visible | ) | [private] |
Definition at line 1992 of file q3dockwindow.cpp.
References area(), hHandleBottom, hHandleTop, QWidget::hide(), Qt::Horizontal, isResizeEnabled(), orientation(), QWidget::show(), vHandleLeft, and vHandleRight.
01993 { 01994 if (area() && isResizeEnabled()) { 01995 if (orientation() == Qt::Horizontal) { 01996 if (visible) 01997 vHandleRight->show(); 01998 else 01999 vHandleRight->hide(); 02000 vHandleLeft->hide(); 02001 } else { 02002 if (visible) 02003 hHandleBottom->show(); 02004 else 02005 hHandleBottom->hide(); 02006 hHandleTop->hide(); 02007 } 02008 } 02009 }
Here is the call graph for this function:

| void Q3DockWindow::startRectDraw | ( | const QPoint & | so, | |
| bool | drawRect | |||
| ) | [private] |
Definition at line 1460 of file q3dockwindow.cpp.
References currRect, endRectDraw(), QWidget::mapFromGlobal(), opaque, orientation(), place(), realWidgetPos(), QRubberBand::Rectangle, rubberBand, QRubberBand::setGeometry(), QWidget::show(), QWidget::size(), startOffset, startOrientation, and state.
Referenced by Q3DockWindowTitleBar::mousePressEvent(), and Q3DockWindowHandle::mousePressEvent().
01461 { 01462 state = place(); 01463 if (rubberBand) 01464 endRectDraw(!opaque); 01465 rubberBand = new QRubberBand(QRubberBand::Rectangle); 01466 currRect = QRect(realWidgetPos(this), size()); 01467 if (drawRect) { 01468 rubberBand->setGeometry(currRect); 01469 } 01470 startOrientation = orientation(); 01471 startOffset = mapFromGlobal(so); 01472 rubberBand->show(); 01473 }
Here is the call graph for this function:

| void Q3DockWindow::endRectDraw | ( | bool | drawRect | ) | [private] |
Definition at line 1475 of file q3dockwindow.cpp.
References rubberBand.
Referenced by eventFilter(), Q3DockWindowTitleBar::mouseReleaseEvent(), Q3DockWindowHandle::mouseReleaseEvent(), and startRectDraw().
01476 { 01477 delete rubberBand; 01478 rubberBand = 0; 01479 }
| void Q3DockWindow::updatePosition | ( | const QPoint & | globalPos | ) | [private] |
Definition at line 1346 of file q3dockwindow.cpp.
References QWidget::adjustSize(), QRect::bottom(), QRect::contains(), curPlace, currRect, dockArea, dockWindowData, Q3DockArea::dockWindowData(), emit, QWidget::height(), Qt::Horizontal, InDock, QWidget::isWindow(), lastSize, QRect::left(), QWidget::move(), Q3DockArea::moveDockWindow(), orientation(), orientationChanged(), OutsideDock, QWidget::parentWidget(), placeChanged(), qApp, qMax(), qMin(), Q3DockArea::removeDockWindow(), QWidget::resize(), QRect::right(), QCoreApplication::sendPostedEvents(), QWidget::setAttribute(), QPoint::setX(), QPoint::setY(), QWidget::show(), QWidget::size(), startOrientation, state, tmpDockArea, QRect::top(), QRect::topLeft(), updateGui(), Qt::WA_Resized, QWidget::width(), QPoint::x(), and QPoint::y().
Referenced by Q3DockWindowHandle::mouseMoveEvent(), Q3DockWindowTitleBar::mouseReleaseEvent(), and Q3DockWindowHandle::mouseReleaseEvent().
01347 { 01348 if (curPlace == OutsideDock && state == InDock) 01349 lastSize = size(); 01350 01351 bool doAdjustSize = curPlace != state && state == OutsideDock; 01352 bool doUpdate = true; 01353 bool doOrientationChange = true; 01354 if (state != curPlace && state == InDock) { 01355 doUpdate = false; 01356 curPlace = state; 01357 updateGui(); 01358 QApplication::sendPostedEvents(); 01359 } 01360 Qt::Orientation oo = orientation(); 01361 01362 if (state == InDock) { 01363 if (tmpDockArea) { 01364 bool differentDocks = false; 01365 if (dockArea && dockArea != tmpDockArea) { 01366 differentDocks = true; 01367 delete (Q3DockArea::DockWindowData*)dockWindowData; 01368 dockWindowData = dockArea->dockWindowData(this); 01369 dockArea->removeDockWindow(this, false, false); 01370 } 01371 dockArea = tmpDockArea; 01372 if (differentDocks) { 01373 if (doUpdate) { 01374 doUpdate = false; 01375 curPlace = state; 01376 updateGui(); 01377 } 01378 emit orientationChanged(tmpDockArea->orientation()); 01379 doOrientationChange = false; 01380 } else { 01381 updateGui(); 01382 } 01383 dockArea->moveDockWindow(this, globalPos, currRect, startOrientation != oo); 01384 } 01385 } else { 01386 if (dockArea) { 01387 Q3MainWindow *mw = (Q3MainWindow*)dockArea->parentWidget(); 01388 if (qobject_cast<Q3MainWindow*>(mw) && 01389 (!mw->isDockEnabled(Qt::DockTornOff) || 01390 !mw->isDockEnabled(this, Qt::DockTornOff))) 01391 return; 01392 delete (Q3DockArea::DockWindowData*)dockWindowData; 01393 dockWindowData = dockArea->dockWindowData(this); 01394 dockArea->removeDockWindow(this, true, 01395 startOrientation != Qt::Horizontal && qobject_cast<Q3ToolBar*>(this)); 01396 } 01397 dockArea = 0; 01398 QPoint topLeft = currRect.topLeft(); 01399 QRect screen = qApp->desktop()->availableGeometry(topLeft); 01400 if (!screen.contains(topLeft)) { 01401 topLeft.setY(qMax(topLeft.y(), screen.top())); 01402 topLeft.setY(qMin(topLeft.y(), screen.bottom()-height())); 01403 topLeft.setX(qMax(topLeft.x(), screen.left())); 01404 topLeft.setX(qMin(topLeft.x(), screen.right()-width())); 01405 } 01406 move(topLeft); 01407 } 01408 01409 if (curPlace == InDock && state == OutsideDock && !qobject_cast<Q3ToolBar*>(this)) { 01410 if (lastSize != QSize(-1, -1)) 01411 resize(lastSize); 01412 } 01413 01414 if (doUpdate) { 01415 curPlace = state; 01416 updateGui(); 01417 } 01418 if (doOrientationChange) 01419 emit orientationChanged(orientation()); 01420 tmpDockArea = 0; 01421 if (doAdjustSize) { 01422 QApplication::sendPostedEvents(this, QEvent::LayoutHint); 01423 if (qobject_cast<Q3ToolBar*>(this)) 01424 adjustSize(); 01425 if (lastSize == QSize(-1, -1)) 01426 setAttribute(Qt::WA_Resized, false); // Ensures size is recalculated (non-opaque). 01427 show(); 01428 if (parentWidget() && isWindow()) 01429 parentWidget()->setActiveWindow(); 01430 01431 } 01432 01433 emit placeChanged(curPlace); 01434 }
Here is the call graph for this function:

Definition at line 1176 of file q3dockwindow.cpp.
References a, QWidget::childAt(), Q3MainWindow::dockingArea(), QWidget::mapFromGlobal(), QWidget::parentWidget(), qApp, titleBar, and w.
Referenced by handleMove().
01177 { 01178 QWidget *w = qApp->widgetAt(gp); 01179 01180 if (w && (w == this || w == titleBar) && parentWidget()) 01181 w = parentWidget()->childAt(parentWidget()->mapFromGlobal(gp)); 01182 01183 while (w) { 01184 if (qobject_cast<Q3DockArea*>(w)) { 01185 Q3DockArea *a = (Q3DockArea*)w; 01186 if (a->isDockWindowAccepted(this)) 01187 return w; 01188 } 01189 if (qobject_cast<Q3MainWindow*>(w)) { 01190 Q3MainWindow *mw = (Q3MainWindow*)w; 01191 Q3DockArea *a = mw->dockingArea(mw->mapFromGlobal(gp)); 01192 if (a && a->isDockWindowAccepted(this)) 01193 return a; 01194 } 01195 w = w->isWindow() ? 0 : (QWidget *)w->parent(); 01196 } 01197 return 0; 01198 }
Here is the call graph for this function:

| void Q3DockWindow::removeFromDock | ( | bool | fixNewLines = true |
) | [private] |
Definition at line 1903 of file q3dockwindow.cpp.
References dockArea, and Q3DockArea::removeDockWindow().
Referenced by Q3MainWindow::moveDockWindow().
01904 { 01905 if (dockArea) 01906 dockArea->removeDockWindow(this, false, false, fixNewLines); 01907 }
Here is the call graph for this function:

| void Q3DockWindow::swapRect | ( | QRect & | r, | |
| Qt::Orientation | o, | |||
| const QPoint & | offset, | |||
| Q3DockArea * | area | |||
| ) | [private] |
Definition at line 1165 of file q3dockwindow.cpp.
References QRect::height(), Qt::Horizontal, offset(), reverse(), QRect::setSize(), and QRect::width().
Referenced by handleMove().
01166 { 01167 r.setSize(QSize(r.height(), r.width())); 01168 bool reverse = QApplication::reverseLayout(); 01169 if (o == Qt::Horizontal) 01170 r.moveBy(-r.width()/2, 0); 01171 else 01172 r.moveBy(reverse ? - r.width() : 0, -r.height() / 2 ); 01173 r.moveBy(offset.x(), offset.y()); 01174 }
Here is the call graph for this function:

| void Q3DockWindow::init | ( | ) | [private] |
Definition at line 988 of file q3dockwindow.cpp.
References QGridLayout::addLayout(), QBoxLayout::addLayout(), QBoxLayout::addSpacing(), QBoxLayout::addStretch(), QBoxLayout::addWidget(), Q3MainWindow::bottomDock(), childBox, cMode, QObject::connect(), curPlace, default_opaque, dock(), dockArea, dockWindowData, fExtent, QSizePolicy::Fixed, hbox, hHandleBottom, hHandleTop, QWidget::hide(), horHandle, Qt::Horizontal, InDock, QObject::installEventFilter(), isResizeEnabled(), lastPos, lastSize, Q3MainWindow::leftDock(), QBoxLayout::LeftToRight, Q3DockArea::moveDockWindow(), moveEnabled, Never, nl, offs, opaque, orientationChanged(), OutsideDock, QWidget::parentWidget(), place(), QSizePolicy::Preferred, Q3DockWindowHandle, Q3DockWindowTitleBar, QFrame::Raised, resizeEnabled, Q3MainWindow::rightDock(), rubberBand, QFrame::setFrameStyle(), QFrame::setLineWidth(), QLayout::setMargin(), QWidgetResizeHandler::setMovingEnabled(), setOrientation(), QGridLayout::setRowStretch(), QWidget::setSizePolicy(), QLayout::setSpacing(), SIGNAL, SLOT, stretchable, QFrame::StyledPanel, titleBar, tmpDockArea, undock(), updateGui(), vbox, verHandle, Qt::Vertical, vHandleLeft, vHandleRight, wid, and widgetResizeHandler.
Referenced by Q3DockWindow().
00989 { 00990 wid = 0; 00991 rubberBand = 0; 00992 dockArea = 0; 00993 tmpDockArea = 0; 00994 resizeEnabled = false; 00995 moveEnabled = true; 00996 nl = false; 00997 opaque = default_opaque; 00998 cMode = Never; 00999 offs = 0; 01000 fExtent = QSize(-1, -1); 01001 dockWindowData = 0; 01002 lastPos = QPoint(-1, -1); 01003 lastSize = QSize(-1, -1); 01004 stretchable[Qt::Horizontal] = false; 01005 stretchable[Qt::Vertical] = false; 01006 01007 widgetResizeHandler = new QWidgetResizeHandler(this); 01008 widgetResizeHandler->setMovingEnabled(false); 01009 01010 titleBar = new Q3DockWindowTitleBar(this); 01011 verHandle = new Q3DockWindowHandle(this); 01012 verHandle->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred)); 01013 horHandle = new Q3DockWindowHandle(this); 01014 horHandle->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed)); 01015 01016 vHandleLeft = new Q3DockWindowResizeHandle(Qt::Vertical, this, this, "vert. handle"); 01017 vHandleRight = new Q3DockWindowResizeHandle(Qt::Vertical, this, this, "vert. handle"); 01018 hHandleTop = new Q3DockWindowResizeHandle(Qt::Horizontal, this, this, "horz. handle"); 01019 hHandleBottom = new Q3DockWindowResizeHandle(Qt::Horizontal, this, this, "horz. handle"); 01020 01021 // Creating inner layout 01022 hbox = new QVBoxLayout(); 01023 vbox = new QHBoxLayout(); 01024 childBox = new QBoxLayout(QBoxLayout::LeftToRight); 01025 vbox->addSpacing(2); 01026 vbox->addWidget(verHandle); 01027 vbox->addStretch(0); 01028 vbox->addLayout(childBox, 1); 01029 vbox->addStretch(0); 01030 01031 hbox->setResizeMode(QLayout::FreeResize); 01032 hbox->setMargin(isResizeEnabled() || curPlace == OutsideDock ? 2 : 0); 01033 hbox->setSpacing(1); 01034 hbox->addWidget(titleBar); 01035 hbox->addWidget(horHandle); 01036 hbox->addLayout(vbox); 01037 01038 // Set up the initial handle layout for Qt::Vertical 01039 // Handle layout will change on calls to setOrienation() 01040 QGridLayout *glayout = new Q3DockWindowGridLayout(this, 3, 3); 01041 glayout->setResizeMode(QLayout::Minimum); 01042 glayout->addMultiCellWidget(hHandleTop, 0, 0, 1, 1); 01043 glayout->addMultiCellWidget(hHandleBottom, 2, 2, 1, 1); 01044 glayout->addMultiCellWidget(vHandleLeft, 0, 2, 0, 0); 01045 glayout->addMultiCellWidget(vHandleRight, 0, 2, 2, 2); 01046 glayout->addLayout(hbox, 1, 1); 01047 glayout->setRowStretch(1, 1); 01048 glayout->setColStretch(1, 1); 01049 01050 hHandleBottom->hide(); 01051 vHandleRight->hide(); 01052 hHandleTop->hide(); 01053 vHandleLeft->hide(); 01054 setFrameStyle(Q3Frame::StyledPanel | Q3Frame::Raised); 01055 setLineWidth(2); 01056 01057 if (parentWidget()) 01058 parentWidget()->installEventFilter(this); 01059 QWidget *mw = parentWidget(); 01060 Q3DockArea *da = qobject_cast<Q3DockArea*>(parentWidget()); 01061 if (da) { 01062 if (curPlace == InDock) 01063 da->moveDockWindow(this); 01064 mw = da->parentWidget(); 01065 } 01066 if (qobject_cast<Q3MainWindow*>(mw)) { 01067 if (place() == InDock) { 01068 Qt::Dock myDock = Qt::DockTop; 01069 // make sure we put the window in the correct dock. 01070 if (dockArea) { 01071 Q3MainWindow *mainw = (Q3MainWindow*)mw; 01072 // I'm not checking if it matches the top because I've 01073 // done the assignment to it above. 01074 if (dockArea == mainw->leftDock()) 01075 myDock = Qt::DockLeft; 01076 else if (dockArea == mainw->rightDock()) 01077 myDock = Qt::DockRight; 01078 else if (dockArea == mainw->bottomDock()) 01079 myDock = Qt::DockBottom; 01080 } 01081 ((Q3MainWindow*)mw)->addDockWindow(this, myDock); 01082 } 01083 moveEnabled = ((Q3MainWindow*)mw)->dockWindowsMovable(); 01084 opaque = ((Q3MainWindow*)mw)->opaqueMoving(); 01085 } 01086 01087 updateGui(); 01088 01089 connect(titleBar, SIGNAL(doubleClicked()), this, SLOT(dock())); 01090 connect(verHandle, SIGNAL(doubleClicked()), this, SLOT(undock())); 01091 connect(horHandle, SIGNAL(doubleClicked()), this, SLOT(undock())); 01092 connect(this, SIGNAL(orientationChanged(Qt::Orientation)), 01093 this, SLOT(setOrientation(Qt::Orientation))); 01094 }
Here is the call graph for this function:

friend class Q3DockWindowHandle [friend] |
friend class Q3DockWindowTitleBar [friend] |
friend class Q3DockArea [friend] |
Definition at line 68 of file q3dockwindow.h.
friend class Q3DockAreaLayout [friend] |
Definition at line 69 of file q3dockwindow.h.
friend class Q3MainWindow [friend] |
Definition at line 70 of file q3dockwindow.h.
friend class QCEMainWindow [friend] |
Definition at line 71 of file q3dockwindow.h.
friend class Q3ToolBar [friend] |
Definition at line 72 of file q3dockwindow.h.
friend class QWindowsXPStyle [friend] |
Definition at line 73 of file q3dockwindow.h.
Q3DockWindowHandle* Q3DockWindow::horHandle [private] |
Definition at line 175 of file q3dockwindow.h.
Referenced by event(), eventFilter(), handleMove(), init(), Q3DockWindowTitleBar::mouseReleaseEvent(), setCloseMode(), setOpaqueMoving(), and updateGui().
Q3DockWindowHandle * Q3DockWindow::verHandle [private] |
Definition at line 175 of file q3dockwindow.h.
Referenced by event(), eventFilter(), handleMove(), init(), Q3DockWindowTitleBar::mouseReleaseEvent(), setCloseMode(), setOpaqueMoving(), and updateGui().
Q3DockWindowTitleBar* Q3DockWindow::titleBar [private] |
Definition at line 176 of file q3dockwindow.h.
Referenced by areaAt(), drawContents(), drawFrame(), event(), eventFilter(), handleMove(), init(), Q3DockWindowHandle::mouseReleaseEvent(), setCloseMode(), setOpaqueMoving(), updateGui(), and windowTitle().
QWidget* Q3DockWindow::wid [private] |
QRubberBand* Q3DockWindow::rubberBand [private] |
Definition at line 178 of file q3dockwindow.h.
Referenced by endRectDraw(), handleMove(), init(), and startRectDraw().
Q3DockArea* Q3DockWindow::dockArea [private] |
Definition at line 179 of file q3dockwindow.h.
Referenced by area(), init(), Q3DockWindowHandle::minimumSizeHint(), Q3DockWindowHandle::mousePressEvent(), orientation(), Q3DockWindowHandle::paintEvent(), removeFromDock(), undock(), and updatePosition().
Q3DockArea * Q3DockWindow::tmpDockArea [private] |
Definition at line 179 of file q3dockwindow.h.
Referenced by handleMove(), init(), and updatePosition().
QRect Q3DockWindow::currRect [private] |
Definition at line 180 of file q3dockwindow.h.
Referenced by handleMove(), startRectDraw(), and updatePosition().
Place Q3DockWindow::curPlace [private] |
Definition at line 181 of file q3dockwindow.h.
Referenced by dock(), init(), Q3DockWindow(), showEvent(), undock(), updateGui(), and updatePosition().
Place Q3DockWindow::state [private] |
Definition at line 182 of file q3dockwindow.h.
Referenced by handleMove(), startRectDraw(), and updatePosition().
Q3DockWindow::resizeEnabled [private] |
whether the dock window is resizeable
A resizeable dock window can be resized using splitter-like handles inside a dock area and like every other top level window when floating.
A dock window is both horizontally and vertically stretchable if you call setResizeEnabled(true).
This property is false by default.
Definition at line 183 of file q3dockwindow.h.
Referenced by init(), isResizeEnabled(), and setResizeEnabled().
bool Q3DockWindow::moveEnabled [private] |
Definition at line 184 of file q3dockwindow.h.
Referenced by init(), isMovingEnabled(), setMovingEnabled(), and updateGui().
bool Q3DockWindow::nl [private] |
bool Q3DockWindow::opaque [private] |
Definition at line 186 of file q3dockwindow.h.
Referenced by eventFilter(), init(), opaqueMoving(), setOpaqueMoving(), and startRectDraw().
bool Q3DockWindow::isToolbar [private] |
Q3DockWindow::stretchable [private] |
whether the dock window is stretchable in the current orientation()
This property can be set using setHorizontallyStretchable() and setVerticallyStretchable(), or with setResizeEnabled().
Definition at line 188 of file q3dockwindow.h.
Referenced by init(), isHorizontallyStretchable(), isVerticallyStretchable(), setHorizontallyStretchable(), and setVerticallyStretchable().
Definition at line 189 of file q3dockwindow.h.
Referenced by handleMove(), startRectDraw(), and updatePosition().
int Q3DockWindow::cMode [private] |
Definition at line 190 of file q3dockwindow.h.
Referenced by closeMode(), init(), isCloseEnabled(), and setCloseMode().
QPoint Q3DockWindow::startOffset [private] |
int Q3DockWindow::offs [private] |
QSize Q3DockWindow::fExtent [private] |
Definition at line 193 of file q3dockwindow.h.
Referenced by fixedExtent(), init(), setFixedExtentHeight(), and setFixedExtentWidth().
Q3DockWindowResizeHandle* Q3DockWindow::hHandleTop [private] |
Definition at line 194 of file q3dockwindow.h.
Referenced by init(), setOrientation(), updateGui(), and updateSplitterVisibility().
Q3DockWindowResizeHandle * Q3DockWindow::hHandleBottom [private] |
Definition at line 194 of file q3dockwindow.h.
Referenced by init(), minimumSize(), minimumSizeHint(), setOrientation(), sizeHint(), updateGui(), and updateSplitterVisibility().
Q3DockWindowResizeHandle * Q3DockWindow::vHandleLeft [private] |
Definition at line 194 of file q3dockwindow.h.
Referenced by init(), setOrientation(), updateGui(), and updateSplitterVisibility().
Q3DockWindowResizeHandle * Q3DockWindow::vHandleRight [private] |
Definition at line 194 of file q3dockwindow.h.
Referenced by init(), minimumSize(), minimumSizeHint(), setOrientation(), sizeHint(), updateGui(), and updateSplitterVisibility().
QVBoxLayout* Q3DockWindow::hbox [private] |
QHBoxLayout* Q3DockWindow::vbox [private] |
QBoxLayout* Q3DockWindow::childBox [private] |
void* Q3DockWindow::dockWindowData [private] |
Definition at line 198 of file q3dockwindow.h.
Referenced by dock(), init(), undock(), updatePosition(), and ~Q3DockWindow().
QPoint Q3DockWindow::lastPos [private] |
QSize Q3DockWindow::lastSize [private] |
Definition at line 200 of file q3dockwindow.h.
Referenced by dock(), init(), undock(), and updatePosition().
Q3DockWindowPrivate* Q3DockWindow::d [private] |
Definition at line 202 of file q3dockwindow.h.
1.5.1