Qt 4.8
qmdiarea.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QMDIAREA_H
43 #define QMDIAREA_H
44 
45 #include <QtGui/qabstractscrollarea.h>
46 #include <QtGui/qtabwidget.h>
47 
49 
51 
52 QT_MODULE(Gui)
53 
54 #ifndef QT_NO_MDIAREA
55 
56 class QMdiSubWindow;
57 
58 class QMdiAreaPrivate;
60 {
61  Q_OBJECT
63  QBrush background;
64  WindowOrder activationOrder;
65  ViewMode viewMode;
66 #ifndef QT_NO_TABBAR
70 #endif
71 #ifndef QT_NO_TABWIDGET
74 #endif
76 public:
77  enum AreaOption {
78  DontMaximizeSubWindowOnActivation = 0x1
79  };
80  Q_DECLARE_FLAGS(AreaOptions, AreaOption)
81 
82  enum WindowOrder {
85  ActivationHistoryOrder
86  };
87 
88  enum ViewMode {
90  TabbedView
91  };
92 
93  QMdiArea(QWidget *parent = 0);
94  ~QMdiArea();
95 
96  QSize sizeHint() const;
97  QSize minimumSizeHint() const;
98 
99  QMdiSubWindow *currentSubWindow() const;
100  QMdiSubWindow *activeSubWindow() const;
101  QList<QMdiSubWindow *> subWindowList(WindowOrder order = CreationOrder) const;
102 
103  QMdiSubWindow *addSubWindow(QWidget *widget, Qt::WindowFlags flags = 0);
104  void removeSubWindow(QWidget *widget);
105 
106  QBrush background() const;
107  void setBackground(const QBrush &background);
108 
109  WindowOrder activationOrder() const;
110  void setActivationOrder(WindowOrder order);
111 
112  void setOption(AreaOption option, bool on = true);
113  bool testOption(AreaOption opton) const;
114 
115  void setViewMode(ViewMode mode);
116  ViewMode viewMode() const;
117 
118 #ifndef QT_NO_TABBAR
119  bool documentMode() const;
120  void setDocumentMode(bool enabled);
121 
122  void setTabsClosable(bool closable);
123  bool tabsClosable() const;
124 
125  void setTabsMovable(bool movable);
126  bool tabsMovable() const;
127 #endif
128 #ifndef QT_NO_TABWIDGET
129  void setTabShape(QTabWidget::TabShape shape);
130  QTabWidget::TabShape tabShape() const;
131 
132  void setTabPosition(QTabWidget::TabPosition position);
133  QTabWidget::TabPosition tabPosition() const;
134 #endif
135 
136 Q_SIGNALS:
137  void subWindowActivated(QMdiSubWindow *);
138 
139 public Q_SLOTS:
140  void setActiveSubWindow(QMdiSubWindow *window);
141  void tileSubWindows();
142  void cascadeSubWindows();
143  void closeActiveSubWindow();
144  void closeAllSubWindows();
145  void activateNextSubWindow();
146  void activatePreviousSubWindow();
147 
148 protected Q_SLOTS:
149  void setupViewport(QWidget *viewport);
150 
151 protected:
152  bool event(QEvent *event);
153  bool eventFilter(QObject *object, QEvent *event);
154  void paintEvent(QPaintEvent *paintEvent);
155  void childEvent(QChildEvent *childEvent);
156  void resizeEvent(QResizeEvent *resizeEvent);
157  void timerEvent(QTimerEvent *timerEvent);
158  void showEvent(QShowEvent *showEvent);
159  bool viewportEvent(QEvent *event);
160  void scrollContentsBy(int dx, int dy);
161 
162 private:
165  Q_PRIVATE_SLOT(d_func(), void _q_deactivateAllWindows())
166  Q_PRIVATE_SLOT(d_func(), void _q_processWindowStateChanged(Qt::WindowStates, Qt::WindowStates))
167  Q_PRIVATE_SLOT(d_func(), void _q_currentTabChanged(int))
168  Q_PRIVATE_SLOT(d_func(), void _q_closeTab(int))
169  Q_PRIVATE_SLOT(d_func(), void _q_moveTab(int, int))
170 };
171 
173 
175 
177 
178 #endif // QT_NO_MDIAREA
179 #endif // QMDIAREA_H
virtual void showEvent(QShowEvent *)
This event handler can be reimplemented in a subclass to receive widget show events which are passed ...
Definition: qwidget.cpp:9842
bool documentMode
whether the tab bar is set to document mode in tabbed view mode.
Definition: qmdiarea.h:67
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
EventRef event
QPointer< QWidget > widget
#define QT_MODULE(x)
Definition: qglobal.h:2783
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
Definition: qglobal.h:2348
bool tabsClosable
whether the tab bar should place close buttons on each tab in tabbed view mode.
Definition: qmdiarea.h:68
TabPosition
This enum type defines where QTabWidget draws the tab row:
Definition: qtabwidget.h:112
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
virtual void timerEvent(QTimerEvent *)
This event handler can be reimplemented in a subclass to receive timer events for the object...
Definition: qobject.cpp:1294
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool tabsMovable
whether the user can move the tabs within the tabbar area in tabbed view mode.
Definition: qmdiarea.h:69
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
#define Q_PRIVATE_SLOT(d, signature)
Definition: qobjectdefs.h:73
ViewMode
This enum describes the view mode of the area; i.
Definition: qmdiarea.h:88
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
#define Q_SLOTS
Definition: qobjectdefs.h:71
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
void setupViewport(QWidget *viewport)
This slot is called by QAbstractScrollArea after setViewport(viewport) has been called.
#define Q_SIGNALS
Definition: qobjectdefs.h:72
#define Q_ENUMS(x)
Definition: qobjectdefs.h:84
void resizeEvent(QResizeEvent *)
This event handler can be reimplemented in a subclass to receive resize events (passed in event)...
NSWindow * window
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
Definition: qglobal.h:2355
void paintEvent(QPaintEvent *)
This event handler can be reimplemented in a subclass to receive paint events (passed in event)...
virtual void childEvent(QChildEvent *)
This event handler can be reimplemented in a subclass to receive child events.
Definition: qobject.cpp:1332
The QMdiArea widget provides an area in which MDI windows are displayed.
Definition: qmdiarea.h:59
QTabWidget::TabShape tabShape
the shape of the tabs in tabbed view mode.
Definition: qmdiarea.h:72
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
The QShowEvent class provides an event that is sent when a widget is shown.
Definition: qevent.h:380
#define Q_OBJECT
Definition: qobjectdefs.h:157
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
Definition: qobject.cpp:1375
The QChildEvent class contains event parameters for child object events.
Definition: qcoreevent.h:353
virtual bool viewportEvent(QEvent *)
The main event handler for the scrolling area (the viewport() widget).
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
The QTimerEvent class contains parameters that describe a timer event.
Definition: qcoreevent.h:341
QTabWidget::TabPosition tabPosition
the position of the tabs in tabbed view mode.
Definition: qmdiarea.h:73
WindowOrder
Specifies the criteria to use for ordering the list of child windows returned by subWindowList().
Definition: qmdiarea.h:82
QSize minimumSizeHint() const
Reimplemented Function
Definition: qnamespace.h:54
virtual void scrollContentsBy(int dx, int dy)
This virtual handler is called when the scroll bars are moved by dx, dy, and consequently the viewpor...
bool event(QEvent *)
Reimplemented Function
AreaOption
This enum describes options that customize the behavior of the QMdiArea.
Definition: qmdiarea.h:77
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
#define QT_END_HEADER
Definition: qglobal.h:137
QSize sizeHint() const
Reimplemented Function
The QMdiSubWindow class provides a subwindow class for QMdiArea.
Definition: qmdisubwindow.h:60
#define enabled
TabShape
This enum type defines the shape of the tabs:
Definition: qtabwidget.h:126
The QList class is a template class that provides lists.
Definition: qdatastream.h:62