Qt 4.8
qtoolbarlayout_p.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 QTOOLBARLAYOUT_P_H
43 #define QTOOLBARLAYOUT_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include <QtGui/qlayout.h>
57 #include <private/qlayoutengine_p.h>
58 #include <QVector>
59 
61 
62 #ifndef QT_NO_TOOLBAR
63 
64 class QAction;
65 class QToolBarExtension;
66 class QMenu;
67 
68 class QToolBarItem : public QWidgetItem
69 {
70 public:
72  bool isEmpty() const;
73 
76 };
77 
78 class QToolBarLayout : public QLayout
79 {
80  Q_OBJECT
81 
82 public:
83  QToolBarLayout(QWidget *parent = 0);
84  ~QToolBarLayout();
85 
86  void addItem(QLayoutItem *item);
87  QLayoutItem *itemAt(int index) const;
88  QLayoutItem *takeAt(int index);
89  int count() const;
90 
91  bool isEmpty() const;
92  void invalidate();
93  Qt::Orientations expandingDirections() const;
94 
95  void setGeometry(const QRect &r);
96  QSize minimumSize() const;
97  QSize sizeHint() const;
98 
99  void insertAction(int index, QAction *action);
100  int indexOf(QAction *action) const;
101  int indexOf(QWidget *widget) const { return QLayout::indexOf(widget); }
102 
103  bool layoutActions(const QSize &size);
104  QSize expandedSize(const QSize &size) const;
105  bool expanded, animating;
106 
107  void setUsePopupMenu(bool set); // Yeah, there's no getter, but it's internal.
108  void checkUsePopupMenu();
109 
110  bool movable() const;
111  void updateMarginAndSpacing();
112  bool hasExpandFlag() const;
113 
114 public Q_SLOTS:
115  void setExpanded(bool b);
116 
117 private:
119  QSize hint, minSize;
120  bool dirty, expanding, empty, expandFlag;
124 
125  void updateGeomArray() const;
126  QToolBarItem *createItem(QAction *action);
128 };
129 
130 #endif // QT_NO_TOOLBAR
131 
133 
134 #endif // QTOOLBARLAYOUT_P_H
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QSize sizeHint() const
Reimplemented Function
virtual void invalidate()
Invalidates any cached information in this layout item.
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QAction * action
#define Q_SLOTS
Definition: qobjectdefs.h:71
QVector< QLayoutStruct > geomArray
virtual QWidget * widget()
Returns the widget managed by this 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
Qt::Orientations expandingDirections() const
Reimplemented Function
bool isEmpty() const
Returns true if the widget is hidden; otherwise returns false.
virtual int indexOf(QWidget *) const
Searches for widget widget in this layout (not including child layouts).
Definition: qlayout.cpp:1378
The QLayout class is the base class of geometry managers.
Definition: qlayout.h:90
QList< QToolBarItem * > items
QToolBarExtension * extension
The QWidgetItem class is a layout item that represents a widget.
Definition: qlayoutitem.h:122
#define Q_OBJECT
Definition: qobjectdefs.h:157
QSize minimumSize() const
Reimplemented Function
QToolBarItem(QWidget *widget)
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
void setGeometry(const QRect &)
Reimplemented Function
int indexOf(QWidget *widget) const
Searches for widget widget in this layout (not including child layouts).
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
quint16 index
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
The QAction class provides an abstract user interface action that can be inserted into widgets...
Definition: qaction.h:64
The QList class is a template class that provides lists.
Definition: qdatastream.h:62