diff options
author | Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> | 2015-09-29 13:15:29 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> | 2015-11-16 12:47:01 +0000 |
commit | a955d9d142b33de7b60b8dfd32a23de9ae528602 (patch) | |
tree | 5ab337a1fb4b1711a45c7dfe6fdfb52a121bce97 /src/widgets/styles/qstyle.cpp | |
parent | 52e335e191130c5beb457e8d07851fc98ceb909a (diff) |
Widgets: enable scroll buttons to be placed anywhere on a QTabBar
If a tab bar contain more tabs than it can fit inside its geometry, it
will show two scroll buttons that lets the user scroll left or right.
From before, those buttons where hard coded to always be placed
together on the right side of the tab bar.
This patch will make it possible for the style to specify the exact
geometry of both scroll buttons. The reason for this is that 3rd party
styles has a specific need to place the "scroll left" button on the left
side, and the "scroll right" on the right side. Additionally, there is a
need to draw fade-out effects on tabs that end up half-way obscured by the
buttons. This can already be achieved by extending the tab tear concept to
include two tears/fade effects, one for each side of the tab bar.
Previous code in QTabBar that hard-coded scroll buttons and related
functionality will now be factored out to the style, and the base
style (QCommonStyle) will implement the old default logic of placing the
buttons together on the right side. Six new style enums will be added:
SE_TabBarScrollLeftButton: the rect of the left scroll button
SE_TabBarScrollRightButton: the rect of the right scroll button
SE_TabBarTearIndicatorLeft: the rect of the left tab tear
SE_TabBarTearIndicatorRight: the rect of the right tab tear
PE_IndicatorTabTearLeft: draw the left tab tear
PE_IndicatorTabTearRight: draw the right tab tear
Change-Id: I4cda05c2f7323de5cbd3ca071eb796085257c19b
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Diffstat (limited to 'src/widgets/styles/qstyle.cpp')
-rw-r--r-- | src/widgets/styles/qstyle.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index b368477a39..5f9f0b8e75 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -691,7 +691,9 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \value PE_PanelToolBar The panel for a toolbar. \value PE_PanelTipLabel The panel for a tip label. \value PE_FrameTabBarBase The frame that is drawn for a tab bar, ususally drawn for a tab bar that isn't part of a tab widget. - \value PE_IndicatorTabTear An indicator that a tab is partially scrolled out of the visible tab bar when there are many tabs. + \value PE_IndicatorTabTear Deprecated. Use \l{PE_IndicatorTabTearLeft} instead. + \value PE_IndicatorTabTearLeft An indicator that a tab is partially scrolled out on the left side of the visible tab bar when there are many tabs. + \value PE_IndicatorTabTearRight An indicator that a tab is partially scrolled out on the right side of the visible tab bar when there are many tabs. \value PE_IndicatorColumnViewArrow An arrow in a QColumnView. \value PE_Widget A plain QWidget. @@ -1057,7 +1059,12 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \value SE_ItemViewItemCheckIndicator Area for a view item's check mark. - \value SE_TabBarTearIndicator Area for the tear indicator on a tab bar with scroll arrows. + \value SE_TabBarTearIndicator Deprecated. Use SE_TabBarTearIndicatorLeft instead. + \value SE_TabBarTearIndicatorLeft Area for the tear indicator on the left side of a tab bar with scroll arrows. + \value SE_TabBarTearIndicatorRight Area for the tear indicator on the right side of a tab bar with scroll arrows. + + \value SE_TabBarScrollLeftButton Area for the scroll left button on a tab bar with scroll buttons. + \value SE_TabBarScrollRightButton Area for the scroll right button on a tab bar with scroll buttons. \value SE_TreeViewDisclosureItem Area for the actual disclosure item in a tree branch. |