diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-07 08:34:53 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-07 08:34:53 +0100 |
commit | 75391511ff75d6999822cda9f699da585f49ad37 (patch) | |
tree | 566dbd70ca624e733025a68612a95aaade463bba /src/widgets/styles | |
parent | fd9b0b86bb5f78ffa855409c4dd5976505ef83f5 (diff) | |
parent | 68c30e372b01561e8809fcfa5426ae896da70b8e (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ia2ce994c42adc010c453edaeea57f672556958f6
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qstyleoption.cpp | 16 | ||||
-rw-r--r-- | src/widgets/styles/qstyleoption.h | 8 | ||||
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 11 |
3 files changed, 35 insertions, 0 deletions
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 4b861d938e..5a2ca2f2e7 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -1470,6 +1470,22 @@ QStyleOptionTab::QStyleOptionTab(int version) The default value is QSize(-1, -1), i.e. an invalid size; */ +/*! + Constructs a QStyleOptionTabV4 object, initializing the members + variables to their default values. + */ + +QStyleOptionTabV4::QStyleOptionTabV4() : QStyleOptionTab(QStyleOptionTabV4::Version) +{ +} + +/*! + \variable QStyleOptionTabV4::tabIndex + \brief the index for the tab being represented. + + The default value is -1, i.e. a tab not on a tabbar; + */ + #endif // QT_CONFIG(tabbar) /*! diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h index 7f5edf4279..a8ce3b465e 100644 --- a/src/widgets/styles/qstyleoption.h +++ b/src/widgets/styles/qstyleoption.h @@ -296,6 +296,14 @@ protected: QStyleOptionTab(int version); }; +class Q_WIDGETS_EXPORT QStyleOptionTabV4 : public QStyleOptionTab +{ +public: + enum StyleOptionVersion { Version = 4 }; + QStyleOptionTabV4(); + int tabIndex = -1; +}; + Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionTab::CornerWidgets) typedef Q_DECL_DEPRECATED QStyleOptionTab QStyleOptionTabV2; diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 7e8c9a6050..2eccb24431 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3027,6 +3027,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC r = positionRect(w, subRule, subRule2, PseudoElement_ComboBoxArrow, r, opt->direction); subRule2.drawRule(p, r); } else { + rule.configurePalette(&cmbOpt.palette, QPalette::ButtonText, QPalette::Button); cmbOpt.subControls = QStyle::SC_ComboBoxArrow; QWindowsStyle::drawComplexControl(cc, &cmbOpt, p, w); } @@ -6009,6 +6010,16 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c case SE_TabBarTabRightButton: { QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab); if (subRule.hasBox() || !subRule.hasNativeBorder()) { + if (se == SE_TabBarTabText) { + if (const QStyleOptionTabV4 *tab = qstyleoption_cast<const QStyleOptionTabV4 *>(opt)) { + const QTabBar *bar = qobject_cast<const QTabBar *>(w); + const QRect optRect = bar && tab->tabIndex != -1 ? bar->tabRect(tab->tabIndex) : opt->rect; + const QRect r = positionRect(w, subRule, PseudoElement_TabBarTab, optRect, opt->direction); + QStyleOptionTabV4 tabCopy(*tab); + tabCopy.rect = subRule.contentsRect(r); + return ParentStyle::subElementRect(se, &tabCopy, w); + } + } return ParentStyle::subElementRect(se, opt, w); } break; |