18class Q_WIDGETS_EXPORT
QTabBar:
public QWidget
22 Q_PROPERTY(Shape shape READ shape WRITE setShape)
23 Q_PROPERTY(
int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged)
24 Q_PROPERTY(
int count READ count)
25 Q_PROPERTY(
bool drawBase READ drawBase WRITE setDrawBase)
26 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
27 Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE setElideMode)
28 Q_PROPERTY(
bool usesScrollButtons READ usesScrollButtons WRITE setUsesScrollButtons)
29 Q_PROPERTY(
bool tabsClosable READ tabsClosable WRITE setTabsClosable)
30 Q_PROPERTY(SelectionBehavior selectionBehaviorOnRemove READ selectionBehaviorOnRemove
31 WRITE setSelectionBehaviorOnRemove)
32 Q_PROPERTY(
bool expanding READ expanding WRITE setExpanding)
33 Q_PROPERTY(
bool movable READ isMovable WRITE setMovable)
34 Q_PROPERTY(
bool documentMode READ documentMode WRITE setDocumentMode)
35 Q_PROPERTY(
bool autoHide READ autoHide WRITE setAutoHide)
36 Q_PROPERTY(
bool changeCurrentOnDrag READ changeCurrentOnDrag WRITE setChangeCurrentOnDrag)
39 explicit QTabBar(QWidget *parent =
nullptr);
42 enum Shape { RoundedNorth, RoundedSouth, RoundedWest, RoundedEast,
43 TriangularNorth, TriangularSouth, TriangularWest, TriangularEast
52 enum SelectionBehavior {
59 void setShape(Shape shape);
61 int addTab(
const QString &text);
62 int addTab(
const QIcon &icon,
const QString &text);
64 int insertTab(
int index,
const QString &text);
65 int insertTab(
int index,
const QIcon&icon,
const QString &text);
67 void removeTab(
int index);
68 void moveTab(
int from,
int to);
70 bool isTabEnabled(
int index)
const;
71 void setTabEnabled(
int index,
bool enabled);
73 bool isTabVisible(
int index)
const;
74 void setTabVisible(
int index,
bool visible);
76 QString tabText(
int index)
const;
77 void setTabText(
int index,
const QString &text);
79 QColor tabTextColor(
int index)
const;
80 void setTabTextColor(
int index,
const QColor &color);
82 QIcon tabIcon(
int index)
const;
83 void setTabIcon(
int index,
const QIcon &icon);
85 Qt::TextElideMode elideMode()
const;
86 void setElideMode(Qt::TextElideMode mode);
89 void setTabToolTip(
int index,
const QString &tip);
90 QString tabToolTip(
int index)
const;
93#if QT_CONFIG(whatsthis)
94 void setTabWhatsThis(
int index,
const QString &text);
95 QString tabWhatsThis(
int index)
const;
98 void setTabData(
int index,
const QVariant &data);
99 QVariant tabData(
int index)
const;
101 QRect tabRect(
int index)
const;
102 int tabAt(
const QPoint &pos)
const;
104 int currentIndex()
const;
107 QSize sizeHint()
const override;
108 QSize minimumSizeHint()
const override;
110 void setDrawBase(
bool drawTheBase);
111 bool drawBase()
const;
113 QSize iconSize()
const;
114 void setIconSize(
const QSize &size);
116 bool usesScrollButtons()
const;
117 void setUsesScrollButtons(
bool useButtons);
119 bool tabsClosable()
const;
120 void setTabsClosable(
bool closable);
122 void setTabButton(
int index, ButtonPosition position, QWidget *widget);
123 QWidget *tabButton(
int index, ButtonPosition position)
const;
125 SelectionBehavior selectionBehaviorOnRemove()
const;
126 void setSelectionBehaviorOnRemove(SelectionBehavior behavior);
128 bool expanding()
const;
129 void setExpanding(
bool enabled);
131 bool isMovable()
const;
132 void setMovable(
bool movable);
134 bool documentMode()
const;
135 void setDocumentMode(
bool set);
137 bool autoHide()
const;
138 void setAutoHide(
bool hide);
140 bool changeCurrentOnDrag()
const;
141 void setChangeCurrentOnDrag(
bool change);
143#if QT_CONFIG(accessibility)
144 QString accessibleTabName(
int index)
const;
145 void setAccessibleTabName(
int index,
const QString &name);
149 void setCurrentIndex(
int index);
152 void currentChanged(
int index);
153 void tabCloseRequested(
int index);
154 void tabMoved(
int from,
int to);
155 void tabBarClicked(
int index);
156 void tabBarDoubleClicked(
int index);
159 virtual QSize tabSizeHint(
int index)
const;
160 virtual QSize minimumTabSizeHint(
int index)
const;
161 virtual void tabInserted(
int index);
162 virtual void tabRemoved(
int index);
163 virtual void tabLayoutChange();
165 bool event(QEvent *) override;
166 void resizeEvent(QResizeEvent *) override;
167 void showEvent(QShowEvent *) override;
168 void hideEvent(QHideEvent *) override;
169 void paintEvent(QPaintEvent *) override;
170 void mousePressEvent(QMouseEvent *) override;
171 void mouseMoveEvent(QMouseEvent *) override;
172 void mouseReleaseEvent(QMouseEvent *) override;
173 void mouseDoubleClickEvent(QMouseEvent *) override;
174#if QT_CONFIG(wheelevent)
175 void wheelEvent(QWheelEvent *event) override;
177 void keyPressEvent(QKeyEvent *) override;
178 void changeEvent(QEvent *) override;
179 void timerEvent(QTimerEvent *event) override;
180 virtual void initStyleOption(QStyleOptionTab *option,
int tabIndex)
const;
182#if QT_CONFIG(accessibility)
183 friend class QAccessibleTabBar;
186 Q_DISABLE_COPY(QTabBar)
187 Q_DECLARE_PRIVATE(QTabBar)