19class Q_WIDGETS_EXPORT
QTabBar:
public QWidget
23 Q_PROPERTY(Shape shape READ shape WRITE setShape)
24 Q_PROPERTY(
int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged)
25 Q_PROPERTY(
int count READ count)
26 Q_PROPERTY(
bool drawBase READ drawBase WRITE setDrawBase)
27 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
28 Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE setElideMode)
29 Q_PROPERTY(
bool usesScrollButtons READ usesScrollButtons WRITE setUsesScrollButtons)
30 Q_PROPERTY(
bool tabsClosable READ tabsClosable WRITE setTabsClosable)
31 Q_PROPERTY(SelectionBehavior selectionBehaviorOnRemove READ selectionBehaviorOnRemove
32 WRITE setSelectionBehaviorOnRemove)
33 Q_PROPERTY(
bool expanding READ expanding WRITE setExpanding)
34 Q_PROPERTY(
bool movable READ isMovable WRITE setMovable)
35 Q_PROPERTY(
bool documentMode READ documentMode WRITE setDocumentMode)
36 Q_PROPERTY(
bool autoHide READ autoHide WRITE setAutoHide)
37 Q_PROPERTY(
bool changeCurrentOnDrag READ changeCurrentOnDrag WRITE setChangeCurrentOnDrag)
40 explicit QTabBar(QWidget *parent =
nullptr);
43 enum Shape { RoundedNorth, RoundedSouth, RoundedWest, RoundedEast,
44 TriangularNorth, TriangularSouth, TriangularWest, TriangularEast
53 enum SelectionBehavior {
60 void setShape(Shape shape);
62 int addTab(
const QString &text);
63 int addTab(
const QIcon &icon,
const QString &text);
65 int insertTab(
int index,
const QString &text);
66 int insertTab(
int index,
const QIcon&icon,
const QString &text);
68 void removeTab(
int index);
69 void moveTab(
int from,
int to);
71 bool isTabEnabled(
int index)
const;
72 void setTabEnabled(
int index,
bool enabled);
74 bool isTabVisible(
int index)
const;
75 void setTabVisible(
int index,
bool visible);
77 QString tabText(
int index)
const;
78 void setTabText(
int index,
const QString &text);
80 QColor tabTextColor(
int index)
const;
81 void setTabTextColor(
int index,
const QColor &color);
83 QIcon tabIcon(
int index)
const;
84 void setTabIcon(
int index,
const QIcon &icon);
86 Qt::TextElideMode elideMode()
const;
87 void setElideMode(Qt::TextElideMode mode);
90 void setTabToolTip(
int index,
const QString &tip);
91 QString tabToolTip(
int index)
const;
94#if QT_CONFIG(whatsthis)
95 void setTabWhatsThis(
int index,
const QString &text);
96 QString tabWhatsThis(
int index)
const;
99 void setTabData(
int index,
const QVariant &data);
100 QVariant tabData(
int index)
const;
102 QRect tabRect(
int index)
const;
103 int tabAt(
const QPoint &pos)
const;
105 int currentIndex()
const;
108 QSize sizeHint()
const override;
109 QSize minimumSizeHint()
const override;
111 void setDrawBase(
bool drawTheBase);
112 bool drawBase()
const;
114 QSize iconSize()
const;
115 void setIconSize(
const QSize &size);
117 bool usesScrollButtons()
const;
118 void setUsesScrollButtons(
bool useButtons);
120 bool tabsClosable()
const;
121 void setTabsClosable(
bool closable);
123 void setTabButton(
int index, ButtonPosition position, QWidget *widget);
124 QWidget *tabButton(
int index, ButtonPosition position)
const;
126 SelectionBehavior selectionBehaviorOnRemove()
const;
127 void setSelectionBehaviorOnRemove(SelectionBehavior behavior);
129 bool expanding()
const;
130 void setExpanding(
bool enabled);
132 bool isMovable()
const;
133 void setMovable(
bool movable);
135 bool documentMode()
const;
136 void setDocumentMode(
bool set);
138 bool autoHide()
const;
139 void setAutoHide(
bool hide);
141 bool changeCurrentOnDrag()
const;
142 void setChangeCurrentOnDrag(
bool change);
144#if QT_CONFIG(accessibility)
145 QString accessibleTabName(
int index)
const;
146 void setAccessibleTabName(
int index,
const QString &name);
150 void setCurrentIndex(
int index);
153 void currentChanged(
int index);
154 void tabCloseRequested(
int index);
155 void tabMoved(
int from,
int to);
156 void tabBarClicked(
int index);
157 void tabBarDoubleClicked(
int index);
160 virtual QSize tabSizeHint(
int index)
const;
161 virtual QSize minimumTabSizeHint(
int index)
const;
162 virtual void tabInserted(
int index);
163 virtual void tabRemoved(
int index);
164 virtual void tabLayoutChange();
166 bool event(QEvent *) override;
167 void resizeEvent(QResizeEvent *) override;
168 void showEvent(QShowEvent *) override;
169 void hideEvent(QHideEvent *) override;
170 void paintEvent(QPaintEvent *) override;
171 void mousePressEvent(QMouseEvent *) override;
172 void mouseMoveEvent(QMouseEvent *) override;
173 void mouseReleaseEvent(QMouseEvent *) override;
174 void mouseDoubleClickEvent(QMouseEvent *) override;
175#if QT_CONFIG(wheelevent)
176 void wheelEvent(QWheelEvent *event) override;
178 void keyPressEvent(QKeyEvent *) override;
179 void changeEvent(QEvent *) override;
180 void timerEvent(QTimerEvent *event) override;
181 virtual void initStyleOption(QStyleOptionTab *option,
int tabIndex)
const;
183#if QT_CONFIG(accessibility)
184 friend class QAccessibleTabBar;
187 Q_DISABLE_COPY(QTabBar)
188 Q_DECLARE_PRIVATE(QTabBar)