#include <q3mainwindow.h>
Inheritance diagram for Q3MainWindow:


Main windows are most often used to provide menus, toolbars and a status bar around a large central widget, such as a text edit, drawing canvas or QWorkspace (for MDI applications). Q3MainWindow is usually subclassed since this makes it easier to encapsulate the central widget, menus and toolbars as well as the window's state. Subclassing makes it possible to create the slots that are called when the user clicks menu items or toolbar buttons.
We'll briefly review adding menu items and toolbar buttons then describe the facilities of Q3MainWindow itself.
Q3MainWindow *mw = new Q3MainWindow; QTextEdit *edit = new QTextEdit(mw, "editor"); edit->setFocus(); mw->setWindowTitle("Main Window"); mw->setCentralWidget(edit); mw->show();
Q3MainWindows may be created in their own right as shown above. The central widget is set with setCentralWidget(). Popup menus can be added to the default menu bar, widgets can be added to the status bar, toolbars and dock windows can be added to any of the dock areas.
The main window will take care of the dock areas, and the geometry of the central widget, but all other aspects of the central widget are left to you. Q3MainWindow automatically detects the creation of a menu bar or status bar if you specify the Q3MainWindow as parent, or you can use the provided menuBar() and statusBar() functions. The functions menuBar() and statusBar() create a suitable widget if one doesn't exist, and update the window's layout to make space.
New dock windows and toolbars can be added to a Q3MainWindow using addDockWindow(). Qt::Dock windows can be moved using moveDockWindow() and removed with removeDockWindow(). Q3MainWindow allows default dock window (toolbar) docking in all its dock areas (Top, Left, Right, Bottom). You can use setDockEnabled() to enable and disable docking areas for dock windows. When adding or moving dock windows you can specify their 'edge' (dock area). The currently available edges are: Top, Left, Right, Bottom, Minimized (effectively a 'hidden' dock area) and TornOff (floating). See Qt::Dock for an explanation of these areas. Note that the *ToolBar functions are included for backward compatibility; all new code should use the *DockWindow functions. QToolbar is a subclass of Q3DockWindow so all functions that work with dock windows work on toolbars in the same way.
dwm If the user clicks the close button, then the dock window is hidden. A dock window can be hidden or unhidden by the user by right clicking a dock area and clicking the name of the relevant dock window on the pop up dock window menu. This menu lists the names of every dock window; visible dock windows have a tick beside their names. The dock window menu is created automatically as required by createDockWindowMenu(). Since it may not always be appropriate for a dock window to appear on this menu the setAppropriate() function is used to inform the main window whether or not the dock window menu should include a particular dock window. Double clicking a dock window handle (usually on the left-hand side of the dock window) undocks (floats) the dock window. Double clicking a floating dock window's title bar will dock the floating dock window. (See also {Q3MainWindow::DockWindows}.)
Some functions change the appearance of a Q3MainWindow globally: Q3DockWindow::setHorizontalStretchable() and Q3DockWindow::setVerticalStretchable() are used to make specific dock windows or toolbars stretchable. setUsesBigPixmaps() is used to set whether tool buttons should draw small or large pixmaps (see QIcon for more information). setUsesTextLabel() is used to set whether tool buttons should display a textual label in addition to pixmaps (see QToolButton for more information).
The user can drag dock windows into any enabled docking area. Qt::Dock windows can also be dragged within a docking area, for example to rearrange the order of some toolbars. Qt::Dock windows can also be dragged outside any docking area (undocked or 'floated'). Being able to drag dock windows can be enabled (the default) and disabled using setDockWindowsMovable().
The Minimized edge is a hidden dock area. If this dock area is enabled the user can hide (minimize) a dock window or show (restore) a minimized dock window by clicking the dock window handle. If the user hovers the mouse cursor over one of the handles, the caption of the dock window is displayed in a tool tip (see Q3DockWindow::windowTitle() or Q3ToolBar::label()), so if you enable the Minimized dock area, it is best to specify a meaningful caption or label for each dock window. To minimize a dock window programmatically use moveDockWindow() with an edge of Minimized.
Qt::Dock windows are moved transparently by default, i.e. during the drag an outline rectangle is drawn on the screen representing the position of the dock window as it moves. If you want the dock window to be shown normally whilst it is moved use setOpaqueMoving().
The location of a dock window, i.e. its dock area and position within the dock area, can be determined by calling getLocation(). Movable dock windows can be lined up to minimize wasted space with lineUpDockWindows(). Pointers to the dock areas are available from topDock(), leftDock(), rightDock() and bottomDock(). A customize menu item is added to the pop up dock window menu if isCustomizable() returns true; it returns false by default. Reimplement isCustomizable() and customize() if you want to offer this extra menu item, for example, to allow the user to change settings relating to the main window and its toolbars and dock windows.
The main window's menu bar is fixed (at the top) by default. If you want a movable menu bar, create a QMenuBar as a stretchable widget inside its own movable dock window and restrict this dock window to only live within the Top or Bottom dock:
Q3ToolBar *tb = new Q3ToolBar(this); addDockWindow(tb, tr("Menubar"), Top, false); QMenuBar *mb = new QMenuBar(tb); mb->setFrameStyle(QFrame::NoFrame); tb->setStretchableWidget(mb); setDockEnabled(tb, Left, false); setDockEnabled(tb, Right, false);
An application with multiple dock windows can choose to save the current dock window layout in order to restore it later, e.g. in the next session. You can do this by using the streaming operators for Q3MainWindow.
To save the layout and positions of all the dock windows do this:
QFile file(filename); if (file.open(IO_WriteOnly)) { QTextStream stream(&file); stream << *mainWindow; file.close(); }
To restore the dock window positions and sizes (normally when the application is next started), do the following:
QFile file(filename); if (file.open(IO_ReadOnly)) { QTextStream stream(&file); stream >> *mainWindow; file.close(); }
The QSettings class can be used in conjunction with the streaming operators to store the application's settings.
Q3MainWindow's management of dock windows and toolbars is done transparently behind-the-scenes by Q3DockArea.
For multi-document interfaces (MDI), use a QWorkspace as the central widget.
Adding dock windows, e.g. toolbars, to Q3MainWindow's dock areas is straightforward. If the supplied dock areas are not sufficient for your application we suggest that you create a QWidget subclass and add your own dock areas (see Q3DockArea) to the subclass since Q3MainWindow provides functionality specific to the standard dock areas it provides.
Definition at line 45 of file q3mainwindow.h.
Public Types | |
| enum | DockWindows |
Public Slots | |
| virtual void | setRightJustification (bool) |
| virtual void | setUsesBigPixmaps (bool) |
| virtual void | setUsesTextLabel (bool) |
| virtual void | setDockWindowsMovable (bool) |
| virtual void | setOpaqueMoving (bool) |
| virtual void | setDockMenuEnabled (bool) |
| virtual void | whatsThis () |
| virtual void | setAppropriate (Q3DockWindow *dw, bool a) |
| virtual void | customize () |
| void | setToolBarsMovable (bool) |
Signals | |
| void | pixmapSizeChanged (bool) |
| void | usesTextLabelChanged (bool) |
| void | dockWindowPositionChanged (Q3DockWindow *) |
| void | toolBarPositionChanged (Q3ToolBar *) |
Public Member Functions | |
| Q3MainWindow (QWidget *parent=0, const char *name=0, Qt::WindowFlags f=Qt::WType_TopLevel) | |
| ~Q3MainWindow () | |
| QMenuBar * | menuBar () const |
| QStatusBar * | statusBar () const |
| virtual void | setCentralWidget (QWidget *) |
| QWidget * | centralWidget () const |
| virtual void | setDockEnabled (Qt::Dock dock, bool enable) |
| bool | isDockEnabled (Qt::Dock dock) const |
| bool | isDockEnabled (Q3DockArea *area) const |
| virtual void | setDockEnabled (Q3DockWindow *tb, Qt::Dock dock, bool enable) |
| bool | isDockEnabled (Q3DockWindow *tb, Qt::Dock dock) const |
| bool | isDockEnabled (Q3DockWindow *tb, Q3DockArea *area) const |
| virtual void | addDockWindow (Q3DockWindow *, Qt::Dock=Qt::DockTop, bool newLine=false) |
| virtual void | addDockWindow (Q3DockWindow *, const QString &label, Qt::Dock=Qt::DockTop, bool newLine=false) |
| virtual void | moveDockWindow (Q3DockWindow *, Qt::Dock=Qt::DockTop) |
| virtual void | moveDockWindow (Q3DockWindow *, Qt::Dock, bool nl, int index, int extraOffset=-1) |
| virtual void | removeDockWindow (Q3DockWindow *) |
| void | setVisible (bool) |
| QSize | sizeHint () const |
| QSize | minimumSizeHint () const |
| bool | rightJustification () const |
| bool | usesBigPixmaps () const |
| bool | usesTextLabel () const |
| bool | dockWindowsMovable () const |
| bool | opaqueMoving () const |
| bool | eventFilter (QObject *, QEvent *) |
| bool | getLocation (Q3DockWindow *tb, Qt::Dock &dock, int &index, bool &nl, int &extraOffset) const |
| QList< Q3DockWindow * > | dockWindows (Qt::Dock dock) const |
| QList< Q3DockWindow * > | dockWindows () const |
| void | lineUpDockWindows (bool keepNewLines=false) |
| bool | isDockMenuEnabled () const |
| bool | hasDockWindow (Q3DockWindow *dw) |
| void | addToolBar (Q3DockWindow *, Qt::Dock=Qt::DockTop, bool newLine=false) |
| void | addToolBar (Q3DockWindow *, const QString &label, Qt::Dock=Qt::DockTop, bool newLine=false) |
| void | moveToolBar (Q3DockWindow *, Qt::Dock=Qt::DockTop) |
| void | moveToolBar (Q3DockWindow *, Qt::Dock, bool nl, int index, int extraOffset=-1) |
| void | removeToolBar (Q3DockWindow *) |
| bool | toolBarsMovable () const |
| QList< Q3ToolBar * > | toolBars (Qt::Dock dock) const |
| void | lineUpToolBars (bool keepNewLines=false) |
| virtual Q3DockArea * | dockingArea (const QPoint &p) |
| Q3DockArea * | leftDock () const |
| Q3DockArea * | rightDock () const |
| Q3DockArea * | topDock () const |
| Q3DockArea * | bottomDock () const |
| virtual bool | isCustomizable () const |
| bool | appropriate (Q3DockWindow *dw) const |
| virtual Q3PopupMenu * | createDockWindowMenu (DockWindows dockWindows=AllDockWindows) const |
Protected Slots | |
| virtual void | setUpLayout () |
| virtual bool | showDockMenu (const QPoint &globalPos) |
| void | menuAboutToShow () |
Protected Member Functions | |
| void | paintEvent (QPaintEvent *) |
| void | childEvent (QChildEvent *) |
| bool | event (QEvent *) |
Private Slots | |
| void | slotPlaceChanged () |
| void | doLineUp () |
Private Member Functions | |
| void | triggerLayout (bool deleteLayout=true) |
| bool | dockMainWindow (QObject *dock) const |
| virtual void | setMenuBar (QMenuBar *) |
| virtual void | setStatusBar (QStatusBar *) |
Friends | |
| class | Q3DockWindow |
| class | QMenuBarPrivate |
| class | QHideDock |
| class | Q3ToolBar |
| class | Q3MainWindowLayout |
Related Functions | |
| (Note that these are not member functions.) | |
| QTextStream & | operator<< (QTextStream &ts, const Q3MainWindow &mainWindow) |
| QTextStream & | operator>> (QTextStream &ts, Q3MainWindow &mainWindow) |
Right-clicking a dock area will pop-up the dock window menu (createDockWindowMenu() is called automatically). When called in code you can specify what items should appear on the menu with this enum.
OnlyToolBars The menu will list all the toolbars, but not any other dock windows.
NoToolBars The menu will list dock windows but not toolbars.
AllDockWindows The menu will list all toolbars and other dock windows. (This is the default.)
Definition at line 130 of file q3mainwindow.h.
00130 { OnlyToolBars, NoToolBars, AllDockWindows };
| Q3MainWindow::Q3MainWindow | ( | QWidget * | parent = 0, |
|
| const char * | name = 0, |
|||
| Qt::WindowFlags | f = Qt::WType_TopLevel | |||
| ) |
Constructs an empty main window. The parent, name and widget flags f, are passed on to the QWidget constructor.
By default, the widget flags are set to Qt::WType_TopLevel rather than 0 as they are with QWidget. If you don't want your Q3MainWindow to be a top level widget then you will need to set f to 0.
Definition at line 699 of file q3mainwindow.cpp.
References d, Qt::Horizontal, QObject::installEventFilter(), Q3DockArea::Normal, QHideDock, Q3DockArea::Reverse, QObject::setObjectName(), and Qt::Vertical.
00700 : QWidget(*new Q3MainWindowPrivate, parent, f) 00701 { 00702 Q_D(Q3MainWindow); 00703 setObjectName(name); 00704 #ifdef Q_WS_MAC 00705 d->opaque = true; 00706 #else 00707 d->opaque = false; 00708 #endif 00709 installEventFilter(this); 00710 d->topDock = new Q3DockArea(Qt::Horizontal, Q3DockArea::Normal, this, "qt_top_dock"); 00711 d->topDock->installEventFilter(this); 00712 d->bottomDock = new Q3DockArea(Qt::Horizontal, Q3DockArea::Reverse, this, "qt_bottom_dock"); 00713 d->bottomDock->installEventFilter(this); 00714 d->leftDock = new Q3DockArea(Qt::Vertical, Q3DockArea::Normal, this, "qt_left_dock"); 00715 d->leftDock->installEventFilter(this); 00716 d->rightDock = new Q3DockArea(Qt::Vertical, Q3DockArea::Reverse, this, "qt_right_dock"); 00717 d->rightDock->installEventFilter(this); 00718 d->hideDock = new QHideDock(this); 00719 }
Here is the call graph for this function:

| Q3MainWindow::~Q3MainWindow | ( | ) |
Destroys the object and frees any allocated resources.
Definition at line 726 of file q3mainwindow.cpp.
References QWidget::layout().
00727 { 00728 delete layout(); 00729 }
Here is the call graph for this function:

| QMenuBar * Q3MainWindow::menuBar | ( | ) | const |
Returns the menu bar for this window.
If there isn't one, then menuBar() creates an empty menu bar.
Definition at line 761 of file q3mainwindow.cpp.
Referenced by Q3MainWindowContainer::addWidget(), and setUpLayout().
00762 { 00763 Q_D(const Q3MainWindow); 00764 if (d->mb) 00765 return d->mb; 00766 00767 QObjectList l = queryList("QMenuBar", 0, false, false); 00768 QMenuBar * b; 00769 if (l.size()) { 00770 b = static_cast<QMenuBar *>(l.at(0)); 00771 } else { 00772 b = new QMenuBar((Q3MainWindow *)this); 00773 b->setObjectName("automatic menu bar"); 00774 b->show(); 00775 } 00776 d->mb = b; 00777 d->mb->installEventFilter(const_cast<Q3MainWindow *>(this)); 00778 ((Q3MainWindow *)this)->triggerLayout(); 00779 return b; 00780 }
| QStatusBar * Q3MainWindow::statusBar | ( | ) | const |
Returns this main window's status bar. If there isn't one, statusBar() creates an empty status bar, and if necessary a tool tip group too.
Definition at line 825 of file q3mainwindow.cpp.
Referenced by Q3MainWindowContainer::addWidget(), MainWindowBase::MainWindowBase(), and setUpLayout().
00826 { 00827 Q_D(const Q3MainWindow); 00828 if (d->sb) 00829 return d->sb; 00830 00831 QObjectList l = queryList("QStatusBar", 0, false, false); 00832 QStatusBar * s; 00833 if (l.size()) { 00834 s = (QStatusBar *)l.at(0); 00835 } else { 00836 s = new QStatusBar((Q3MainWindow *)this, "automatic status bar"); 00837 s->show(); 00838 } 00839 ((Q3MainWindow *)this)->setStatusBar(s); 00840 ((Q3MainWindow *)this)->triggerLayout(true); 00841 return s; 00842 }
| void Q3MainWindow::setCentralWidget | ( | QWidget * | w | ) | [virtual] |
Sets the central widget for this main window to w.
The central widget is surrounded by the left, top, right and bottom dock areas. The menu bar is above the top dock area.
Definition at line 1371 of file q3mainwindow.cpp.
References d, triggerLayout(), and w.
Referenced by Q3MainWindowContainer::addWidget(), and KAstTopLevel::KAstTopLevel().
01372 { 01373 Q_D(Q3MainWindow); 01374 if (d->mc) 01375 d->mc->removeEventFilter(this); 01376 d->mc = w; 01377 if (d->mc) 01378 d->mc->installEventFilter(this); 01379 triggerLayout(); 01380 }
Here is the call graph for this function:

| QWidget * Q3MainWindow::centralWidget | ( | ) | const |
Returns a pointer to the main window's central widget.
The central widget is surrounded by the left, top, right and bottom dock areas. The menu bar is above the top dock area.
Definition at line 1392 of file q3mainwindow.cpp.
Referenced by Q3MainWindowContainer::addWidget(), Q3MainWindowContainer::currentIndex(), and setUpLayout().
| void Q3MainWindow::setDockEnabled | ( | Qt::Dock | dock, | |
| bool | enable | |||
| ) | [virtual] |
If enable is true then users can dock windows in the dock area. If enable is false users cannot dock windows in the dock dock area.
Users can dock (drag) dock windows into any enabled dock area.
Definition at line 901 of file q3mainwindow.cpp.
| bool Q3MainWindow::isDockEnabled | ( | Qt::Dock | dock | ) | const |
Returns true if the dock dock area is enabled, i.e. it can accept user dragged dock windows; otherwise returns false.
Definition at line 914 of file q3mainwindow.cpp.
Referenced by isDockEnabled(), Q3DockArea::isDockWindowAccepted(), Q3DockWindowHandle::minimize(), and Q3DockWindow::undock().
| bool Q3MainWindow::isDockEnabled | ( | Q3DockArea * | area | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns true if dock area area is enabled, i.e. it can accept user dragged dock windows; otherwise returns false.
Definition at line 928 of file q3mainwindow.cpp.
00929 { 00930 Q_D(const Q3MainWindow); 00931 if (area == d->leftDock) 00932 return d->docks[Qt::DockLeft]; 00933 if (area == d->rightDock) 00934 return d->docks[Qt::DockRight]; 00935 if (area == d->topDock) 00936 return d->docks[Qt::DockTop]; 00937 if (area == d->bottomDock) 00938 return d->docks[Qt::DockBottom]; 00939 return false; 00940 }
Here is the call graph for this function:

| void Q3MainWindow::setDockEnabled | ( | Q3DockWindow * | dw, | |
| Qt::Dock | dock, | |||
| bool | enable | |||
| ) | [virtual] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. If enable is true then users can dock the dw dock window in the dock area. If enable is false users cannot dock the dw dock window in the dock area.
In general users can dock (drag) dock windows into any enabled dock area. Using this function particular dock areas can be enabled (or disabled) as docking points for particular dock windows.
Definition at line 956 of file q3mainwindow.cpp.
References bottomDock(), QObject::connect(), d, leftDock(), rightDock(), s, Q3DockArea::setAcceptDockWindow(), SIGNAL, SLOT, slotPlaceChanged(), and topDock().
00957 { 00958 Q_D(Q3MainWindow); 00959 if (d->dockWindows.contains(dw)) { 00960 d->dockWindows.append(dw); 00961 connect(dw, SIGNAL(placeChanged(Q3DockWindow::Place)), 00962 this, SLOT(slotPlaceChanged())); 00963 } 00964 QString s; 00965 s.sprintf("%p_%d", (void*)dw, (int)dock); 00966 if (enable) 00967 d->disabledDocks.removeAll(s); 00968 else if (!d->disabledDocks.contains(s)) 00969 d->disabledDocks << s; 00970 switch (dock) { 00971 case Qt::DockTop: 00972 topDock()->setAcceptDockWindow(dw, enable); 00973 break; 00974 case Qt::DockLeft: 00975 leftDock()->setAcceptDockWindow(dw, enable); 00976 break; 00977 case Qt::DockRight: 00978 rightDock()->setAcceptDockWindow(dw, enable); 00979 break; 00980 case Qt::DockBottom: 00981 bottomDock()->setAcceptDockWindow(dw, enable); 00982 break; 00983 default: 00984 break; 00985 } 00986 }
Here is the call graph for this function:

| bool Q3MainWindow::isDockEnabled | ( | Q3DockWindow * | tb, | |
| Qt::Dock | dock | |||
| ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns true if dock area dock is enabled for the dock window tb; otherwise returns false.
Definition at line 1025 of file q3mainwindow.cpp.
References isDockEnabled(), s, and tb.
01026 { 01027 if (!isDockEnabled(dock)) 01028 return false; 01029 QString s; 01030 s.sprintf("%p_%d", (void*)tb, (int)dock); 01031 return !d_func()->disabledDocks.contains(s); 01032 }
Here is the call graph for this function:

| bool Q3MainWindow::isDockEnabled | ( | Q3DockWindow * | dw, | |
| Q3DockArea * | area | |||
| ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns true if dock area area is enabled for the dock window dw; otherwise returns false.
Definition at line 997 of file q3mainwindow.cpp.
References area(), d, and isDockEnabled().
00998 { 00999 Q_D(const Q3MainWindow); 01000 if (!isDockEnabled(area)) 01001 return false; 01002 Qt::Dock dock; 01003 if (area == d->leftDock) 01004 dock = Qt::DockLeft; 01005 else if (area == d->rightDock) 01006 dock = Qt::DockRight; 01007 else if (area == d->topDock) 01008 dock = Qt::DockTop; 01009 else if (area == d->bottomDock) 01010 dock = Qt::DockBottom; 01011 else 01012 return false; 01013 return isDockEnabled(dw, dock); 01014 }
Here is the call graph for this function:

| void Q3MainWindow::addDockWindow | ( | Q3DockWindow * | dockWindow, | |
| Qt::Dock | edge = Qt::DockTop, |
|||
| bool | newLine = false | |||
| ) | [virtual] |
Adds dockWindow to the edge dock area.
If newLine is false (the default) then the dockWindow is added at the end of the edge. For vertical edges the end is at the bottom, for horizontal edges (including Minimized) the end is at the right. If newLine is true a new line of dock windows is started with dockWindow as the first (left-most and top-most) dock window.
If dockWindow is managed by another main window, it is first removed from that window.
Definition at line 1050 of file q3mainwindow.cpp.
References QObject::connect(), d, QWidget::isWindow(), moveDockWindow(), Q3DockWindow::setNewLine(), Q3DockWindow::setOpaqueMoving(), SIGNAL, SLOT, and slotPlaceChanged().
Referenced by addDockWindow(), and loadDockArea().
01052 { 01053 Q_D(Q3MainWindow); 01054 #ifdef Q_WS_MAC 01055 extern WindowPtr qt_mac_window_for(const QWidget*); //qwidget_mac.cpp 01056 if(isWindow() && edge == Qt::DockTop) { 01057 d->createWinId(); 01058 ChangeWindowAttributes(qt_mac_window_for(this), kWindowToolbarButtonAttribute, 0); 01059 } 01060 #endif 01061 moveDockWindow(dockWindow, edge); 01062 dockWindow->setNewLine(newLine); 01063 if (!d->dockWindows.contains(dockWindow)) { 01064 d->dockWindows.append(dockWindow); 01065 connect(dockWindow, SIGNAL(placeChanged(Q3DockWindow::Place)), 01066 this, SLOT(slotPlaceChanged())); 01067 dockWindow->installEventFilter(this); 01068 } 01069 dockWindow->setOpaqueMoving(d->opaque); 01070 }
Here is the call graph for this function:

| void Q3MainWindow::addDockWindow | ( | Q3DockWindow * | dockWindow, | |
| const QString & | label, | |||
| Qt::Dock | edge = Qt::DockTop, |
|||
| bool | newLine = false | |||
| ) | [virtual] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Adds dockWindow to the dock area with label label.
If newLine is false (the default) the dockWindow is added at the end of the edge. For vertical edges the end is at the bottom, for horizontal edges (including Minimized) the end is at the right. If newLine is true a new line of dock windows is started with dockWindow as the first (left-most and top-most) dock window.
If dockWindow is managed by another main window, it is first removed from that window.
Definition at line 1089 of file q3mainwindow.cpp.
References addDockWindow(), and tb.
01091 { 01092 addDockWindow(dockWindow, edge, newLine); 01093 #ifndef QT_NO_TOOLBAR 01094 Q3ToolBar *tb = qobject_cast<Q3ToolBar*>(dockWindow); 01095 if (tb) 01096 tb->setLabel(label); 01097 #endif 01098 }
Here is the call graph for this function:

| void Q3MainWindow::moveDockWindow | ( | Q3DockWindow * | dockWindow, | |
| Qt::Dock | edge = Qt::DockTop | |||
| ) | [virtual] |
Moves dockWindow to the end of the edge.
For vertical edges the end is at the bottom, for horizontal edges (including Minimized) the end is at the right.
If dockWindow is managed by another main window, it is first removed from that window.
Definition at line 1110 of file q3mainwindow.cpp.
References Q3DockWindow::area(), d, dockWindowPositionChanged(), emit, Q3DockWindow::orientation(), Q3DockWindow::removeFromDock(), Q3DockWindow::setOrientation(), and Q3DockWindow::undock().
Referenced by addDockWindow(), and Q3DockWindowHandle::minimize().
01111 { 01112 Q_D(Q3MainWindow); 01113 Qt::Orientation oo = dockWindow->orientation(); 01114 switch (edge) { 01115 case Qt::DockTop: 01116 if (dockWindow->area() != d->topDock) 01117 dockWindow->removeFromDock(false); 01118 d->topDock->moveDockWindow(dockWindow); 01119 emit dockWindowPositionChanged(dockWindow); 01120 break; 01121 case Qt::DockBottom: 01122 if (dockWindow->area() != d->bottomDock) 01123 dockWindow->removeFromDock(false); 01124 d->bottomDock->moveDockWindow(dockWindow); 01125 emit dockWindowPositionChanged(dockWindow); 01126 break; 01127 case Qt::DockRight: 01128 if (dockWindow->area() != d->rightDock) 01129 dockWindow->removeFromDock(false); 01130 d->rightDock->moveDockWindow(dockWindow); 01131 emit dockWindowPositionChanged(dockWindow); 01132 break; 01133 case Qt::DockLeft: 01134 if (dockWindow->area() != d->leftDock) 01135 dockWindow->removeFromDock(false); 01136 d->leftDock->moveDockWindow(dockWindow); 01137 emit dockWindowPositionChanged(dockWindow); 01138 break; 01139 case Qt::DockTornOff: 01140 dockWindow->undock(); 01141 break; 01142 case Qt::DockMinimized: 01143 dockWindow->undock(d->hideDock); 01144 break; 01145 case Qt::DockUnmanaged: 01146 break; 01147 } 01148 01149 if (oo != dockWindow->orientation()) 01150 dockWindow->setOrientation(dockWindow->orientation()); 01151 }
Here is the call graph for this function:

| void Q3MainWindow::moveDockWindow | ( | Q3DockWindow * | dockWindow, | |
| Qt::Dock | edge, | |||
| bool | nl, | |||
| int | index, | |||
| int | extraOffset = -1 | |||
| ) | [virtual] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Moves dockWindow to position index within the edge dock area.
Any dock windows with positions index or higher have their position number incremented and any of these on the same line are moved right (down for vertical dock areas) to make room.
If nl is true, a new dock window line is created below the line in which the moved dock window appears and the moved dock window, with any others with higher positions on the same line, is moved to this new line.
The extraOffset is the space to put between the left side of the dock area (top side for vertical dock areas) and the dock window. (This is mostly used for restoring dock windows to the positions the user has dragged them to.)
If dockWindow is managed by another main window, it is first removed from that window.
Definition at line 1177 of file q3mainwindow.cpp.
References Q3DockWindow::area(), d, Q3DockWindow::orientation(), Q3DockWindow::removeFromDock(), Q3DockWindow::setNewLine(), Q3DockWindow::setOffset(), Q3DockWindow::setOrientation(), and Q3DockWindow::undock().
01178 { 01179 Q_D(Q3MainWindow); 01180 Qt::Orientation oo = dockWindow->orientation(); 01181 01182 dockWindow->setNewLine(nl); 01183 dockWindow->setOffset(extraOffset); 01184 switch (edge) { 01185 case Qt::DockTop: 01186 if (dockWindow->area() != d->topDock) 01187 dockWindow->removeFromDock(false); 01188 d->topDock->moveDockWindow(dockWindow, index); 01189 break; 01190 case Qt::DockBottom: 01191 if (dockWindow->area() != d->bottomDock) 01192 dockWindow->removeFromDock(false); 01193 d->bottomDock->moveDockWindow(dockWindow, index); 01194 break; 01195 case Qt::DockRight: 01196 if (dockWindow->area() != d->rightDock) 01197 dockWindow->removeFromDock(false); 01198 d->rightDock->moveDockWindow(dockWindow, index); 01199 break; 01200 case Qt::DockLeft: 01201 if (dockWindow->area() != d->leftDock) 01202 dockWindow->removeFromDock(false); 01203 d->leftDock->moveDockWindow(dockWindow, index); 01204 break; 01205 case Qt::DockTornOff: 01206 dockWindow->undock(); 01207 break; 01208 case Qt::DockMinimized: 01209 dockWindow->undock(d->hideDock); 01210 break; 01211 case Qt::DockUnmanaged: 01212 break; 01213 } 01214 01215 if (oo != dockWindow->orientation()) 01216 dockWindow->setOrientation(dockWindow->orientation()); 01217 }
Here is the call graph for this function:

| void Q3MainWindow::removeDockWindow | ( | Q3DockWindow * | dockWindow | ) | [virtual] |
Removes dockWindow from the main window's docking area, provided dockWindow is non-null and managed by this main window.
Definition at line 1225 of file q3mainwindow.cpp.
References Q3DockWindow::area(), QList< T >::count(), d, QObject::disconnect(), dockWindows(), QWidget::hide(), QWidget::isWindow(), QObject::removeEventFilter(), SIGNAL, SLOT, slotPlaceChanged(), and topDock().
Referenced by childEvent(), removeToolBar(), and Q3DockWindow::~Q3DockWindow().
01226 { 01227 Q_D(Q3MainWindow); 01228 01229 #ifdef Q_WS_MAC 01230 extern WindowPtr qt_mac_window_for(const QWidget*); //qwidget_mac.cpp 01231 if(isWindow() && dockWindow->area() == topDock() && !dockWindows(Qt::DockTop).count()) 01232 ChangeWindowAttributes(qt_mac_window_for(this), 0, kWindowToolbarButtonAttribute); 01233 #endif 01234 01235 dockWindow->hide(); 01236 d->dockWindows.removeAll(dockWindow); 01237 disconnect(dockWindow, SIGNAL(placeChanged(Q3DockWindow::Place)), 01238 this, SLOT(slotPlaceChanged())); 01239 dockWindow->removeEventFilter(this); 01240 }
Here is the call graph for this function:

| void Q3MainWindow::setVisible | ( | bool | visible | ) | [virtual] |
Reimplemented from QWidget.
Definition at line 1309 of file q3mainwindow.cpp.
References d, QWidget::hide(), i, QWidget::isVisible(), QWidget::isWindow(), QWidget::setAttribute(), setUpLayout(), QWidget::setVisible(), QWidget::testAttribute(), and Qt::WA_WState_Hidden.
01310 { 01311 Q_D(Q3MainWindow); 01312 if (visible) { 01313 if (!d->tll) 01314 setUpLayout(); 01315 01316 // show all floating dock windows not explicitly hidden 01317 if (!isVisible()) { 01318 for (int i = 0; i < d->dockWindows.size(); ++i) { 01319 Q3DockWindow *dw = d->dockWindows.at(i); 01320 if (dw->isWindow() && !dw->isVisible() && !dw->testAttribute(Qt::WA_WState_Hidden)) { 01321 reinterpret_cast<Q3MainWindow *>(dw)->setAttribute(Qt::WA_WState_Hidden); 01322 dw->show(); 01323 } 01324 } 01325 } 01326 } else if (isVisible()) { 01327 for (int i = 0; i < d->dockWindows.size(); ++i) { 01328 Q3DockWindow *dw = d->dockWindows.at(i); 01329 if (dw->isWindow() && dw->isVisible()) { 01330 dw->hide(); // implicit hide, so clear forcehide 01331 reinterpret_cast<Q3MainWindow *>(dw)->setAttribute(Qt::WA_WState_Hidden, false); 01332 } 01333 } 01334 } 01335 QWidget::setVisible(visible); 01336 }
Here is the call graph for this function:

| QSize Q3MainWindow::sizeHint | ( | ) | const [virtual] |
Reimplemented from QWidget.
Definition at line 1340 of file q3mainwindow.cpp.
References QCoreApplication::sendPostedEvents().
01341 { 01342 Q3MainWindow* that = (Q3MainWindow*) this; 01343 // Workaround: because d->tll get's deleted in 01344 // totalSizeHint->polish->sendPostedEvents->childEvent->triggerLayout 01345 QApplication::sendPostedEvents(that, QEvent::ChildInserted); 01346 if (!that->d_func()->tll) 01347 that->setUpLayout(); 01348 return that->d_func()->tll->totalSizeHint(); 01349 }
Here is the call graph for this function:

| QSize Q3MainWindow::minimumSizeHint | ( | ) | const [virtual] |
Reimplemented from QWidget.
Definition at line 1352 of file q3mainwindow.cpp.
References d, and setUpLayout().
01353 { 01354 Q_D(const Q3MainWindow); 01355 if (!d->tll) { 01356 Q3MainWindow* that = (Q3MainWindow*) this; 01357 that->setUpLayout(); 01358 } 01359 return d->tll->totalMinimumSize(); 01360 }
| bool Q3MainWindow::rightJustification | ( | ) | const |
| bool Q3MainWindow::usesBigPixmaps | ( | ) | const |
| bool Q3MainWindow::usesTextLabel | ( | ) | const |
| bool Q3MainWindow::dockWindowsMovable | ( | ) | const |
Definition at line 1855 of file q3mainwindow.cpp.
Referenced by lineUpDockWindows(), menuAboutToShow(), and toolBarsMovable().
| bool Q3MainWindow::opaqueMoving | ( | ) | const |
Reimplemented from QObject.
Definition at line 1433 of file q3mainwindow.cpp.
References QEvent::ContextMenu, d, dockMainWindow(), QObject::eventFilter(), o, setUpLayout(), QEvent::Show, showDockMenu(), and QEvent::type().
01434 { 01435 Q_D(Q3MainWindow); 01436 if (e->type() == QEvent::Show && o == this) { 01437 if (!d->tll) 01438 setUpLayout(); 01439 d->tll->activate(); 01440 } else if (e->type() == QEvent::ContextMenu && d->dockMenu && 01441 (qobject_cast<Q3DockArea*>(o) && dockMainWindow(o) || o == d->hideDock || o == d->mb)) { 01442 if (showDockMenu(((QMouseEvent*)e)->globalPos())) { 01443 ((QContextMenuEvent*)e)->accept(); 01444 return true; 01445 } 01446 } 01447 01448 return QWidget::eventFilter(o, e); 01449 }
Here is the call graph for this function:

| bool Q3MainWindow::getLocation | ( | Q3DockWindow * | dw, | |
| Qt::Dock & | dock, | |||
| int & | index, | |||
| bool & | nl, | |||
| int & | extraOffset | |||
| ) | const |
Finds the location of the dock window dw.
If the dw dock window is found in the main window the function returns true and populates the dock variable with the dw's dock area and the index with the dw's position within the dock area. It also sets nl to true if the dw begins a new line (otherwise false), and extraOffset with the dock window's offset.
If the dw dock window is not found then the function returns false and the state of dock, index, nl and extraOffset is undefined.
If you want to save and restore dock window positions then use operator>>() and operator<<().
Definition at line 1720 of file q3mainwindow.cpp.
References d.
01721 { 01722 Q_D(const Q3MainWindow); 01723 dock = Qt::DockTornOff; 01724 if (d->topDock->hasDockWindow(dw, &index)) 01725 dock = Qt::DockTop; 01726 else if (d->bottomDock->hasDockWindow(dw, &index)) 01727 dock = Qt::DockBottom; 01728 else if (d->leftDock->hasDockWindow(dw, &index)) 01729 dock = Qt::DockLeft; 01730 else if (d->rightDock->hasDockWindow(dw, &index)) 01731 dock = Qt::DockRight; 01732 else if (dw->parentWidget() == d->hideDock) { 01733 index = 0; 01734 dock = Qt::DockMinimized; 01735 } else { 01736 index = 0; 01737 } 01738 nl = dw->newLine(); 01739 extraOffset = dw->offset(); 01740 return true; 01741 }
| QList< Q3DockWindow * > Q3MainWindow::dockWindows | ( | Qt::Dock | dock | ) | const |
Returns a list of all the dock windows which are in the dock dock area, regardless of their state.
For example, the Qt::DockTornOff dock area may contain closed dock windows but these are returned along with the visible dock windows.
Definition at line 1776 of file q3mainwindow.cpp.
References QList< T >::append(), QList< T >::at(), d, i, Q3DockWindow::OutsideDock, QList< T >::size(), and w.
Referenced by operator<<(), and operator>>().
01777 { 01778 Q_D(const Q3MainWindow); 01779 QList<Q3DockWindow *> lst; 01780 switch (dock) { 01781 case Qt::DockTop: 01782 return d->topDock->dockWindowList(); 01783 case Qt::DockBottom: 01784 return d->bottomDock->dockWindowList(); 01785 case Qt::DockLeft: 01786 return d->leftDock->dockWindowList(); 01787 case Qt::DockRight: 01788 return d->rightDock->dockWindowList(); 01789 case Qt::DockTornOff: { 01790 for (int i = 0; i < d->dockWindows.size(); ++i) { 01791 Q3DockWindow *w = d->dockWindows.at(i); 01792 if (!w->area() && w->place() == Q3DockWindow::OutsideDock) 01793 lst.append(w); 01794 } 01795 } 01796 return lst; 01797 case Qt::DockMinimized: { 01798 QObjectList childList = d->hideDock->children(); 01799 for (int i = 0; i < childList.size(); ++i) { 01800 Q3DockWindow *dw = qobject_cast<Q3DockWindow*>(childList.at(i)); 01801 if (dw) 01802 lst.append(dw); 01803 } 01804 } 01805 return lst; 01806 default: 01807 break; 01808 } 01809 return lst; 01810 }
Here is the call graph for this function:

| QList< Q3DockWindow * > Q3MainWindow::dockWindows | ( | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the list of dock windows which belong to this main window, regardless of which dock area they are in or what their state is, (e.g. irrespective of whether they are visible or not).
Definition at line 1820 of file q3mainwindow.cpp.
Referenced by menuAboutToShow(), removeDockWindow(), and toolBars().
| void Q3MainWindow::lineUpDockWindows | ( | bool | keepNewLines = false |
) |
This function will line up dock windows within the visible dock areas (Top, Left, Right and Bottom) as compactly as possible.
If keepNewLines is true, all dock windows stay on their original lines. If keepNewLines is false then newlines may be removed to achieve the most compact layout possible.
The method only works if dockWindowsMovable() returns true.
Definition at line 1901 of file q3mainwindow.cpp.
References d, and dockWindowsMovable().
Referenced by lineUpToolBars().
01902 { 01903 Q_D(const Q3MainWindow); 01904 if (!dockWindowsMovable()) 01905 return; 01906 d->topDock->lineUp(keepNewLines); 01907 d->leftDock->lineUp(keepNewLines); 01908 d->rightDock->lineUp(keepNewLines); 01909 d->bottomDock->lineUp(keepNewLines); 01910 }
Here is the call graph for this function:

| bool Q3MainWindow::isDockMenuEnabled | ( | ) | const |
Returns true, if the dock window menu is enabled; otherwise returns false.
The menu lists the (appropriate()) dock windows (which may be shown or hidden), and has a "Line Up Dock Windows" menu item. It will also have a "Customize" menu item if isCustomizable() returns true.
Definition at line 1925 of file q3mainwindow.cpp.
Referenced by QHideDock::mousePressEvent().
| bool Q3MainWindow::hasDockWindow | ( | Q3DockWindow * | dw | ) |
Returns true if dw is a dock window known to the main window; otherwise returns false.
Definition at line 2134 of file q3mainwindow.cpp.
Referenced by Q3DockArea::isDockWindowAccepted().
| void Q3MainWindow::addToolBar | ( | Q3DockWindow * | dockWindow, | |
| Qt::Dock | position = Qt::DockTop, |
|||
| bool | newLine = false | |||
| ) |
Adds a new toolbar to the dockWindow. The toolbar is placed in the given position. If newLine is true the toolbar is put on a new line.
Referenced by Q3ToolBar::Q3ToolBar().
| void Q3MainWindow::addToolBar | ( | Q3DockWindow * | dockWindow, | |
| const QString & | label, | |||
| Qt::Dock | position = Qt::DockTop, |
|||
| bool | newLine = false | |||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The toolbar has the caption label and is placed in the given position.
| void Q3MainWindow::moveToolBar | ( | Q3DockWindow * | dockWindow, | |
| Qt::Dock | position = Qt::DockTop | |||
| ) |
Moves the given dockWindow into the given position.
| void Q3MainWindow::moveToolBar | ( | Q3DockWindow * | dockWindow, | |
| Qt::Dock | position, | |||
| bool | nl, | |||
| int | index, | |||
| int | extraOffset = -1 | |||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The dockWindow is made the {index}-th item in the toolbar, moved over by extraOffset. If nl is true, the dock window is put on a new line.
| void Q3MainWindow::removeToolBar | ( | Q3DockWindow * | dockWindow | ) | [inline] |
Removes the toolbar from the given dockWindow.
Definition at line 214 of file q3mainwindow.h.
References removeDockWindow(), and w.
00215 { 00216 removeDockWindow(w); 00217 }
Here is the call graph for this function:

| bool Q3MainWindow::toolBarsMovable | ( | ) | const [inline] |
Returns true if the window allows its toolbars to be moved; otherwise returns false.
Definition at line 219 of file q3mainwindow.h.
References dockWindowsMovable().
00220 { 00221 return dockWindowsMovable(); 00222 }
Here is the call graph for this function:

Returns a list of all the toolbars which are in the dock dock area, regardless of their state.
For example, the TornOff dock area may contain closed toolbars but these are returned along with the visible toolbars.
Definition at line 1754 of file q3mainwindow.cpp.
References QList< T >::append(), QList< T >::at(), dockWindows(), i, QList< T >::size(), and tb.
01755 { 01756 QList<Q3DockWindow *> lst = dockWindows(dock); 01757 QList<Q3ToolBar *> tbl; 01758 for (int i = 0; i < lst.size(); ++i) { 01759 Q3ToolBar *tb = qobject_cast<Q3ToolBar *>(lst.at(i)); 01760 if (tb) 01761 tbl.append(tb); 01762 } 01763 return tbl; 01764 }
Here is the call graph for this function:

| void Q3MainWindow::lineUpToolBars | ( | bool | keepNewLines = false |
) | [inline] |
Lines up the toolbars. Line breaks are preserved if keepNewLines is true.
Definition at line 224 of file q3mainwindow.h.
References lineUpDockWindows().
00225 { 00226 lineUpDockWindows(keepNewLines); 00227 }
Here is the call graph for this function:

| Q3DockArea * Q3MainWindow::dockingArea | ( | const QPoint & | p | ) | [virtual] |
Definition at line 2113 of file q3mainwindow.cpp.
References d, QWidget::height(), p, and QWidget::width().
Referenced by Q3DockWindow::areaAt().
02114 { 02115 Q_D(Q3MainWindow); 02116 int mh = d->mb ? d->mb->height() : 0; 02117 int sh = d->sb ? d->sb->height() : 0; 02118 if (p.x() >= -5 && p.x() <= 100 && p.y() > mh && p.y() - height() - sh) 02119 return d->leftDock; 02120 if (p.x() >= width() - 100 && p.x() <= width() + 5 && p.y() > mh && p.y() - height() - sh) 02121 return d->rightDock; 02122 if (p.y() >= -5 && p.y() < mh + 100 && p.x() >= 0 && p.x() <= width()) 02123 return d->topDock; 02124 if (p.y() >= height() - sh - 100 && p.y() <= height() + 5 && p.x() >= 0 && p.x() <= width()) 02125 return d->bottomDock; 02126 return 0; 02127 }
Here is the call graph for this function:

| Q3DockArea * Q3MainWindow::leftDock | ( | ) | const |
Returns the Left dock area
Definition at line 2145 of file q3mainwindow.cpp.
Referenced by Q3MainWindowLayout::extraPixels(), Q3DockWindow::init(), operator<<(), operator>>(), and setDockEnabled().
| Q3DockArea * Q3MainWindow::rightDock | ( | ) | const |
Returns the Right dock area
Definition at line 2156 of file q3mainwindow.cpp.
Referenced by Q3MainWindowLayout::extraPixels(), Q3DockWindow::init(), operator<<(), operator>>(), and setDockEnabled().
| Q3DockArea * Q3MainWindow::topDock | ( | ) | const |
Returns the Top dock area
Definition at line 2167 of file q3mainwindow.cpp.
Referenced by event(), Q3MainWindowLayout::extraPixels(), operator<<(), operator>>(), removeDockWindow(), and setDockEnabled().
| Q3DockArea * Q3MainWindow::bottomDock | ( | ) | const |
Returns a pointer the Bottom dock area
Definition at line 2178 of file q3mainwindow.cpp.
Referenced by Q3DockWindow::init(), operator<<(), operator>>(), and setDockEnabled().
| bool Q3MainWindow::isCustomizable | ( | ) | const [virtual] |
Returns true if the dock area dock window menu includes the Customize menu item (which calls customize() when clicked). Returns false by default, i.e. the popup menu will not contain a Customize menu item. You will need to reimplement this function and set it to return true if you wish the user to be able to see the dock window menu.
Definition at line 2217 of file q3mainwindow.cpp.
Referenced by menuAboutToShow().
| bool Q3MainWindow::appropriate | ( | Q3DockWindow * | dw | ) | const |
Returns true if it is appropriate to include a menu item for the dw dock window in the dock window menu; otherwise returns false.
The user is able to change the state (show or hide) a dock window that has a menu item by clicking the item.
Call setAppropriate() to indicate whether or not a particular dock window should appear on the popup menu.
Definition at line 2236 of file q3mainwindow.cpp.
References d.
Referenced by menuAboutToShow().
02237 { 02238 Q_D(const Q3MainWindow); 02239 QMap<Q3DockWindow*, bool>::ConstIterator it = d->appropriate.find(dw); 02240 if (it == d->appropriate.end()) 02241 return true; 02242 return *it; 02243 }
| Q3PopupMenu * Q3MainWindow::createDockWindowMenu | ( | DockWindows | dockWindows = AllDockWindows |
) | const [virtual] |
Creates the dock window menu which contains all toolbars (if dockWindows is OnlyToolBars), all dock windows (if dockWindows is NoToolBars) or all toolbars and dock windows (if dockWindows is AllDockWindows - the default).
This function is called internally when necessary, e.g. when the user right clicks a dock area (providing isDockMenuEnabled() returns true). You can reimplement this function if you wish to customize the behavior.
The menu items representing the toolbars and dock windows are checkable. The visible dock windows are checked and the hidden dock windows are unchecked. The user can click a menu item to change its state (show or hide the dock window).
The list and the state are always kept up-to-date.
Toolbars and dock windows which are not appropriate in the current context (see setAppropriate()) are not listed in the menu.
The menu also has a menu item for lining up the dock windows.
If isCustomizable() returns true, a Customize menu item is added to the menu, which if clicked will call customize(). The isCustomizable() function we provide returns false and customize() does nothing, so they must be reimplemented in a subclass to be useful.
Definition at line 1978 of file q3mainwindow.cpp.
References QObject::connect(), d, l, menuAboutToShow(), QObject::setObjectName(), SIGNAL, and SLOT.
Referenced by showDockMenu().
01979 { 01980 Q_D(const Q3MainWindow); 01981 QObjectList l = queryList("Q3DockWindow"); 01982 if (l.isEmpty()) 01983 return 0; 01984 01985 Q3PopupMenu *menu = new Q3PopupMenu((Q3MainWindow*)this); 01986 menu->setObjectName("qt_customize_menu"); 01987 d->dockWindowModes.replace( menu, dockWindows ); 01988 menu->setCheckable(true); 01989 connect( menu, SIGNAL(aboutToShow()), this, SLOT(menuAboutToShow()) ); 01990 return menu; 01991 }
Here is the call graph for this function:

| void Q3MainWindow::setRightJustification | ( | bool | ) | [virtual, slot] |
Definition at line 1642 of file q3mainwindow.cpp.
References d, and triggerLayout().
01643 { 01644 Q_D(Q3MainWindow); 01645 if (enable == (bool)d->justify) 01646 return; 01647 d->justify = enable; 01648 triggerLayout(true); 01649 }
| void Q3MainWindow::setUsesBigPixmaps | ( | bool | ) | [virtual, slot] |
Definition at line 1562 of file q3mainwindow.cpp.
References d, emit, i, l, and pixmapSizeChanged().
01563 { 01564 Q_D(Q3MainWindow); 01565 if (enable == (bool)d->ubp) 01566 return; 01567 01568 d->ubp = enable; 01569 emit pixmapSizeChanged(enable); 01570 01571 QObjectList l = queryList("QLayout"); 01572 for (int i = 0; i < l.size(); ++i) 01573 static_cast<QLayout *>(l.at(i))->activate(); 01574 }
| void Q3MainWindow::setUsesTextLabel | ( | bool | ) | [virtual, slot] |
Definition at line 1597 of file q3mainwindow.cpp.
References d, emit, i, l, triggerLayout(), and usesTextLabelChanged().
01598 { 01599 Q_D(Q3MainWindow); 01600 if (enable == (bool)d->utl) 01601 return; 01602 01603 d->utl = enable; 01604 emit usesTextLabelChanged(enable); 01605 01606 QObjectList l = queryList("QLayout"); 01607 for (int i = 0; i < l.size(); ++i) 01608 static_cast<QLayout *>(l.at(i))->activate(); 01609 triggerLayout(false); 01610 }
| void Q3MainWindow::setDockWindowsMovable | ( | bool | ) | [virtual, slot] |
Definition at line 1825 of file q3mainwindow.cpp.
Referenced by setToolBarsMovable().
01826 { 01827 Q_D(Q3MainWindow); 01828 d->movable = enable; 01829 QObjectList l = queryList("Q3DockWindow"); 01830 for (int i = 0; i < l.size(); ++i) 01831 static_cast<Q3DockWindow*>(l.at(i))->setMovingEnabled(enable); 01832 }
| void Q3MainWindow::setOpaqueMoving | ( | bool | ) | [virtual, slot] |
Definition at line 1860 of file q3mainwindow.cpp.
01861 { 01862 Q_D(Q3MainWindow); 01863 d->opaque = b; 01864 QObjectList l = queryList("Q3DockWindow"); 01865 for (int i = 0; i < l.size(); ++i) 01866 static_cast<Q3DockWindow*>(l.at(i))->setOpaqueMoving(b); 01867 }
| void Q3MainWindow::setDockMenuEnabled | ( | bool | b | ) | [virtual, slot] |
If b is true, then right clicking on a dock window or dock area will pop up the dock window menu. If b is false, right clicking a dock window or dock area will not pop up the menu.
The menu lists the (appropriate()) dock windows (which may be shown or hidden), and has a "Line Up Dock Windows" item. It will also have a "Customize" menu item if isCustomizable() returns true.
Definition at line 1943 of file q3mainwindow.cpp.
01944 { 01945 d_func()->dockMenu = b; 01946 }
| void Q3MainWindow::whatsThis | ( | ) | [virtual, slot] |
Enters 'What's This?' mode and returns immediately.
This is the same as QWhatsThis::enterWhatsThisMode(), but implemented as a main window object's slot. This way it can easily be used for popup menus, for example:
Q3PopupMenu * help = new Q3PopupMenu(this); help->insertItem("What's &This", this , SLOT(enterWhatsThis()), Qt::SHIFT+Qt::Key_F1);
Definition at line 1696 of file q3mainwindow.cpp.
References QWhatsThis::enterWhatsThisMode().
01697 { 01698 #ifndef QT_NO_WHATSTHIS 01699 QWhatsThis::enterWhatsThisMode(); 01700 #endif 01701 }
| void Q3MainWindow::setAppropriate | ( | Q3DockWindow * | dw, | |
| bool | a | |||
| ) | [virtual, slot] |
Use this function to control whether or not the dw dock window's caption should appear as a menu item on the dock window menu that lists the dock windows.
If a is true then the dw will appear as a menu item on the dock window menu. The user is able to change the state (show or hide) a dock window that has a menu item by clicking the item; depending on the state of your application, this may or may not be appropriate. If a is false the dw will not appear on the popup menu.
Definition at line 2260 of file q3mainwindow.cpp.
02261 { 02262 d_func()->appropriate.insert(dw, a); 02263 }
| void Q3MainWindow::customize | ( | ) | [virtual, slot] |
This function is called when the user clicks the Customize menu item on the dock window menu.
The customize menu item will only appear if isCustomizable() returns true (it returns false by default).
The function is intended, for example, to provide the user with a means of telling the application that they wish to customize the main window, dock windows or dock areas.
The default implementation does nothing and the Customize menu item is not shown on the right-click menu by default. If you want the item to appear then reimplement isCustomizable() to return true, and reimplement this function to do whatever you want.
Definition at line 2202 of file q3mainwindow.cpp.
Referenced by menuAboutToShow().
| void Q3MainWindow::setToolBarsMovable | ( | bool | b | ) | [inline, slot] |
If b is true the tool bars can be moved.
Definition at line 229 of file q3mainwindow.h.
References setDockWindowsMovable().
00230 { 00231 setDockWindowsMovable(b); 00232 }
| void Q3MainWindow::pixmapSizeChanged | ( | bool | b | ) | [signal] |
This signal is emitted whenever the setUsesBigPixmaps() is called with a value different to the current setting. The new value is passed in b. All widgets that should respond to such changes, e.g. toolbar buttons, must connect to this signal.
Referenced by setUsesBigPixmaps().
| void Q3MainWindow::usesTextLabelChanged | ( | bool | b | ) | [signal] |
This signal is emitted whenever the setUsesTextLabel() is called with a value different to the current setting. The new value is passed in b. All widgets that should respond to such changes, e.g. toolbar buttons, must connect to this signal.
Referenced by setUsesTextLabel().
| void Q3MainWindow::dockWindowPositionChanged | ( | Q3DockWindow * | dockWindow | ) | [signal] |
This signal is emitted when the dockWindow has changed its position. A change in position occurs when a dock window is moved within its dock area or moved to another dock area (including the Minimized and TearOff dock areas).
Referenced by moveDockWindow(), and slotPlaceChanged().
| void Q3MainWindow::toolBarPositionChanged | ( | Q3ToolBar * | toolbar | ) | [signal] |
This signal is emitted when a toolbar is moved.
Referenced by slotPlaceChanged().
| void Q3MainWindow::setUpLayout | ( | ) | [protected, virtual, slot] |
Sets up the geometry management of the window. It is called automatically when needed, so you shouldn't need to call it.
Definition at line 1247 of file q3mainwindow.cpp.
References centralWidget(), d, QBoxLayout::Down, isNull(), l, menuBar(), QWidget::minimumSize(), Q3MainWindowLayout, Q3MainWindowLayout::setCentralWidget(), Q3MainWindowLayout::setLeftDock(), Q3MainWindowLayout::setRightDock(), QStyle::SH_MainWindow_SpaceBelowMenuBar, statusBar(), QWidget::style(), and styleHint().
Referenced by eventFilter(), minimumSizeHint(), setVisible(), and triggerLayout().
01248 { 01249 Q_D(Q3MainWindow); 01250 #ifndef QT_NO_MENUBAR 01251 if (!d->mb) { 01252 // slightly evil hack here. reconsider this 01253 QObjectList l = queryList("QMenuBar", 0, false, false); 01254 if (l.size()) 01255 d->mb = menuBar(); 01256 } 01257 #endif 01258 if (!d->sb) { 01259 // as above. 01260 QObjectList l = queryList("QStatusBar", 0, false, false); 01261 if (l.size()) 01262 d->sb = statusBar(); 01263 } 01264 01265 if (!d->tll) { 01266 d->tll = new QBoxLayout(this, QBoxLayout::Down); 01267 d->tll->setResizeMode(minimumSize().isNull() ? QLayout::Minimum : QLayout::FreeResize); 01268 } else { 01269 d->tll->setMenuBar(0); 01270 QLayoutItem *item; 01271 while ((item = d->tll->takeAt(0))) 01272 delete item; 01273 } 01274 01275 #ifndef QT_NO_MENUBAR 01276 if (d->mb && d->mb->isVisibleTo(this)) { 01277 d->tll->setMenuBar(d->mb); 01278 if (style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, 0, this)) 01279 d->tll->addSpacing(d->movable ? 1 : 2); 01280 } 01281 #endif 01282 01283 d->tll->addWidget(d->hideDock); 01284 if(d->topDock->parentWidget() == this) 01285 d->tll->addWidget(d->topDock); 01286 01287 Q3MainWindowLayout *mwl = new Q3MainWindowLayout(this, d->tll); 01288 d->tll->setStretchFactor(mwl, 1); 01289 01290 if(d->leftDock->parentWidget() == this) 01291 mwl->setLeftDock(d->leftDock); 01292 if (centralWidget()) 01293 mwl->setCentralWidget(centralWidget()); 01294 if(d->rightDock->parentWidget() == this) 01295 mwl->setRightDock(d->rightDock); 01296 d->mwl = mwl; 01297 01298 if(d->bottomDock->parentWidget() == this) 01299 d->tll->addWidget(d->bottomDock); 01300 01301 if (d->sb && d->sb->parentWidget() == this) { 01302 d->tll->addWidget(d->sb, 0); 01303 // make the sb stay on top of tool bars if there isn't enough space 01304 d->sb->raise(); 01305 } 01306 }
| bool Q3MainWindow::showDockMenu | ( | const QPoint & | globalPos | ) | [protected, virtual, slot] |
Shows the dock menu at the position globalPos. The menu lists the dock windows so that they can be shown (or hidden), lined up, and possibly customized. Returns true if the menu is shown; otherwise returns false.
If you want a custom menu, reimplement this function. You can create the menu from scratch or call createDockWindowMenu() and modify the result.
The default implementation uses the dock window menu which gets created by createDockWindowMenu(). You can reimplement createDockWindowMenu() if you want to use your own specialized popup menu.
Definition at line 2081 of file q3mainwindow.cpp.
References createDockWindowMenu(), and d.
Referenced by eventFilter().
02082 { 02083 Q_D(Q3MainWindow); 02084 if (!d->dockMenu) 02085 return false; 02086 02087 if(Q3PopupMenu *ret = createDockWindowMenu()) { 02088 ret->exec(globalPos); 02089 delete ret; 02090 return true; 02091 } 02092 return false; 02093 }
| void Q3MainWindow::menuAboutToShow | ( | ) | [protected, slot] |
This slot is called from the aboutToShow() signal of the default dock menu of the mainwindow. The default implementation initializes the menu with all dock windows and toolbars in this slot.
Definition at line 2000 of file q3mainwindow.cpp.
References QMenu::addAction(), QMenu::addSeparator(), AllDockWindows, appropriate(), QMenu::clear(), QObject::connect(), customize(), d, dockMainWindow(), dockWindows(), dockWindowsMovable(), doLineUp(), i, isCustomizable(), QString::isEmpty(), l, NoToolBars, OnlyToolBars, QObject::sender(), QAction::setCheckable(), QAction::setChecked(), SIGNAL, SLOT, and tb.
Referenced by createDockWindowMenu().
02001 { 02002 Q_D(Q3MainWindow); 02003 Q3PopupMenu *menu = (Q3PopupMenu*)sender(); 02004 menu->clear(); 02005 02006 DockWindows dockWindows; 02007 { 02008 QMap<Q3PopupMenu*, DockWindows>::Iterator it = d->dockWindowModes.find( menu ); 02009 if ( it == d->dockWindowModes.end() ) 02010 return; 02011 dockWindows = (*it); 02012 } 02013 02014 QObjectList l = queryList("Q3DockWindow"); 02015 bool empty = true; 02016 if (!l.isEmpty()) { 02017 if (dockWindows == AllDockWindows || dockWindows == NoToolBars) { 02018 for (int i = 0; i < l.size(); ++i) { 02019 Q3DockWindow *dw = (Q3DockWindow*)l.at(i); 02020 if (!appropriate(dw) || qobject_cast<Q3ToolBar*>(dw) || !dockMainWindow(dw)) 02021 continue; 02022 QString label = dw->windowTitle(); 02023 if (!label.isEmpty()) { 02024 QAction *act = menu->addAction(label); 02025 act->setChecked(dw->isVisible()); 02026 QObject::connect(act, SIGNAL(triggered()), dw, SLOT(toggleVisible())); 02027 empty = false; 02028 } 02029 } 02030 } 02031 if (!empty) { 02032 menu->addSeparator(); 02033 empty = true; 02034 } 02035 #ifndef QT_NO_TOOLBAR 02036 if (dockWindows == AllDockWindows || dockWindows == OnlyToolBars) { 02037 for (int i = 0; i < l.size(); ++i) { 02038 Q3ToolBar *tb = qobject_cast<Q3ToolBar*>(l.at(i)); 02039 if (!tb || !appropriate(tb) || !dockMainWindow(tb)) 02040 continue; 02041 QString label = tb->label(); 02042 if (!label.isEmpty()) { 02043 QAction *act = menu->addAction(label); 02044 act->setCheckable(true); 02045 act->setChecked(tb->isVisible()); 02046 QObject::connect(act, SIGNAL(triggered()), tb, SLOT(toggleVisible())); 02047 empty = false; 02048 } 02049 } 02050 } 02051 #endif 02052 } 02053 if (!empty) { 02054 menu->addSeparator(); 02055 empty = true; 02056 } 02057 02058 if (dockWindowsMovable()) 02059 menu->addAction(tr("Line up"), this, SLOT(doLineUp())); 02060 if (isCustomizable()) 02061 menu->addAction(tr("Customize..."), this, SLOT(customize())); 02062 }
| void Q3MainWindow::paintEvent | ( | QPaintEvent * | ) | [protected, virtual] |
Reimplemented from QWidget.
Definition at line 1400 of file q3mainwindow.cpp.
References d, QStyle::drawPrimitive(), p, QWidget::palette(), QStyleOption::palette, QStyle::PE_Q3Separator, QStyleOption::rect, QRect::setRect(), QStyle::SH_MainWindow_SpaceBelowMenuBar, QStyleOption::SO_Default, QStyleOption::state, QStyle::State_Sunken, QWidget::style(), styleHint(), QWidget::width(), and QWidget::y().
01401 { 01402 Q_D(Q3MainWindow); 01403 if (d->mb && 01404 style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, 0, this)) { 01405 QPainter p(this); 01406 int y = d->mb->height() + 1; 01407 QStyleOption opt(0, QStyleOption::SO_Default); 01408 opt.rect.setRect(0, y, width(), 1); 01409 opt.palette = palette(); 01410 opt.state = QStyle::State_Sunken; 01411 style()->drawPrimitive(QStyle::PE_Q3Separator, &opt, &p, this); 01412 } 01413 }
Here is the call graph for this function:

| void Q3MainWindow::childEvent | ( | QChildEvent * | e | ) | [protected, virtual] |
Monitors events, received in e, to ensure the layout is updated.
Reimplemented from QObject.
Definition at line 1455 of file q3mainwindow.cpp.
References QChildEvent::child(), QEvent::ChildRemoved, d, QObject::isWidgetType(), QWidget::isWindow(), removeDockWindow(), triggerLayout(), and QEvent::type().
01456 { 01457 Q_D(Q3MainWindow); 01458 if (e->type() == QEvent::ChildRemoved) { 01459 if (e->child() == 0 || 01460 !e->child()->isWidgetType() || 01461 ((QWidget*)e->child())->isWindow()) { 01462 // nothing 01463 } else if (e->child() == d->sb) { 01464 d->sb = 0; 01465 triggerLayout(); 01466 } else if (e->child() == d->mb) { 01467 d->mb = 0; 01468 triggerLayout(); 01469 } else if (e->child() == d->mc) { 01470 d->mc = 0; 01471 d->mwl->setCentralWidget(0); 01472 triggerLayout(); 01473 } else if (qobject_cast<Q3DockWindow*>(e->child())) { 01474 removeDockWindow((Q3DockWindow *)(e->child())); 01475 d->appropriate.remove((Q3DockWindow*)e->child()); 01476 triggerLayout(); 01477 } 01478 } else if (e->type() == QEvent::ChildInserted && !d->sb) { 01479 d->sb = qobject_cast<QStatusBar*>(e->child()); 01480 if (d->sb) { 01481 if (d->tll) { 01482 if (!d->tll->findWidget(d->sb)) 01483 d->tll->addWidget(d->sb); 01484 } else { 01485 triggerLayout(); 01486 } 01487 } 01488 } 01489 }
Here is the call graph for this function:

| bool Q3MainWindow::event | ( | QEvent * | e | ) | [protected, virtual] |
Reimplemented from QWidget.
Definition at line 1495 of file q3mainwindow.cpp.
References area(), QEvent::ChildRemoved, d, QWidget::event(), QWidget::height(), QEvent::LayoutRequest, QEvent::MenubarUpdated, QWidget::resize(), QCoreApplication::sendPostedEvents(), QEvent::StatusTip, QEvent::ToolBarChange, topDock(), triggerLayout(), QEvent::type(), QWidget::update(), and QWidget::width().
Referenced by KAstTopLevel::keyPressEvent(), and KAstTopLevel::keyReleaseEvent().
01496 { 01497 Q_D(Q3MainWindow); 01498 #ifndef QT_NO_STATUSTIP 01499 if (e->type() == QEvent::StatusTip) { 01500 if (d->sb) { 01501 d->sb->showMessage(static_cast<QStatusTipEvent*>(e)->tip()); 01502 return true; 01503 } 01504 } 01505 #endif 01506 if (e->type() == QEvent::ToolBarChange) { 01507 // Keep compatibility with the Qt 3 main window, use the real main window 01508 // or reimplement if you want proper handling. 01509 int deltaH = 0; 01510 Q3DockArea *area = topDock(); 01511 if (area->width() >= area->height()) { 01512 deltaH = area->sizeHint().height(); 01513 if (!area->isVisible()) { 01514 area->show(); 01515 } else { 01516 area->hide(); 01517 deltaH = -deltaH; 01518 } 01519 } 01520 01521 if (deltaH) { 01522 QApplication::sendPostedEvents(this, QEvent::LayoutRequest); 01523 resize(width(), height() + deltaH); 01524 } 01525 return true; 01526 } 01527 if (e->type() == QEvent::ChildRemoved && ((QChildEvent*)e)->child() == d->mc) { 01528 d->mc->removeEventFilter(this); 01529 d->mc = 0; 01530 d->mwl->setCentralWidget(0); 01531 } 01532 01533 if (e->type() == QEvent::MenubarUpdated) { 01534 QMenubarUpdatedEvent * const event = static_cast<QMenubarUpdatedEvent *>(e); 01535 if (event->menuBar() && event->menuBar()->parent() == this) { 01536 triggerLayout(); 01537 update(); 01538 } 01539 } 01540 return QWidget::event(e); 01541 }
Here is the call graph for this function:

| void Q3MainWindow::slotPlaceChanged | ( | ) | [private, slot] |
Definition at line 2095 of file q3mainwindow.cpp.
References dockWindowPositionChanged(), emit, QObject::sender(), tb, and toolBarPositionChanged().
Referenced by addDockWindow(), removeDockWindow(), and setDockEnabled().
02096 { 02097 QObject* obj = (QObject*)sender(); 02098 Q3DockWindow *dw = qobject_cast<Q3DockWindow*>(obj); 02099 if (dw) 02100 emit dockWindowPositionChanged(dw); 02101 #ifndef QT_NO_TOOLBAR 02102 Q3ToolBar *tb = qobject_cast<Q3ToolBar*>(obj); 02103 if (tb) 02104 emit toolBarPositionChanged(tb); 02105 #endif 02106 }
| void Q3MainWindow::doLineUp | ( | ) | [inline, private, slot] |
Definition at line 169 of file q3mainwindow.h.
Referenced by menuAboutToShow().
00169 { lineUpDockWindows(true); }
| void Q3MainWindow::triggerLayout | ( | bool | deleteLayout = true |
) | [private] |
Definition at line 1674 of file q3mainwindow.cpp.
References d, QCoreApplication::postEvent(), and setUpLayout().
Referenced by childEvent(), event(), setCentralWidget(), setMenuBar(), setRightJustification(), setStatusBar(), setUsesTextLabel(), Q3ToolBar::setVisible(), and QHideDock::updateState().
01675 { 01676 Q_D(Q3MainWindow); 01677 if (deleteLayout || !d->tll) 01678 setUpLayout(); 01679 QApplication::postEvent(this, new QEvent(QEvent::LayoutHint)); 01680 }
Here is the call graph for this function:

| bool Q3MainWindow::dockMainWindow | ( | QObject * | dock | ) | const [private] |
Definition at line 1416 of file q3mainwindow.cpp.
References QObject::parent().
Referenced by eventFilter(), and menuAboutToShow().
01417 { 01418 while (dock) { 01419 if (dock->parent() && 01420 dock->parent() == const_cast<Q3MainWindow*>(this)) 01421 return true; 01422 if (qobject_cast<Q3MainWindow*>(dock->parent())) 01423 return false; 01424 dock = dock->parent(); 01425 } 01426 return false; 01427 }
Here is the call graph for this function:

| void Q3MainWindow::setMenuBar | ( | QMenuBar * | newMenuBar | ) | [private, virtual] |
Sets this main window to use the menu bar newMenuBar.
The existing menu bar (if any) is deleted along with its contents.
Definition at line 740 of file q3mainwindow.cpp.
References d, and triggerLayout().
00741 { 00742 Q_D(Q3MainWindow); 00743 if (!newMenuBar) 00744 return; 00745 if (d->mb) 00746 delete d->mb; 00747 d->mb = newMenuBar; 00748 d->mb->installEventFilter(this); 00749 triggerLayout(); 00750 }
Here is the call graph for this function:

| void Q3MainWindow::setStatusBar | ( | QStatusBar * | newStatusBar | ) | [private, virtual] |
Sets this main window to use the status bar newStatusBar.
The existing status bar (if any) is deleted along with its contents.
Note that newStatusBar must be a child of this main window, and that it is not automatically displayed. If you call this function after show(), you will probably also need to call newStatusBar->show().
Definition at line 797 of file q3mainwindow.cpp.
References QObject::connect(), d, SIGNAL, SLOT, and triggerLayout().
00798 { 00799 Q_D(Q3MainWindow); 00800 if (!newStatusBar || newStatusBar == d->sb) 00801 return; 00802 if (d->sb) 00803 delete d->sb; 00804 d->sb = newStatusBar; 00805 #if 0 00806 // ### this code can cause unnecessary creation of a tool tip group 00807 connect(toolTipGroup(), SIGNAL(showTip(QString)), 00808 d->sb, SLOT(showMessage(QString))); 00809 connect(toolTipGroup(), SIGNAL(removeTip()), 00810 d->sb, SLOT(clearMessage())); 00811 #endif 00812 d->sb->installEventFilter(this); 00813 triggerLayout(); 00814 }
Here is the call graph for this function:

friend class Q3DockWindow [friend] |
Definition at line 185 of file q3mainwindow.h.
friend class QMenuBarPrivate [friend] |
Definition at line 186 of file q3mainwindow.h.
friend class QHideDock [friend] |
friend class Q3ToolBar [friend] |
Definition at line 188 of file q3mainwindow.h.
friend class Q3MainWindowLayout [friend] |
| QTextStream & operator<< | ( | QTextStream & | ts, | |
| const Q3MainWindow & | mainWindow | |||
| ) | [related] |
Writes the layout (sizes and positions) of the dock windows in the dock areas of the Q3MainWindow mainWindow, including Minimized and TornOff dock windows, to the text stream ts.
This can be used, for example, in conjunction with QSettings to save the user's layout when the mainWindow receives a close event.
Definition at line 2292 of file q3mainwindow.cpp.
References bottomDock(), dockWindows(), QTextStream::endl(), QWidget::geometry(), QRect::height(), i, int, QWidget::isVisible(), l, leftDock(), rightDock(), saveDockArea(), topDock(), QRect::width(), Q3DockWindow::windowTitle(), QRect::x(), and QRect::y().
02293 { 02294 QList<Q3DockWindow *> l = mainWindow.dockWindows(Qt::DockMinimized); 02295 for (int i = 0; i < l.size(); ++i) { 02296 Q3DockWindow *dw = l.at(i); 02297 ts << dw->windowTitle(); 02298 ts << ","; 02299 } 02300 ts << endl; 02301 02302 l = mainWindow.dockWindows(Qt::DockTornOff); 02303 for (int i = 0; i < l.size(); ++i) { 02304 Q3DockWindow *dw = l.at(i); 02305 ts << dw->windowTitle(); 02306 ts << ","; 02307 } 02308 ts << endl; 02309 for (int i = 0; i < l.size(); ++i) { 02310 Q3DockWindow *dw = l.at(i); 02311 ts << "[" << dw->windowTitle() << "," 02312 << (int)dw->geometry().x() << "," 02313 << (int)dw->geometry().y() << "," 02314 << (int)dw->geometry().width() << "," 02315 << (int)dw->geometry().height() << "," 02316 << (int)dw->isVisible() << "]"; 02317 } 02318 ts << endl; 02319 02320 saveDockArea(ts, mainWindow.topDock()); 02321 saveDockArea(ts, mainWindow.bottomDock()); 02322 saveDockArea(ts, mainWindow.rightDock()); 02323 saveDockArea(ts, mainWindow.leftDock()); 02324 return ts; 02325 }
Here is the call graph for this function:

| QTextStream & operator>> | ( | QTextStream & | ts, | |
| Q3MainWindow & | mainWindow | |||
| ) | [related] |
Reads the layout (sizes and positions) of the dock windows in the dock areas of the Q3MainWindow mainWindow from the text stream, ts, including Minimized and TornOff dock windows. Restores the dock windows and dock areas to these sizes and positions. The layout information must be in the format produced by operator<<().
This can be used, for example, in conjunction with QSettings to restore the user's layout.
Definition at line 2408 of file q3mainwindow.cpp.
References bottomDock(), dockWindows(), i, int, l, leftDock(), loadDockArea(), QTextStream::readLine(), rightDock(), s, and topDock().
02409 { 02410 QList<Q3DockWindow *> l = mainWindow.dockWindows(); 02411 02412 QString s = ts.readLine(); 02413 QStringList names = s.split(','); 02414 loadDockArea(names, 0, Qt::DockMinimized, l, &mainWindow, ts); 02415 02416 s = ts.readLine(); 02417 names = s.split(','); 02418 loadDockArea(names, 0, Qt::DockTornOff, l, &mainWindow, ts); 02419 02420 int i = 0; 02421 Q3DockArea *areas[] = { mainWindow.topDock(), mainWindow.bottomDock(), mainWindow.rightDock(), mainWindow.leftDock() }; 02422 for (int dl = (int)Qt::DockTop; dl != (int)Qt::DockMinimized; ++dl, ++i) { 02423 s = ts.readLine(); 02424 names = s.split(','); 02425 loadDockArea(names, areas[i], (Qt::Dock)dl, l, &mainWindow, ts); 02426 } 02427 return ts; 02428 }
Here is the call graph for this function:

1.5.1