From 0a0d5e3e916c0ebd69c717843c9cd1b41102b427 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 28 Aug 2009 13:10:05 +0200 Subject: QTabBar: Being able to change the close button appearence in the stylesheet Reviewed-by: jbache Task-number: 241383 --- src/gui/styles/qstylesheetstyle.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 7acb3a6..7538eb4 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -214,6 +214,7 @@ enum PseudoElement { PseudoElement_ViewItemText, PseudoElement_ViewItemIndicator, PseudoElement_ScrollAreaCorner, + PseudoElement_TabBarTabCloseButton, NumPseudoElements }; @@ -223,7 +224,7 @@ struct PseudoElementInfo { }; static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = { - { QStyle::SC_None, "", }, + { QStyle::SC_None, "" }, { QStyle::SC_None, "down-arrow" }, { QStyle::SC_None, "up-arrow" }, { QStyle::SC_None, "left-arrow" }, @@ -300,8 +301,9 @@ static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = { { QStyle::SC_None, "item" }, { QStyle::SC_None, "icon" }, { QStyle::SC_None, "text" }, - { QStyle::SC_None, "indicator" } , - { QStyle::SC_None, "corner" } + { QStyle::SC_None, "indicator" }, + { QStyle::SC_None, "corner" }, + { QStyle::SC_None, "close-button" }, }; @@ -4370,6 +4372,12 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op case PE_IndicatorSpinPlus: pseudoElement = PseudoElement_SpinBoxUpArrow; break; +#ifndef QT_NO_TABBAR + case PE_IndicatorTabClose: + if (w) + w = w->parentWidget(); //match on the QTabBar instead of the CloseButton + pseudoElement = PseudoElement_TabBarTabCloseButton; +#endif default: break; -- cgit v0.12