Add HasFrame feature to QStyleOptionTab
This makes it possible for styles like Fusion to draw tabbars different when they have a frame. Change-Id: I1bb21198c0c3caf44c757f6f39310bf2509054bf Reviewed-by: J-P Nurmi <jpnurmi@digia.com>bb10
parent
7501d55ae0
commit
3928bd0606
|
|
@ -1271,7 +1271,8 @@ QStyleOptionTab::QStyleOptionTab()
|
|||
row(0),
|
||||
position(Beginning),
|
||||
selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets),
|
||||
documentMode(false)
|
||||
documentMode(false),
|
||||
features(QStyleOptionTab::None)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -1284,7 +1285,8 @@ QStyleOptionTab::QStyleOptionTab(int version)
|
|||
row(0),
|
||||
position(Beginning),
|
||||
selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets),
|
||||
documentMode(false)
|
||||
documentMode(false),
|
||||
features(QStyleOptionTab::None)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -1437,6 +1439,17 @@ QStyleOptionTab::QStyleOptionTab(int version)
|
|||
The default value is false;
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QStyleOptionTab::TabFeature
|
||||
|
||||
Describes the various features that a tab button can have.
|
||||
|
||||
\value None A normal tab button.
|
||||
\value HasFrame The tab button is positioned on a tab frame
|
||||
|
||||
\sa features
|
||||
*/
|
||||
|
||||
/*!
|
||||
\variable QStyleOptionTab::leftButtonSize
|
||||
\brief the size for the left widget on the tab.
|
||||
|
|
|
|||
|
|
@ -255,7 +255,9 @@ public:
|
|||
enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected };
|
||||
enum CornerWidget { NoCornerWidgets = 0x00, LeftCornerWidget = 0x01,
|
||||
RightCornerWidget = 0x02 };
|
||||
enum TabFeature { None = 0x00, HasFrame = 0x01 };
|
||||
Q_DECLARE_FLAGS(CornerWidgets, CornerWidget)
|
||||
Q_DECLARE_FLAGS(TabFeatures, TabFeature)
|
||||
|
||||
QTabBar::Shape shape;
|
||||
QString text;
|
||||
|
|
@ -268,6 +270,7 @@ public:
|
|||
bool documentMode;
|
||||
QSize leftButtonSize;
|
||||
QSize rightButtonSize;
|
||||
TabFeatures features;
|
||||
|
||||
QStyleOptionTab();
|
||||
QStyleOptionTab(const QStyleOptionTab &other) : QStyleOption(Version, Type) { *this = other; }
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
|
|||
|
||||
#ifndef QT_NO_TABWIDGET
|
||||
if (const QTabWidget *tw = qobject_cast<const QTabWidget *>(parentWidget())) {
|
||||
option->features |= QStyleOptionTab::HasFrame;
|
||||
if (tw->cornerWidget(Qt::TopLeftCorner) || tw->cornerWidget(Qt::BottomLeftCorner))
|
||||
option->cornerWidgets |= QStyleOptionTab::LeftCornerWidget;
|
||||
if (tw->cornerWidget(Qt::TopRightCorner) || tw->cornerWidget(Qt::BottomRightCorner))
|
||||
|
|
|
|||
Loading…
Reference in New Issue