Qt 4.8
qstackedlayout.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 QSTACKEDLAYOUT_H
43 #define QSTACKEDLAYOUT_H
44 
45 #include <QtGui/qlayout.h>
46 
48 
50 
51 QT_MODULE(Gui)
52 
54 
56 {
57  Q_OBJECT
60  int currentIndex;
61  StackingMode stackingMode;
62  QDOC_PROPERTY(int count READ count)
63 
64 public:
65  enum StackingMode {
67  StackAll
68  };
69 
71  explicit QStackedLayout(QWidget *parent);
72  explicit QStackedLayout(QLayout *parentLayout);
73  ~QStackedLayout();
74 
75  int addWidget(QWidget *w);
76  int insertWidget(int index, QWidget *w);
77 
78  QWidget *currentWidget() const;
79  int currentIndex() const;
80 #ifdef Q_NO_USING_KEYWORD
81  inline QWidget *widget() { return QLayout::widget(); }
82 #else
83  using QLayout::widget;
84 #endif
85  QWidget *widget(int) const;
86  int count() const;
87 
88  StackingMode stackingMode() const;
89  void setStackingMode(StackingMode stackingMode);
90 
91  // abstract virtual functions:
92  void addItem(QLayoutItem *item);
93  QSize sizeHint() const;
94  QSize minimumSize() const;
95  QLayoutItem *itemAt(int) const;
96  QLayoutItem *takeAt(int);
97  void setGeometry(const QRect &rect);
98 
99 Q_SIGNALS:
100  void widgetRemoved(int index);
101  void currentChanged(int index);
102 
103 public Q_SLOTS:
104  void setCurrentIndex(int index);
105  void setCurrentWidget(QWidget *w);
106 
107 private:
109 };
110 
112 
114 
115 #endif // QSTACKEDLAYOUT_H
virtual QLayoutItem * itemAt(int index) const =0
Must be implemented in subclasses to return the layout item at index.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QDOC_PROPERTY(text)
Definition: qglobal.h:2503
#define QT_MODULE(x)
Definition: qglobal.h:2783
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
virtual void addItem(QLayoutItem *)=0
Implemented in subclasses to add an item.
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
virtual void setGeometry(const QRect &)
Reimplemented Function
Definition: qlayout.cpp:655
#define Q_SLOTS
Definition: qobjectdefs.h:71
#define Q_SIGNALS
Definition: qobjectdefs.h:72
The QStackedLayout class provides a stack of widgets where only one widget is visible at a time...
#define Q_ENUMS(x)
Definition: qobjectdefs.h:84
virtual QLayoutItem * takeAt(int index)=0
Must be implemented in subclasses to remove the layout item at index from the layout, and return the item.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition: qlayoutitem.h:64
The QLayout class is the base class of geometry managers.
Definition: qlayout.h:90
#define Q_OBJECT
Definition: qobjectdefs.h:157
virtual int count() const =0
Must be implemented in subclasses to return the number of items in the layout.
void addWidget(QWidget *w)
Adds widget w to this layout in a manner specific to the layout.
Definition: qlayout.cpp:319
virtual QSize sizeHint() const =0
Implemented in subclasses to return the preferred size of this item.
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
StackingMode
This enum specifies how the layout handles its child widgets regarding their visibility.
quint16 index
QSize minimumSize() const
Returns the minimum size of this layout.
Definition: qlayout.cpp:1166
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
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
#define QT_END_HEADER
Definition: qglobal.h:137