~ubuntu-branches/ubuntu/wily/qtbase-opensource-src/wily

« back to all changes in this revision

Viewing changes to src/widgets/widgets/qtabwidget.h

  • Committer: Package Import Robot
  • Author(s): Timo Jyrinki
  • Date: 2013-02-05 12:46:17 UTC
  • Revision ID: package-import@ubuntu.com-20130205124617-c8jouts182j002fx
Tags: upstream-5.0.1+dfsg
ImportĀ upstreamĀ versionĀ 5.0.1+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 2012 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 QTABWIDGET_H
 
43
#define QTABWIDGET_H
 
44
 
 
45
#include <QtWidgets/qwidget.h>
 
46
#include <QtGui/qicon.h>
 
47
 
 
48
QT_BEGIN_HEADER
 
49
 
 
50
QT_BEGIN_NAMESPACE
 
51
 
 
52
 
 
53
#ifndef QT_NO_TABWIDGET
 
54
 
 
55
class QTabBar;
 
56
class QTabWidgetPrivate;
 
57
class QStyleOptionTabWidgetFrame;
 
58
 
 
59
class Q_WIDGETS_EXPORT QTabWidget : public QWidget
 
60
{
 
61
    Q_OBJECT
 
62
    Q_ENUMS(TabPosition TabShape)
 
63
    Q_PROPERTY(TabPosition tabPosition READ tabPosition WRITE setTabPosition)
 
64
    Q_PROPERTY(TabShape tabShape READ tabShape WRITE setTabShape)
 
65
    Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged)
 
66
    Q_PROPERTY(int count READ count)
 
67
    Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
 
68
    Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE setElideMode)
 
69
    Q_PROPERTY(bool usesScrollButtons READ usesScrollButtons WRITE setUsesScrollButtons)
 
70
    Q_PROPERTY(bool documentMode READ documentMode WRITE setDocumentMode)
 
71
    Q_PROPERTY(bool tabsClosable READ tabsClosable WRITE setTabsClosable)
 
72
    Q_PROPERTY(bool movable READ isMovable WRITE setMovable)
 
73
 
 
74
public:
 
75
    explicit QTabWidget(QWidget *parent = 0);
 
76
    ~QTabWidget();
 
77
 
 
78
    int addTab(QWidget *widget, const QString &);
 
79
    int addTab(QWidget *widget, const QIcon& icon, const QString &label);
 
80
 
 
81
    int insertTab(int index, QWidget *widget, const QString &);
 
82
    int insertTab(int index, QWidget *widget, const QIcon& icon, const QString &label);
 
83
 
 
84
    void removeTab(int index);
 
85
 
 
86
    bool isTabEnabled(int index) const;
 
87
    void setTabEnabled(int index, bool);
 
88
 
 
89
    QString tabText(int index) const;
 
90
    void setTabText(int index, const QString &);
 
91
 
 
92
    QIcon tabIcon(int index) const;
 
93
    void setTabIcon(int index, const QIcon & icon);
 
94
 
 
95
#ifndef QT_NO_TOOLTIP
 
96
    void setTabToolTip(int index, const QString & tip);
 
97
    QString tabToolTip(int index) const;
 
98
#endif
 
99
 
 
100
#ifndef QT_NO_WHATSTHIS
 
101
    void setTabWhatsThis(int index, const QString &text);
 
102
    QString tabWhatsThis(int index) const;
 
103
#endif
 
104
 
 
105
    int currentIndex() const;
 
106
    QWidget *currentWidget() const;
 
107
    QWidget *widget(int index) const;
 
108
    int indexOf(QWidget *widget) const;
 
109
    int count() const;
 
110
 
 
111
    enum TabPosition { North, South, West, East };
 
112
    TabPosition tabPosition() const;
 
113
    void setTabPosition(TabPosition);
 
114
 
 
115
    bool tabsClosable() const;
 
116
    void setTabsClosable(bool closeable);
 
117
 
 
118
    bool isMovable() const;
 
119
    void setMovable(bool movable);
 
120
 
 
121
    enum TabShape { Rounded, Triangular };
 
122
    TabShape tabShape() const;
 
123
    void setTabShape(TabShape s);
 
124
 
 
125
    QSize sizeHint() const;
 
126
    QSize minimumSizeHint() const;
 
127
    int heightForWidth(int width) const;
 
128
    bool hasHeightForWidth() const;
 
129
 
 
130
    void setCornerWidget(QWidget * w, Qt::Corner corner = Qt::TopRightCorner);
 
131
    QWidget * cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const;
 
132
 
 
133
    Qt::TextElideMode elideMode() const;
 
134
    void setElideMode(Qt::TextElideMode);
 
135
 
 
136
    QSize iconSize() const;
 
137
    void setIconSize(const QSize &size);
 
138
 
 
139
    bool usesScrollButtons() const;
 
140
    void setUsesScrollButtons(bool useButtons);
 
141
 
 
142
    bool documentMode() const;
 
143
    void setDocumentMode(bool set);
 
144
 
 
145
    void clear();
 
146
 
 
147
    QTabBar* tabBar() const;
 
148
 
 
149
public Q_SLOTS:
 
150
    void setCurrentIndex(int index);
 
151
    void setCurrentWidget(QWidget *widget);
 
152
 
 
153
Q_SIGNALS:
 
154
    void currentChanged(int index);
 
155
    void tabCloseRequested(int index);
 
156
 
 
157
protected:
 
158
    virtual void tabInserted(int index);
 
159
    virtual void tabRemoved(int index);
 
160
 
 
161
    void showEvent(QShowEvent *);
 
162
    void resizeEvent(QResizeEvent *);
 
163
    void keyPressEvent(QKeyEvent *);
 
164
    void paintEvent(QPaintEvent *);
 
165
    void setTabBar(QTabBar *);
 
166
    void changeEvent(QEvent *);
 
167
    bool event(QEvent *);
 
168
    void initStyleOption(QStyleOptionTabWidgetFrame *option) const;
 
169
 
 
170
 
 
171
private:
 
172
    Q_DECLARE_PRIVATE(QTabWidget)
 
173
    Q_DISABLE_COPY(QTabWidget)
 
174
    Q_PRIVATE_SLOT(d_func(), void _q_showTab(int))
 
175
    Q_PRIVATE_SLOT(d_func(), void _q_removeTab(int))
 
176
    Q_PRIVATE_SLOT(d_func(), void _q_tabMoved(int, int))
 
177
    void setUpLayout(bool = false);
 
178
};
 
179
 
 
180
#endif // QT_NO_TABWIDGET
 
181
 
 
182
QT_END_NAMESPACE
 
183
 
 
184
QT_END_HEADER
 
185
 
 
186
#endif // QTABWIDGET_H