summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qtabbar_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/widgets/qtabbar_p.h')
-rw-r--r--src/widgets/widgets/qtabbar_p.h109
1 files changed, 50 insertions, 59 deletions
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index 4d005af9a9..1036d819eb 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -88,37 +88,51 @@ class Q_WIDGETS_EXPORT QTabBarPrivate : public QWidgetPrivate
Q_DECLARE_PUBLIC(QTabBar)
public:
QTabBarPrivate()
- : currentIndex(-1), mouseButtons(Qt::NoButton), pressedIndex(-1), firstVisible(0), lastVisible(-1),
- shape(QTabBar::RoundedNorth), layoutDirty(false), drawBase(true), scrollOffset(0),
- hoverIndex(-1), elideModeSetByUser(false), useScrollButtonsSetByUser(false), expanding(true),
- closeButtonOnTabs(false), selectionBehaviorOnRemove(QTabBar::SelectRightTab),
- paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false),
- autoHide(false), changeCurrentOnDrag(false), switchTabCurrentIndex(-1), switchTabTimerId(0),
- movingTab(nullptr)
- {}
+ : layoutDirty(false), drawBase(true), elideModeSetByUser(false), useScrollButtons(false),
+ useScrollButtonsSetByUser(false), expanding(true), closeButtonOnTabs(false),
+ paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false),
+ autoHide(false), changeCurrentOnDrag(false)
+ {}
- int currentIndex;
- Qt::MouseButtons mouseButtons;
- int pressedIndex;
- int firstVisible;
- int lastVisible;
- QTabBar::Shape shape;
- bool layoutDirty;
- bool drawBase;
- int scrollOffset;
+ QRect hoverRect;
+ QPoint dragStartPosition;
+ QSize iconSize;
+ QToolButton* rightB = nullptr; // right or bottom
+ QToolButton* leftB = nullptr; // left or top
+ QMovableTabWidget *movingTab = nullptr;
+ int hoverIndex = -1;
+ int switchTabCurrentIndex = -1;
+ int switchTabTimerId = 0;
+ Qt::TextElideMode elideMode = Qt::ElideNone;
+ QTabBar::SelectionBehavior selectionBehaviorOnRemove = QTabBar::SelectRightTab;
+ QTabBar::Shape shape = QTabBar::RoundedNorth;
+ Qt::MouseButtons mouseButtons = Qt::NoButton;
+
+ int currentIndex = -1;
+ int pressedIndex = -1;
+ int firstVisible = 0;
+ int lastVisible = -1;
+ int scrollOffset = 0;
+
+ bool layoutDirty : 1;
+ bool drawBase : 1;
+ bool elideModeSetByUser : 1;
+ bool useScrollButtons : 1;
+ bool useScrollButtonsSetByUser : 1;
+ bool expanding : 1;
+ bool closeButtonOnTabs : 1;
+ bool paintWithOffsets : 1;
+ bool movable : 1;
+ bool dragInProgress : 1;
+ bool documentMode : 1;
+ bool autoHide : 1;
+ bool changeCurrentOnDrag : 1;
struct Tab {
inline Tab(const QIcon &ico, const QString &txt)
- : enabled(true) , visible(true), shortcutId(0), text(txt), icon(ico),
- leftWidget(nullptr), rightWidget(nullptr), lastTab(-1), dragOffset(0)
-#if QT_CONFIG(animation)
- , animation(nullptr)
-#endif // animation
+ : text(txt), icon(ico), enabled(true), visible(true)
{}
bool operator==(const Tab &other) const { return &other == this; }
- bool enabled;
- bool visible;
- int shortcutId;
QString text;
#if QT_CONFIG(tooltip)
QString toolTip;
@@ -126,6 +140,9 @@ public:
#if QT_CONFIG(whatsthis)
QString whatsThis;
#endif
+#ifndef QT_NO_ACCESSIBILITY
+ QString accessibleName;
+#endif
QIcon icon;
QRect rect;
QRect minRect;
@@ -133,13 +150,13 @@ public:
QColor textColor;
QVariant data;
- QWidget *leftWidget;
- QWidget *rightWidget;
- int lastTab;
- int dragOffset;
-#ifndef QT_NO_ACCESSIBILITY
- QString accessibleName;
-#endif
+ QWidget *leftWidget = nullptr;
+ QWidget *rightWidget = nullptr;
+ int shortcutId = 0;
+ int lastTab = -1;
+ int dragOffset = 0;
+ uint enabled : 1;
+ uint visible : 1;
#if QT_CONFIG(animation)
~Tab() { delete animation; }
@@ -154,7 +171,7 @@ public:
//these are needed for the callbacks
Tab *tab;
QTabBarPrivate *priv;
- } *animation;
+ } *animation = nullptr;
void startAnimation(QTabBarPrivate *priv, int duration) {
if (!priv->isAnimated()) {
@@ -191,15 +208,10 @@ public:
inline bool validIndex(int index) const { return index >= 0 && index < tabList.count(); }
void setCurrentNextEnabledIndex(int offset);
- QToolButton* rightB; // right or bottom
- QToolButton* leftB; // left or top
-
void _q_scrollTabs();
void _q_closeTab();
void moveTab(int index, int offset);
void moveTabFinished(int index);
- QRect hoverRect;
- int hoverIndex;
void refresh();
void layoutTabs();
@@ -215,28 +227,7 @@ public:
void initBasicStyleOption(QStyleOptionTab *option, int tabIndex) const;
void makeVisible(int index);
- QSize iconSize;
- Qt::TextElideMode elideMode;
- bool elideModeSetByUser;
- bool useScrollButtons;
- bool useScrollButtonsSetByUser;
-
- bool expanding;
- bool closeButtonOnTabs;
- QTabBar::SelectionBehavior selectionBehaviorOnRemove;
-
- QPoint dragStartPosition;
- bool paintWithOffsets;
- bool movable;
- bool dragInProgress;
- bool documentMode;
- bool autoHide;
- bool changeCurrentOnDrag;
-
- int switchTabCurrentIndex;
- int switchTabTimerId;
- QMovableTabWidget *movingTab;
// shared by tabwidget and qtabbar
static void initStyleBaseOption(QStyleOptionTabBarBase *optTabBase, QTabBar *tabbar, QSize size)
{