10#include <dtkwidget_global.h>
18DWIDGET_BEGIN_NAMESPACE
21class DTabBar :
public QWidget,
public DObject
26 Q_PROPERTY(QTabBar::Shape shape READ shape WRITE
setShape)
28 Q_PROPERTY(
int count READ count)
29 Q_PROPERTY(
bool drawBase READ drawBase WRITE setDrawBase)
30 Q_PROPERTY(QSize iconSize READ iconSize WRITE
setIconSize)
31 Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE
setElideMode)
32 Q_PROPERTY(
bool usesScrollButtons READ usesScrollButtons WRITE setUsesScrollButtons)
34 Q_PROPERTY(QTabBar::SelectionBehavior selectionBehaviorOnRemove READ selectionBehaviorOnRemove WRITE setSelectionBehaviorOnRemove)
35 Q_PROPERTY(
bool expanding READ expanding WRITE setExpanding)
36 Q_PROPERTY(
bool movable READ isMovable WRITE setMovable)
37 Q_PROPERTY(
bool dragable READ isDragable WRITE setDragable)
38 Q_PROPERTY(
bool documentMode READ documentMode WRITE setDocumentMode)
39 Q_PROPERTY(
bool autoHide READ autoHide WRITE setAutoHide)
40 Q_PROPERTY(
bool changeCurrentOnDrag READ changeCurrentOnDrag WRITE setChangeCurrentOnDrag)
43 Q_PROPERTY(QColor maskColor READ maskColor WRITE
setMaskColor)
45 Q_PROPERTY(QColor flashColor READ flashColor WRITE setFlashColor)
48 explicit DTabBar(QWidget *parent = 0);
53 bool visibleAddButton()
const;
55 QTabBar::Shape shape()
const;
58 int addTab(
const QString &text);
59 int addTab(
const QIcon &icon,
const QString &text);
61 int insertTab(
int index,
const QString &text);
62 int insertTab(
int index,
const QIcon&icon,
const QString &text);
70 QString
tabText(
int index)
const;
71 void setTabText(
int index,
const QString &text);
76 Qt::TextElideMode elideMode()
const;
84#ifndef QT_NO_WHATSTHIS
85 void setTabWhatsThis(
int index,
const QString &text);
86 QString tabWhatsThis(
int index)
const;
89 void setTabData(
int index,
const QVariant &data);
90 QVariant
tabData(
int index)
const;
93 int tabAt(
const QPoint &pos)
const;
95 int currentIndex()
const;
98 void setDrawBase(
bool drawTheBase);
99 bool drawBase()
const;
101 QSize iconSize()
const;
104 bool usesScrollButtons()
const;
105 void setUsesScrollButtons(
bool useButtons);
107 bool tabsClosable()
const;
110 void setTabButton(
int index, QTabBar::ButtonPosition position, QWidget *widget);
111 QWidget *tabButton(
int index, QTabBar::ButtonPosition position)
const;
113 QTabBar::SelectionBehavior selectionBehaviorOnRemove()
const;
114 void setSelectionBehaviorOnRemove(QTabBar::SelectionBehavior behavior);
116 bool expanding()
const;
117 void setExpanding(
bool enabled);
119 bool isMovable()
const;
120 void setMovable(
bool movable);
122 bool isDragable()
const;
123 void setDragable(
bool dragable);
125 bool documentMode()
const;
126 void setDocumentMode(
bool set);
128 bool autoHide()
const;
129 void setAutoHide(
bool hide);
131 bool changeCurrentOnDrag()
const;
132 void setChangeCurrentOnDrag(
bool change);
134 int startDragDistance()
const;
136 QColor maskColor()
const;
137 QColor flashColor()
const;
139 QWindow *dragIconWindow()
const;
155 void tabDroped(
int index, Qt::DropAction action, QObject *target);
166 void setFlashColor(QColor flashColor);
168 void startDrag(
int index);
169 void stopDrag(Qt::DropAction action);
172 void dragEnterEvent(QDragEnterEvent *e)
override;
173 void dragLeaveEvent(QDragLeaveEvent *e)
override;
174 void dragMoveEvent(QDragMoveEvent *e)
override;
175 void dropEvent(QDropEvent *e)
override;
176 void resizeEvent(QResizeEvent *e)
override;
178 void startTabFlash(
int index);
180 virtual void paintTab(QPainter *painter,
int index,
const QStyleOptionTab &option)
const;
182 virtual QPixmap createDragPixmapFromTab(
int index,
const QStyleOptionTab &option, QPoint *hotspot)
const;
183 virtual QMimeData *createMimeDataFromTab(
int index,
const QStyleOptionTab &option)
const;
184 virtual bool canInsertFromMimeData(
int index,
const QMimeData *source)
const;
185 virtual void insertFromMimeData(
int index,
const QMimeData *source);
186 virtual void insertFromMimeDataOnDragEnter(
int index,
const QMimeData *source);
188 virtual void tabInserted(
int index);
189 virtual void tabLayoutChange();
190 virtual void tabRemoved(
int index);
192 virtual QSize tabSizeHint(
int index)
const;
193 virtual QSize minimumTabSizeHint(
int index)
const;
194 virtual QSize maximumTabSizeHint(
int index)
const;
void setTabText(int index, const QString &text)
设置标签索引位置文本.
Definition dtabbar.cpp:1873
int addTab(const QString &text)
添加一个新的标签,返回新标签的索引.
Definition dtabbar.cpp:1759
void setTabData(int index, const QVariant &data)
设置标签索引位置数据.
Definition dtabbar.cpp:1966
void tabIsInserted(int index)
新标签已插入.
void tabAddRequested()
新标签加入.
QString tabToolTip(int index) const
返回标签索引位置提示文本.
Definition dtabbar.cpp:1942
void currentChanged(int index)
当前索引位置改变.
void tabIsRemoved(int index)
标签已删除.
void removeTab(int index)
移除标签索引位置
Definition dtabbar.cpp:1813
void setTabLabelAlignment(Qt::Alignment alignment)
设置 tab 标签文字对齐方式.
Definition dtabbar.cpp:2257
void tabCloseRequested(int index)
点击关闭后发出.
void dragActionChanged(Qt::DropAction action)
鼠标形状发生变化.
void setCurrentIndex(int index)
设置当前标签索引位置.
Definition dtabbar.cpp:2268
void setTabToolTip(int index, const QString &tip)
设置标签索引位置提示文本.
Definition dtabbar.cpp:1931
void setTabMaximumSize(int index, const QSize &size)
设置索引标签的最大尺寸.
Definition dtabbar.cpp:1682
void moveTab(int from, int to)
移动标签索引位置
Definition dtabbar.cpp:1825
void setTabIcon(int index, const QIcon &icon)
设置标签索引位置图标.
Definition dtabbar.cpp:1896
void setEnabledEmbedStyle(bool enable)
启用直角样式的 Tabbar. 此风格适用于切换窗口的操作,多用于支持多开的应用.
Definition dtabbar.cpp:2226
void tabDroped(int index, Qt::DropAction action, QObject *target)
标签拖放.
void setElideMode(Qt::TextElideMode mode)
设置缩略模式
Definition dtabbar.cpp:1918
QRect tabRect(int index) const
返回标签索引位置矩形.
Definition dtabbar.cpp:1990
void setTabEnabled(int index, bool)
设置标签索引位置启用状态
Definition dtabbar.cpp:1849
bool isTabEnabled(int index) const
是否启用标签索引位置
Definition dtabbar.cpp:1837
void tabReleaseRequested(int index)
索引标签鼠标释放.
void setTabMinimumSize(int index, const QSize &size)
设置索引标签的最小尺寸.
Definition dtabbar.cpp:1662
void tabMoved(int from, int to)
索引位置发生变化
void setTabsClosable(bool closable)
设置标签栏是否可关闭.
Definition dtabbar.cpp:2092
void tabBarClicked(int index)
点击索引标签.
QVariant tabData(int index) const
返回标签索引位置数据.
Definition dtabbar.cpp:1978
void setMaskColor(QColor maskColor)
设置颜色.
Definition dtabbar.cpp:2304
QString tabText(int index) const
返回标签索引位置文本.
Definition dtabbar.cpp:1861
void tabBarDoubleClicked(int index)
双击索引标签.
void setIconSize(const QSize &size)
设置图标大小.
Definition dtabbar.cpp:2060
void setVisibleAddButton(bool visibleAddButton)
设置新建标签按钮是否显示.
Definition dtabbar.cpp:2279
void dragEnd(Qt::DropAction action)
拖放结束.
QIcon tabIcon(int index) const
返回标签索引位置图标.
Definition dtabbar.cpp:1885
int tabAt(const QPoint &pos) const
根据位置返回标签索引位置.
Definition dtabbar.cpp:2006
int insertTab(int index, const QString &text)
插入一个文本标签.
Definition dtabbar.cpp:1787
void setStartDragDistance(int startDragDistance)
设置开始拖动距离.
Definition dtabbar.cpp:2293
void setShape(QTabBar::Shape shape)
设置标签栏形状.
Definition dtabbar.cpp:1726