1
/****************************************************************************
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of the QtGui module of the Qt Toolkit.
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.
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.
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.
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.
40
****************************************************************************/
45
#include <QtWidgets/qwidget.h>
46
#include <QtGui/qicon.h>
53
#ifndef QT_NO_TABWIDGET
56
class QTabWidgetPrivate;
57
class QStyleOptionTabWidgetFrame;
59
class Q_WIDGETS_EXPORT QTabWidget : public QWidget
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)
75
explicit QTabWidget(QWidget *parent = 0);
78
int addTab(QWidget *widget, const QString &);
79
int addTab(QWidget *widget, const QIcon& icon, const QString &label);
81
int insertTab(int index, QWidget *widget, const QString &);
82
int insertTab(int index, QWidget *widget, const QIcon& icon, const QString &label);
84
void removeTab(int index);
86
bool isTabEnabled(int index) const;
87
void setTabEnabled(int index, bool);
89
QString tabText(int index) const;
90
void setTabText(int index, const QString &);
92
QIcon tabIcon(int index) const;
93
void setTabIcon(int index, const QIcon & icon);
96
void setTabToolTip(int index, const QString & tip);
97
QString tabToolTip(int index) const;
100
#ifndef QT_NO_WHATSTHIS
101
void setTabWhatsThis(int index, const QString &text);
102
QString tabWhatsThis(int index) const;
105
int currentIndex() const;
106
QWidget *currentWidget() const;
107
QWidget *widget(int index) const;
108
int indexOf(QWidget *widget) const;
111
enum TabPosition { North, South, West, East };
112
TabPosition tabPosition() const;
113
void setTabPosition(TabPosition);
115
bool tabsClosable() const;
116
void setTabsClosable(bool closeable);
118
bool isMovable() const;
119
void setMovable(bool movable);
121
enum TabShape { Rounded, Triangular };
122
TabShape tabShape() const;
123
void setTabShape(TabShape s);
125
QSize sizeHint() const;
126
QSize minimumSizeHint() const;
127
int heightForWidth(int width) const;
128
bool hasHeightForWidth() const;
130
void setCornerWidget(QWidget * w, Qt::Corner corner = Qt::TopRightCorner);
131
QWidget * cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const;
133
Qt::TextElideMode elideMode() const;
134
void setElideMode(Qt::TextElideMode);
136
QSize iconSize() const;
137
void setIconSize(const QSize &size);
139
bool usesScrollButtons() const;
140
void setUsesScrollButtons(bool useButtons);
142
bool documentMode() const;
143
void setDocumentMode(bool set);
147
QTabBar* tabBar() const;
150
void setCurrentIndex(int index);
151
void setCurrentWidget(QWidget *widget);
154
void currentChanged(int index);
155
void tabCloseRequested(int index);
158
virtual void tabInserted(int index);
159
virtual void tabRemoved(int index);
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;
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);
180
#endif // QT_NO_TABWIDGET
186
#endif // QTABWIDGET_H