summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-07 08:34:53 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-07 08:34:53 +0100
commit75391511ff75d6999822cda9f699da585f49ad37 (patch)
tree566dbd70ca624e733025a68612a95aaade463bba /src/widgets/styles
parentfd9b0b86bb5f78ffa855409c4dd5976505ef83f5 (diff)
parent68c30e372b01561e8809fcfa5426ae896da70b8e (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qstyleoption.cpp16
-rw-r--r--src/widgets/styles/qstyleoption.h8
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp11
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;