QStyleSheetStyle Class Reference

#include <qstylesheetstyle_p.h>

Inheritance diagram for QStyleSheetStyle:

Inheritance graph
[legend]
Collaboration diagram for QStyleSheetStyle:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 52 of file qstylesheetstyle_p.h.

Public Member Functions

 QStyleSheetStyle (QStyle *baseStyle)
void drawComplexControl (ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w=0) const
void drawControl (ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
void drawItemPixmap (QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
void drawItemText (QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
void drawPrimitive (PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
QPixmap generatedIconPixmap (QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const
SubControl hitTestComplexControl (ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w=0) const
QRect itemPixmapRect (const QRect &rect, int alignment, const QPixmap &pixmap) const
QRect itemTextRect (const QFontMetrics &metrics, const QRect &rect, int alignment, bool enabled, const QString &text) const
int pixelMetric (PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
void polish (QWidget *widget)
void polish (QApplication *app)
void polish (QPalette &pal)
QSize sizeFromContents (ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget=0) const
QIcon standardIcon (StandardPixmap standardIcon, const QStyleOption *option, const QWidget *w=0) const
QPalette standardPalette () const
QPixmap standardPixmap (StandardPixmap standardPixmap, const QStyleOption *option=0, const QWidget *w=0) const
int styleHint (StyleHint sh, const QStyleOption *opt=0, const QWidget *w=0, QStyleHintReturn *shret=0) const
QRect subElementRect (SubElement r, const QStyleOption *opt, const QWidget *widget=0) const
QRect subControlRect (ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *w=0) const
void setBaseStyle (QStyle *style)
QStylebaseStyle () const
void repolish (QWidget *widget)
void repolish (QApplication *app)
void unpolish (QWidget *widget)
void unpolish (QApplication *app)
void ref ()
void deref ()

Public Attributes

QStylebase

Protected Slots

QIcon standardIconImplementation (StandardPixmap standardIcon, const QStyleOption *opt=0, const QWidget *widget=0) const

Private Types

typedef QWindowsStyle ParentStyle

Private Slots

void widgetDestroyed (QObject *)

Private Member Functions

void setPalette (QWidget *w)
QRenderRule renderRule (const QWidget *, const QString &, QStyle::State=QStyle::State_None) const
QRenderRule renderRule (const QWidget *, int, QStyle::State=QStyle::State_None) const
QRenderRule renderRule (const QWidget *, const QStyleOption *, int=0) const
bool hasStyleRule (const QWidget *, int=0) const

Private Attributes

int refcount


Member Typedef Documentation

typedef QWindowsStyle QStyleSheetStyle::ParentStyle [private]

Definition at line 54 of file qstylesheetstyle_p.h.


Constructor & Destructor Documentation

QStyleSheetStyle::QStyleSheetStyle ( QStyle baseStyle  ) 

Definition at line 1642 of file qstylesheetstyle.cpp.

References initStatics().

01643 : base(base), refcount(1)
01644 {
01645     initStatics();
01646 }

Here is the call graph for this function:


Member Function Documentation

void QStyleSheetStyle::drawComplexControl ( ComplexControl  cc,
const QStyleOptionComplex opt,
QPainter p,
const QWidget w = 0 
) const [virtual]

Reimplemented from QWindowsStyle.

Definition at line 1756 of file qstylesheetstyle.cpp.

References Qt::AlignCenter, QRenderRule::background(), baseStyle(), QRenderRule::boxRect(), QStyle::CC_ComboBox, QStyle::CC_GroupBox, QStyle::CC_SpinBox, QRenderRule::configurePalette(), QStyle::drawComplexControl(), QRenderRule::drawFrame(), drawItemText(), drawPrimitive(), QRenderRule::drawRule(), QRenderRule::hasBackground(), QRenderRule::hasBorder(), QRenderRule::hasBox(), QRenderRule::hasDrawable(), hasStyleRule(), QStyleSheetBackgroundData::isTransparent(), p, QStyle::PE_IndicatorCheckBox, positionRect(), PseudoElement_DropDown, PseudoElement_DropDownArrow, PseudoElement_GroupBoxTitle, PseudoElement_SpinBoxDownArrow, PseudoElement_SpinBoxDownButton, PseudoElement_SpinBoxUpArrow, PseudoElement_SpinBoxUpButton, QStyleOption::rect, renderRule(), QStyle::SC_GroupBoxCheckBox, QStyle::SC_GroupBoxLabel, QPalette::setColor(), QStyle::SH_UnderlineShortcut, QStyle::State_Enabled, styleHint(), subControlRect(), Qt::TextHideMnemonic, QRect::united(), w, QPalette::Window, and QPalette::WindowText.

01758 {
01759     if (!hasStyleRule(w)) {
01760         baseStyle()->drawComplexControl(cc, opt, p, w);
01761         return;
01762     }
01763 
01764     QRenderRule rule = renderRule(w, opt);
01765 
01766     switch (cc) {
01767     case CC_ComboBox:
01768         if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
01769             if (rule.hasBorder() || rule.hasBox() || hasStyleRule(w, PseudoElement_DropDown)) {
01770                 rule.drawFrame(p, opt->rect);
01771                 QRenderRule subRule = renderRule(w, opt, PseudoElement_DropDown);
01772                 QRect r = positionRect(rule, subRule, PseudoElement_DropDown, opt->rect, opt->direction);
01773                 subRule.drawRule(p, r);
01774 
01775                 QRenderRule subRule2 = renderRule(w, opt, PseudoElement_DropDownArrow);
01776                 r = positionRect(subRule, subRule2, PseudoElement_DropDownArrow, r, opt->direction);
01777                 subRule2.drawRule(p, r);
01778             } else {
01779                 baseStyle()->drawComplexControl(cc, cb, p, w);
01780             }
01781             return;
01782         }
01783         break;
01784 
01785     case CC_SpinBox:
01786         if (rule.hasBorder() || rule.hasBox() || hasStyleRule(w, PseudoElement_SpinBoxDownButton)
01787             || hasStyleRule(w, PseudoElement_SpinBoxUpButton)) {
01788             rule.drawFrame(p, opt->rect);
01789 
01790             // down button
01791             QRenderRule subRule1 = renderRule(w, opt, PseudoElement_SpinBoxDownButton);
01792             QRect r = positionRect(rule, subRule1, PseudoElement_SpinBoxDownButton, opt->rect, opt->direction);
01793             subRule1.drawRule(p, r);
01794 
01795             // down arrow
01796             QRenderRule subRule2 = renderRule(w, opt, PseudoElement_SpinBoxDownArrow);
01797             r = positionRect(subRule1, subRule2, PseudoElement_SpinBoxDownArrow, r, opt->direction);
01798             subRule2.drawRule(p, r);
01799 
01800             // up button border
01801             QRenderRule subRule3 = renderRule(w, opt, PseudoElement_SpinBoxUpButton);
01802             r = positionRect(rule, subRule3, PseudoElement_SpinBoxUpButton, opt->rect, opt->direction);
01803             subRule3.drawRule(p, r);
01804 
01805             // up arrow
01806             QRenderRule subRule4 = renderRule(w, opt, PseudoElement_SpinBoxUpArrow);
01807             r = positionRect(subRule3, subRule4, PseudoElement_SpinBoxUpArrow, r, opt->direction);
01808             subRule4.drawRule(p, r);
01809 
01810             return;
01811         }
01812         break;
01813 
01814     case CC_GroupBox:
01815         if (rule.hasDrawable() || rule.hasBox() || hasStyleRule(w, PseudoElement_GroupBoxTitle)) {
01816             if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
01817                 QRect labelRect, checkBoxRect, titleRect;
01818                 bool hasTitle = (gb->subControls & QStyle::SC_GroupBoxCheckBox) || !gb->text.isEmpty();
01819                 QRenderRule titleRule = renderRule(w, opt, PseudoElement_GroupBoxTitle);
01820 
01821                 bool clipSet = false;
01822 
01823                 if (hasTitle) {
01824                     labelRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, w);
01825                     if (gb->subControls & QStyle::SC_GroupBoxCheckBox) {
01826                         checkBoxRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxCheckBox, w);
01827                         titleRect = titleRule.boxRect(checkBoxRect.united(labelRect));
01828                     } else {
01829                         titleRect = titleRule.boxRect(labelRect);
01830                     }
01831                     if (titleRule.hasBackground() && !titleRule.background()->isTransparent()) {
01832                         clipSet = true;
01833                         p->save();
01834                         p->setClipRegion(QRegion(opt->rect) - titleRect);
01835                     }
01836                 }
01837 
01838                 rule.drawRule(p, opt->rect);
01839 
01840                 if (clipSet)
01841                     p->restore();
01842 
01843                 // draw background and frame of the title
01844                 if (hasTitle)
01845                     titleRule.drawRule(p, titleRect);
01846 
01847                 // draw the indicator
01848                 if (gb->subControls & QStyle::SC_GroupBoxCheckBox) {
01849                     QStyleOptionButton box;
01850                     box.QStyleOption::operator=(*gb);
01851                     box.rect = checkBoxRect;
01852                     drawPrimitive(PE_IndicatorCheckBox, &box, p, w);
01853                     drawPrimitive(PE_IndicatorCheckBox, &box, p, w);
01854                 }
01855 
01856                 // draw the text
01857                 if (!gb->text.isEmpty()) {
01858                     int alignment = int(Qt::AlignCenter);
01859                     if (!styleHint(QStyle::SH_UnderlineShortcut, opt, w))
01860                         alignment |= Qt::TextHideMnemonic;
01861 
01862                     QPalette pal = gb->palette;
01863                     pal.setColor(QPalette::WindowText, gb->textColor);
01864                     titleRule.configurePalette(&pal, QPalette::WindowText, QPalette::Window);
01865                     drawItemText(p, labelRect,  alignment, pal, gb->state & State_Enabled,
01866                                  gb->text, QPalette::WindowText);
01867                 }
01868             }
01869             return;
01870         }
01871         break;
01872 
01873     default:
01874         break;
01875     }
01876 
01877     baseStyle()->drawComplexControl(cc, opt, p, w);
01878 }

Here is the call graph for this function:

void QStyleSheetStyle::drawControl ( ControlElement  element,
const QStyleOption opt,
QPainter p,
const QWidget w = 0 
) const [virtual]

Reimplemented from QWindowsStyle.

Definition at line 1880 of file qstylesheetstyle.cpp.

References QRect::adjusted(), Qt::AlignCenter, QStyle::alignedRect(), Qt::AlignLeft, Qt::AlignVCenter, b, QRenderRule::background(), QPalette::Base, baseStyle(), QRenderRule::borderRect(), Qt::BottomLeftCorner, Qt::BottomRightCorner, QStyleSheetBackgroundData::brush, QPalette::Button, QPalette::ButtonText, QStyle::CC_ComboBox, QStyle::CE_CheckBox, QStyle::CE_CheckBoxLabel, QStyle::CE_ComboBoxLabel, QStyle::CE_MenuBarEmptyArea, QStyle::CE_MenuBarItem, QStyle::CE_MenuEmptyArea, QStyle::CE_MenuItem, QStyle::CE_PushButton, QStyle::CE_PushButtonBevel, QStyle::CE_PushButtonLabel, QStyle::CE_RadioButton, QStyle::CE_RadioButtonLabel, QStyle::CE_SizeGrip, QStyle::CE_Splitter, QStyle::CE_ToolBar, QRenderRule::configurePalette(), QRenderRule::contentsRect(), QIcon::Disabled, QRenderRule::drawBackground(), QRenderRule::drawBorder(), QWindowsStyle::drawControl(), QStyle::drawControl(), QCommonStyle::drawControl(), QRenderRule::drawFrame(), QRenderRule::drawImage(), drawItemPixmap(), drawItemText(), QStyle::drawPrimitive(), QRenderRule::drawRule(), QStyleOptionButton::features, QRenderRule::hasBackground(), QRenderRule::hasBorder(), QRenderRule::hasBox(), QRenderRule::hasDrawable(), QRenderRule::hasImage(), QStyleOptionButton::HasMenu, hasStyleRule(), QPixmap::isNull(), QApplication::layoutDirection(), m, QIcon::Normal, p, QStyleOption::palette, QStyle::PE_IndicatorArrowDown, QStyleSheetBackgroundData::pixmap, positionRect(), PseudoElement_Item, PseudoElement_MenuIndicator, QStyleOption::rect, renderRule(), Qt::RightToLeft, QStyle::SC_ComboBoxEditField, QPalette::setBrush(), QRect::setWidth(), QRect::size(), QStyle::State_Enabled, subControlRect(), tb, Qt::TopLeftCorner, Qt::TopRightCorner, QRect::translate(), and w.

01882 {
01883     if (!hasStyleRule(w)) {
01884         baseStyle()->drawControl(ce, opt, p, w);
01885         return;
01886     }
01887 
01888     QRenderRule rule = renderRule(w, opt);
01889 
01890     switch (ce) {
01891     // Push button
01892     case CE_PushButton:
01893         ParentStyle::drawControl(ce, opt, p, w);
01894         return;
01895 
01896     case CE_PushButtonBevel:
01897         if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
01898             QStyleOptionButton btnOpt(*btn);
01899             btnOpt.rect = rule.borderRect(opt->rect);
01900             if (rule.hasBox() || rule.hasDrawable()
01901                 || ((btn->features & QStyleOptionButton::HasMenu) && hasStyleRule(w, PseudoElement_MenuIndicator))) {
01902                 if (rule.hasBox() || rule.hasDrawable()) {
01903                     rule.drawFrame(p, opt->rect);
01904                 } else {
01905                     btnOpt.features &= ~QStyleOptionButton::HasMenu;
01906                     baseStyle()->drawControl(ce, &btnOpt, p, w);
01907                 }
01908 
01909                 if (btn->features & QStyleOptionButton::HasMenu) {
01910                     QRenderRule subRule = renderRule(w, opt, PseudoElement_MenuIndicator);
01911                     QRect ir = positionRect(rule, subRule, PseudoElement_MenuIndicator, opt->rect, opt->direction);
01912                     if (subRule.hasImage()) {
01913                         subRule.drawImage(p, ir);
01914                     } else {
01915                         btnOpt.rect = ir;
01916                         baseStyle()->drawPrimitive(PE_IndicatorArrowDown, &btnOpt, p, w);
01917                     }
01918                 }
01919             } else {
01920                 baseStyle()->drawControl(ce, &btnOpt, p, w);
01921             }
01922         }
01923         return;
01924 
01925     case CE_PushButtonLabel:
01926         if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
01927             QStyleOptionButton butOpt(*btn);
01928             rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button);
01929             ParentStyle::drawControl(ce, &butOpt, p, w);
01930         }
01931         return;
01932 
01933     case CE_RadioButton:
01934     case CE_CheckBox:
01935         rule.drawFrame(p, opt->rect);
01936         ParentStyle::drawControl(ce, opt, p, w);
01937         return;
01938 
01939     case CE_RadioButtonLabel:
01940     case CE_CheckBoxLabel:
01941         if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
01942             QStyleOptionButton butOpt(*btn);
01943             rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button);
01944             ParentStyle::drawControl(ce, &butOpt, p, w);
01945         }
01946         return;
01947 
01948     case CE_Splitter:
01949         if (rule.hasDrawable()) {
01950             rule.drawRule(p, opt->rect);
01951             return;
01952         }
01953         break;
01954 
01955     case CE_ToolBar:
01956         if (rule.hasBackground()) {
01957             rule.drawBackground(p, opt->rect);
01958         }
01959         if (rule.hasBorder()) {
01960             rule.drawBorder(p, rule.borderRect(opt->rect));
01961         } else {
01962 #ifndef QT_NO_TOOLBAR
01963             if (const QStyleOptionToolBar *tb = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
01964                 QStyleOptionToolBar newTb(*tb);
01965                 newTb.rect = rule.borderRect(opt->rect);
01966                 baseStyle()->drawControl(ce, &newTb, p, w);
01967             }
01968 #endif // QT_NO_TOOLBAR
01969         }
01970         return;
01971 
01972     case CE_MenuEmptyArea:
01973     case CE_MenuBarEmptyArea:
01974         if (rule.hasBackground()) {
01975             rule.drawBackground(p, opt->rect);
01976             return;
01977         }
01978         break;
01979 
01980     case CE_MenuBarItem:
01981     case CE_MenuItem:
01982         if (const QStyleOptionMenuItem *m = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
01983             QStyleOptionMenuItem mi(*m);
01984             QRenderRule subRule = renderRule(w, opt, PseudoElement_Item);
01985             mi.rect = subRule.contentsRect(opt->rect);
01986             rule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button);
01987             subRule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button);
01988 
01989             if (rule.hasBackground() || subRule.hasDrawable()) {
01990                 if (rule.hasBackground() && !subRule.hasDrawable()) {
01991                     QBrush b;
01992                     if (!rule.background()->pixmap.isNull())
01993                         mi.palette.setBrush(QPalette::Button, QBrush(rule.background()->pixmap));
01994                     else
01995                         mi.palette.setBrush(QPalette::Button, QBrush(rule.background()->brush));
01996                     ParentStyle::drawControl(ce, &mi, p, w);
01997                 }  else {
01998                     subRule.drawRule(p, opt->rect);   // item
01999                     QCommonStyle::drawControl(ce, &mi, p, w);          // text
02000                 }
02001             } else {
02002                 baseStyle()->drawControl(ce, &mi, p, w);
02003             }
02004         }
02005         return;
02006 
02007 #ifndef QT_NO_COMBOBOX
02008     case CE_ComboBoxLabel:
02009         if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
02010             if (!rule.hasBox() && !rule.hasBorder())
02011                 break;
02012             QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, w);
02013             p->save();
02014             p->setClipRect(editRect);
02015             if (!cb->currentIcon.isNull()) {
02016                 QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
02017                                                              : QIcon::Disabled;
02018                 QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
02019                 QRect iconRect(editRect);
02020                 iconRect.setWidth(cb->iconSize.width() + 4);
02021                 iconRect = alignedRect(QApplication::layoutDirection(),
02022                                        Qt::AlignLeft | Qt::AlignVCenter,
02023                                        iconRect.size(), editRect);
02024                 if (cb->editable)
02025                     p->fillRect(iconRect, opt->palette.brush(QPalette::Base));
02026                 drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap);
02027 
02028                 if (cb->direction == Qt::RightToLeft)
02029                     editRect.translate(-4 - cb->iconSize.width(), 0);
02030                 else
02031                     editRect.translate(cb->iconSize.width() + 4, 0);
02032             }
02033             if (!cb->currentText.isEmpty() && !cb->editable) {
02034                 drawItemText(p, editRect.adjusted(0, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, cb->palette,
02035                              cb->state & State_Enabled, cb->currentText);
02036             }
02037             p->restore();
02038             return;
02039         }
02040         break;
02041 #endif // QT_NO_COMBOBOX
02042 
02043     case CE_SizeGrip:
02044         if (!rule.hasImage())
02045             break;
02046         if (const QStyleOptionSizeGrip *sgOpt = qstyleoption_cast<const QStyleOptionSizeGrip *>(opt)) {
02047             p->save();
02048             switch (sgOpt->corner) {
02049             case Qt::BottomRightCorner: break;
02050             case Qt::BottomLeftCorner: p->rotate(90); break;
02051             case Qt::TopLeftCorner: p->rotate(180); break;
02052             case Qt::TopRightCorner: p->rotate(270); break;
02053             default: break;
02054             }
02055             rule.drawImage(p, opt->rect);
02056             p->restore();
02057             return;
02058         }
02059         break;
02060 
02061     default:
02062         break;
02063     }
02064 
02065     baseStyle()->drawControl(ce, opt, p, w);
02066 }

Here is the call graph for this function:

void QStyleSheetStyle::drawItemPixmap ( QPainter painter,
const QRect rect,
int  alignment,
const QPixmap pixmap 
) const [virtual]

Draws the given pixmap in the specified rectangle, according to the specified alignment, using the provided painter.

See also:
drawItemText()

Reimplemented from QStyle.

Definition at line 2068 of file qstylesheetstyle.cpp.

References baseStyle(), QStyle::drawItemPixmap(), and p.

Referenced by drawControl().

02070 {
02071     baseStyle()->drawItemPixmap(p, rect, alignment, pixmap);
02072 }

Here is the call graph for this function:

void QStyleSheetStyle::drawItemText ( QPainter painter,
const QRect rect,
int  alignment,
const QPalette pal,
bool  enabled,
const QString text,
QPalette::ColorRole  textRole = QPalette::NoRole 
) const [virtual]

Draws the given text in the specified rectangle using the provided painter and palette.

The text is drawn using the painter's pen, and aligned and wrapped according to the specified alignment. If an explicit textRole is specified, the text is drawn using the palette's color for the given role. The enabled parameter indicates whether or not the item is enabled; when reimplementing this function, the enabled parameter should influence how the item is drawn.

See also:
Qt::Alignment, drawItemPixmap()

Reimplemented from QStyle.

Definition at line 2074 of file qstylesheetstyle.cpp.

References baseStyle(), and QStyle::drawItemText().

Referenced by drawComplexControl(), and drawControl().

02076 {
02077     baseStyle()->drawItemText(painter, rect, alignment, pal, enabled, text, textRole);
02078 }

Here is the call graph for this function:

void QStyleSheetStyle::drawPrimitive ( PrimitiveElement  pe,
const QStyleOption opt,
QPainter p,
const QWidget w = 0 
) const [virtual]

Reimplemented from QWindowsStyle.

Definition at line 2080 of file qstylesheetstyle.cpp.

References QPalette::Base, baseStyle(), QRenderRule::borderRect(), QCss::BottomEdge, QRenderRule::box(), QRenderRule::configurePalette(), QRenderRule::drawBackground(), QRenderRule::drawBorder(), QRenderRule::drawFrame(), QStyle::drawPrimitive(), QRenderRule::drawRule(), QRenderRule::hasBorder(), QRenderRule::hasBox(), QRenderRule::hasDrawable(), QRenderRule::hasGradientBackground(), hasStyleRule(), QCss::LeftEdge, m, QStyleSheetBoxData::margins, p, QStyleOption::palette, QStyle::PE_Frame, QStyle::PE_FrameDefaultButton, QStyle::PE_FrameGroupBox, QStyle::PE_FrameMenu, QStyle::PE_FrameStatusBar, QStyle::PE_IndicatorArrowDown, QStyle::PE_IndicatorArrowLeft, QStyle::PE_IndicatorArrowRight, QStyle::PE_IndicatorCheckBox, QStyle::PE_IndicatorMenuCheckMark, QStyle::PE_IndicatorRadioButton, QStyle::PE_IndicatorToolBarHandle, QStyle::PE_PanelButtonCommand, QStyle::PE_PanelLineEdit, QStyle::PE_PanelMenuBar, QStyle::PE_PanelTipLabel, QStyle::PE_Widget, PseudoElement_DownArrow, PseudoElement_Indicator, PseudoElement_Item, PseudoElement_None, QStyleOption::rect, renderRule(), QCss::RightEdge, QPalette::Text, QCss::TopEdge, and w.

Referenced by drawComplexControl().

02082 {
02083     if (pe == PE_FrameStatusBar) {
02084         if (hasStyleRule(w->parentWidget())) {
02085             QRenderRule subRule = renderRule(w->parentWidget(), opt, PseudoElement_Item);
02086             if (subRule.hasDrawable()) {
02087                 subRule.drawRule(p, opt->rect);
02088                 return;
02089             }
02090         }
02091         baseStyle()->drawPrimitive(pe, opt, p, w);
02092         return;
02093     }
02094 
02095     if (!hasStyleRule(w)) {
02096         baseStyle()->drawPrimitive(pe, opt, p, w);
02097         return;
02098     }
02099 
02100     int pseudoElement = PseudoElement_None;
02101 
02102     QRenderRule rule = renderRule(w, opt);
02103 
02104     switch (pe) {
02105     case PE_IndicatorArrowDown:
02106         pseudoElement = PseudoElement_DownArrow;
02107         break;
02108 
02109     case PE_IndicatorRadioButton:
02110     case PE_IndicatorCheckBox:
02111         pseudoElement = PseudoElement_Indicator;
02112         break;
02113 
02114     case PE_PanelButtonCommand:
02115         if (!rule.hasBorder()) {
02116             baseStyle()->drawPrimitive(pe, opt, p, w);
02117         } else {
02118             rule.drawBorder(p, opt->rect);
02119         }
02120         return;
02121 
02122     // how do we specify these in the css?
02123     case PE_FrameDefaultButton:
02124         return;
02125 
02126     case PE_Frame:
02127     case PE_PanelLineEdit:
02128         if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
02129             // Only solid background brush is supported on a LineEdit
02130             if (!rule.hasBorder() && (pe == PE_Frame || !rule.hasGradientBackground())) {
02131                 if (pe == PE_Frame)
02132                     rule.drawBackground(p, opt->rect);
02133                 QStyleOptionFrame frmOpt(*frm);
02134                 rule.configurePalette(&frmOpt.palette, QPalette::Text, QPalette::Base);
02135                 frmOpt.rect = rule.borderRect(frmOpt.rect); // apply margin
02136                 baseStyle()->drawPrimitive(pe, &frmOpt, p, w);
02137             } else {
02138                 rule.drawFrame(p, opt->rect);
02139             }
02140         }
02141         return;
02142 
02143     case PE_Widget:
02144         rule.drawBackground(p, opt->rect);
02145         return;
02146 
02147     case PE_FrameMenu:
02148     case PE_PanelMenuBar:
02149         if (rule.hasBorder()) {
02150             rule.drawBorder(p, rule.borderRect(opt->rect));
02151             return;
02152         }
02153         break;
02154 
02155     case PE_IndicatorToolBarHandle:
02156         if (rule.hasDrawable()) {
02157             rule.drawRule(p, opt->rect);
02158             return;
02159         }
02160         break;
02161 
02162     // Menu stuff that would be nice to customize
02163     case PE_IndicatorMenuCheckMark:
02164     case PE_IndicatorArrowLeft:
02165     case PE_IndicatorArrowRight:
02166         baseStyle()->drawPrimitive(pe, opt, p, w);
02167         return;
02168 
02169     case PE_PanelTipLabel:
02170         if (rule.hasDrawable()) {
02171             rule.drawFrame(p, opt->rect);
02172             return;
02173         }
02174         break;
02175 
02176     case PE_FrameGroupBox:
02177         if (rule.hasBorder()) {
02178             QRect cr = opt->rect;
02179             if (rule.hasBox()) {
02180                 const int *m = rule.box()->margins;
02181                 cr = opt->rect.adjusted(-m[LeftEdge], -m[TopEdge], m[RightEdge], m[BottomEdge]);
02182             }
02183             rule.drawRule(p, cr);
02184             return;
02185         }
02186         break;
02187 
02188     default:
02189         break;
02190     }
02191 
02192     if (pseudoElement != PseudoElement_None) {
02193         QRenderRule subRule = renderRule(w, opt, pseudoElement);
02194         if (subRule.hasDrawable()) {
02195             subRule.drawRule(p, opt->rect);
02196         } else {
02197             baseStyle()->drawPrimitive(pe, opt, p, w);
02198         }
02199     } else {
02200         baseStyle()->drawPrimitive(pe, opt, p, w);
02201     }
02202 }

Here is the call graph for this function:

QPixmap QStyleSheetStyle::generatedIconPixmap ( QIcon::Mode  iconMode,
const QPixmap pixmap,
const QStyleOption option 
) const [virtual]

Reimplemented from QCommonStyle.

Definition at line 2204 of file qstylesheetstyle.cpp.

References baseStyle(), and QStyle::generatedIconPixmap().

02206 {
02207     return baseStyle()->generatedIconPixmap(iconMode, pixmap, option);
02208 }

Here is the call graph for this function:

QStyle::SubControl QStyleSheetStyle::hitTestComplexControl ( ComplexControl  cc,
const QStyleOptionComplex opt,
const QPoint pt,
const QWidget w = 0 
) const [virtual]

Reimplemented from QCommonStyle.

Definition at line 2210 of file qstylesheetstyle.cpp.

References baseStyle(), QStyle::CC_ComboBox, QStyle::CC_GroupBox, QStyle::CC_Slider, QCommonStyle::hitTestComplexControl(), QStyle::hitTestComplexControl(), and w.

02212 {
02213     switch (cc) {
02214     case CC_GroupBox:
02215     case CC_ComboBox:
02216     case CC_Slider:
02217         return ParentStyle::hitTestComplexControl(cc, opt, pt, w);
02218     default:
02219         break;
02220     }
02221 
02222     return baseStyle()->hitTestComplexControl(cc, opt, pt, w);
02223 }

Here is the call graph for this function:

QRect QStyleSheetStyle::itemPixmapRect ( const QRect rect,
int  alignment,
const QPixmap pixmap 
) const [virtual]

Returns the area within the given rectangle in which to draw the specified pixmap according to the defined alignment.

Reimplemented from QStyle.

Definition at line 2225 of file qstylesheetstyle.cpp.

References baseStyle(), and QStyle::itemPixmapRect().

02226 {
02227     return baseStyle()->itemPixmapRect(rect, alignment, pixmap);
02228 }

Here is the call graph for this function:

QRect QStyleSheetStyle::itemTextRect ( const QFontMetrics metrics,
const QRect rect,
int  alignment,
bool  enabled,
const QString text 
) const [virtual]

Returns the area within the given rectangle in which to draw the provided text according to the specified font metrics and alignment. The enabled parameter indicates whether or not the associated item is enabled.

If the given rectangle is larger than the area needed to render the text, the rectangle that is returned will be offset within rectangle according to the specified alignment. For example, if alignment is Qt::AlignCenter, the returned rectangle will be centered within rectangle. If the given rectangle is smaller than the area needed, the returned rectangle will be the smallest rectangle large enough to render the text.

See also:
Qt::Alignment

Reimplemented from QStyle.

Definition at line 2230 of file qstylesheetstyle.cpp.

References baseStyle(), QStyle::itemTextRect(), and metrics().

02232 {
02233     return baseStyle()->itemTextRect(metrics, rect, alignment, enabled, text);
02234 }

Here is the call graph for this function:

int QStyleSheetStyle::pixelMetric ( PixelMetric  metric,
const QStyleOption option = 0,
const QWidget widget = 0 
) const [virtual]

Reimplemented from QWindowsStyle.

Definition at line 2236 of file qstylesheetstyle.cpp.

References baseStyle(), QRenderRule::border(), QStyleSheetBorderData::borders, QRenderRule::box(), QRenderRule::boxSize(), QRenderRule::contentsSize(), QRenderRule::hasBorder(), QRenderRule::hasBox(), QRenderRule::hasContentsSize(), QRenderRule::hasDrawable(), hasStyleRule(), QSize::height(), QCss::LeftEdge, QStyleSheetBoxData::margins, QRenderRule::minimumContentsSize(), QStyleSheetBoxData::paddings, QStyle::pixelMetric(), QStyle::PM_ButtonDefaultIndicator, QStyle::PM_ButtonMargin, QStyle::PM_ButtonShiftHorizontal, QStyle::PM_ButtonShiftVertical, QStyle::PM_CheckBoxLabelSpacing, QStyle::PM_DefaultFrameWidth, QStyle::PM_ExclusiveIndicatorHeight, QStyle::PM_ExclusiveIndicatorWidth, QStyle::PM_IndicatorHeight, QStyle::PM_IndicatorWidth, QStyle::PM_MenuBarHMargin, QStyle::PM_MenuBarItemSpacing, QStyle::PM_MenuBarPanelWidth, QStyle::PM_MenuBarVMargin, QStyle::PM_MenuButtonIndicator, QStyle::PM_MenuDesktopFrameWidth, QStyle::PM_MenuHMargin, QStyle::PM_MenuPanelWidth, QStyle::PM_MenuScrollerHeight, QStyle::PM_MenuTearoffHeight, QStyle::PM_MenuVMargin, QStyle::PM_SmallIconSize, QStyle::PM_SplitterWidth, QStyle::PM_ToolBarExtensionExtent, QStyle::PM_ToolBarFrameWidth, QStyle::PM_ToolBarHandleExtent, QStyle::PM_ToolBarItemMargin, QStyle::PM_ToolBarItemSpacing, QStyle::PM_ToolTipLabelFrameWidth, PseudoElement_GroupBoxTitle, PseudoElement_Indicator, PseudoElement_MenuIndicator, renderRule(), QStyleSheetBoxData::spacing, QCss::TopEdge, w, QSize::width(), and width.

Referenced by sizeFromContents(), and subControlRect().

02237 {
02238     if (!hasStyleRule(w))
02239         return baseStyle()->pixelMetric(m, opt, w);
02240 
02241     QRenderRule rule = renderRule(w, opt);
02242     QRenderRule subRule;
02243 
02244     switch (m) {
02245     case PM_MenuButtonIndicator:
02246         subRule = renderRule(w, opt, PseudoElement_MenuIndicator);
02247         if (subRule.hasContentsSize())
02248             return subRule.contentsSize().width();
02249         break;
02250 
02251     case PM_ButtonShiftHorizontal:
02252     case PM_ButtonShiftVertical:
02253     case PM_ButtonMargin:
02254         // do it with the padding, if you want a shift
02255         if (rule.hasBox() || rule.hasDrawable())
02256             return 0;
02257 
02258     case PM_DefaultFrameWidth:
02259     case PM_ButtonDefaultIndicator:
02260         break;
02261 
02262     case PM_ExclusiveIndicatorWidth:
02263     case PM_IndicatorWidth:
02264     case PM_ExclusiveIndicatorHeight:
02265     case PM_IndicatorHeight:
02266         subRule = renderRule(w, PseudoElement_Indicator);
02267         if (subRule.hasContentsSize()) {
02268             return (m == PM_ExclusiveIndicatorWidth) || (m == PM_IndicatorWidth)
02269                         ? subRule.contentsSize().width()
02270                         : subRule.contentsSize().height();
02271         }
02272         break;
02273 
02274     case PM_ToolTipLabelFrameWidth: // border + margin + padding (support only one width)
02275     case PM_ToolBarFrameWidth:
02276         if (rule.hasBorder() || rule.hasBox())
02277             return (rule.border() ? rule.border()->borders[LeftEdge] : 0)
02278                    + (rule.hasBox() ? rule.box()->margins[LeftEdge] + rule.box()->paddings[LeftEdge]: 0);
02279         break;
02280 
02281     case PM_MenuPanelWidth:  // border + margin + padding (support only one width)
02282     case PM_MenuBarPanelWidth:
02283         if (rule.hasBorder() || rule.hasBox())
02284             return (rule.border() ? rule.border()->borders[LeftEdge] : 0)
02285                    + (rule.hasBox() ? rule.box()->margins[LeftEdge]: 0);
02286         break;
02287 
02288 
02289     case PM_MenuHMargin:
02290     case PM_MenuBarHMargin:
02291         if (rule.hasBox())
02292             return rule.box()->paddings[LeftEdge];
02293         break;
02294 
02295     case PM_ToolBarItemMargin:
02296     case PM_MenuVMargin:
02297     case PM_MenuBarVMargin:
02298         if (rule.hasBox())
02299             return rule.box()->paddings[TopEdge];
02300         break;
02301 
02302     case PM_ToolBarItemSpacing:
02303     case PM_MenuBarItemSpacing:
02304         if (rule.hasBox() && rule.box()->spacing != -1)
02305             return rule.box()->spacing;
02306         break;
02307 
02308     case PM_SmallIconSize:
02309     case PM_MenuDesktopFrameWidth:
02310     case PM_MenuTearoffHeight:
02311     case PM_MenuScrollerHeight:
02312         break;
02313     case PM_ToolBarExtensionExtent:
02314         break;
02315 
02316     case PM_ToolBarHandleExtent:
02317         if (rule.hasBox() || rule.hasBorder() || rule.hasContentsSize())
02318             return rule.boxSize(rule.contentsSize()).expandedTo(rule.minimumContentsSize()).width();
02319 
02320     case PM_SplitterWidth:
02321         if (rule.hasContentsSize())
02322             return rule.contentsSize().width();
02323         break;
02324 
02325     case PM_CheckBoxLabelSpacing: // group box
02326         subRule = renderRule(w, PseudoElement_GroupBoxTitle);
02327         if (subRule.hasBox() && subRule.box()->spacing != -1)
02328             return subRule.box()->spacing;
02329         break;
02330 
02331     default:
02332         break;
02333     }
02334 
02335     return baseStyle()->pixelMetric(m, opt, w);
02336 }

Here is the call graph for this function:

void QStyleSheetStyle::polish ( QWidget widget  )  [virtual]

Reimplemented from QWindowsStyle.

Definition at line 1691 of file qstylesheetstyle.cpp.

References baseStyle(), QObject::connect(), QObject::destroyed(), QVector< T >::isEmpty(), QStyle::polish(), renderRulesCache, setPalette(), SIGNAL, SLOT, styleRules(), styleRulesCache, unsetPalette(), unstylable(), updateWidget(), w, and widgetDestroyed().

01692 {
01693     if (styleRulesCache->contains(w))
01694         return;
01695 
01696     baseStyle()->polish(w);
01697     if (unstylable(w))
01698         return;
01699 
01700     QObject::connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(widgetDestroyed(QObject*)));
01701     renderRulesCache->remove(w);
01702     QVector<QCss::StyleRule> rules = styleRules(w);
01703     styleRulesCache->insert(w, rules);
01704     unsetPalette(w);
01705     if (!rules.isEmpty()) {
01706         setPalette(w);
01707     }
01708     updateWidget(w);
01709 }

Here is the call graph for this function:

void QStyleSheetStyle::polish ( QApplication app  )  [virtual]

Reimplemented from QWindowsStyle.

Definition at line 1711 of file qstylesheetstyle.cpp.

References baseStyle(), QStyle::polish(), renderRulesCache, and styleRulesCache.

01712 {
01713     styleRulesCache->clear();
01714     renderRulesCache->clear();
01715     baseStyle()->polish(app);
01716 }

Here is the call graph for this function:

void QStyleSheetStyle::polish ( QPalette pal  )  [virtual]

Reimplemented from QWindowsStyle.

Definition at line 1718 of file qstylesheetstyle.cpp.

References baseStyle(), and QStyle::polish().

01719 {
01720     baseStyle()->polish(pal);
01721 }

Here is the call graph for this function:

QSize QStyleSheetStyle::sizeFromContents ( ContentsType  ct,
const QStyleOption opt,
const QSize contentsSize,
const QWidget widget = 0 
) const [virtual]

Reimplemented from QWindowsStyle.

Definition at line 2338 of file qstylesheetstyle.cpp.

References baseStyle(), QRenderRule::box(), QRenderRule::boxSize(), QRenderRule::contentsSize(), QStyle::CT_CheckBox, QStyle::CT_ComboBox, QStyle::CT_GroupBox, QStyle::CT_LineEdit, QStyle::CT_Menu, QStyle::CT_MenuBar, QStyle::CT_MenuBarItem, QStyle::CT_MenuItem, QStyle::CT_ProgressBar, QStyle::CT_PushButton, QStyle::CT_RadioButton, QStyle::CT_SizeGrip, QStyle::CT_SpinBox, QStyle::CT_Splitter, QSize::expandedTo(), QRenderRule::hasBorder(), QRenderRule::hasBox(), QRenderRule::hasContentsSize(), QRenderRule::hasDrawable(), QRenderRule::hasGradientBackground(), hasStyleRule(), QRenderRule::minimumContentsSize(), pixelMetric(), QStyle::PM_ExclusiveIndicatorHeight, QStyle::PM_ExclusiveIndicatorWidth, QStyle::PM_IndicatorHeight, QStyle::PM_IndicatorWidth, PseudoElement_GroupBoxIndicator, PseudoElement_GroupBoxTitle, PseudoElement_Indicator, PseudoElement_Item, qMax(), renderRule(), QSize::setHeight(), QStyle::sizeFromContents(), QWindowsStyle::sizeFromContents(), QStyleSheetBoxData::spacing, spacing, and w.

02340 {
02341     if (!hasStyleRule(w)) {
02342 #ifndef QT_NO_SPINBOX
02343         // don't touch the size of a embedded lineedit in a styled spin box
02344         if (ct == CT_LineEdit && w && qobject_cast<QAbstractSpinBox *>(w->parentWidget())
02345             && hasStyleRule(w->parentWidget())) {
02346             QRenderRule rule = renderRule(w->parentWidget(), opt);
02347             if (rule.hasBox() || rule.hasBorder())
02348                 return csz;
02349         }
02350 #endif
02351         return baseStyle()->sizeFromContents(ct, opt, csz, w);
02352     }
02353 
02354     QRenderRule rule = renderRule(w, opt);
02355     QSize sz = csz.expandedTo(rule.minimumContentsSize());
02356 
02357     switch (ct) {
02358     case CT_PushButton:
02359         if (rule.hasBorder() || rule.hasBox())
02360             return rule.boxSize(sz);
02361         break;
02362 
02363     case CT_LineEdit: // does not contains fw
02364         if (rule.hasBorder() || rule.hasGradientBackground()) {
02365             return rule.boxSize(sz);
02366         } else {
02367             // What follows is a really ugly hack to support padding with native frames
02368             QSize baseSize = baseStyle()->sizeFromContents(ct, opt, sz, w);
02369             if (!rule.hasBox())
02370                 return baseSize;
02371             QSize parentSize = ParentStyle::sizeFromContents(ct, opt, sz, w);
02372             if (parentSize != baseSize)
02373                 return baseSize;
02374             return rule.boxSize(baseSize);
02375         }
02376         break;
02377 
02378     case CT_CheckBox:
02379     case CT_RadioButton:
02380         if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
02381             if (rule.hasBox() || rule.hasBorder() || hasStyleRule(w, PseudoElement_Indicator)) {
02382                 bool isRadio = (ct == CT_RadioButton);
02383                 int iw = pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth
02384                                              : PM_IndicatorWidth, btn, w);
02385                 int ih = pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
02386                                              : PM_IndicatorHeight, btn, w);
02387 
02388                 QSize margins(0, 0);
02389                 if (!rule.hasBox() && !rule.hasBorder())
02390                     margins = QSize((!btn->icon.isNull() && btn->text.isEmpty()) ? 0 : 10, 4);
02391                 int spacing = rule.hasBox() ? rule.box()->spacing : -1;
02392                 if (spacing == -1)
02393                     spacing = 6;
02394                 sz = sz + QSize(iw + spacing, 0) + margins;
02395                 sz.setHeight(qMax(sz.height(), ih));
02396                 return rule.boxSize(sz);
02397             }
02398         }
02399         break;
02400 
02401     case CT_GroupBox:
02402         if (rule.hasDrawable() || rule.hasBox() || hasStyleRule(w, PseudoElement_GroupBoxTitle)
02403             || hasStyleRule(w, PseudoElement_GroupBoxIndicator))
02404             return rule.boxSize(sz);
02405         break;
02406 
02407     case CT_Menu:
02408     case CT_MenuBar: // already has everything!
02409         if (rule.hasBox() || rule.hasBorder())
02410             return sz;
02411         break;
02412 
02413     case CT_MenuItem:
02414     case CT_MenuBarItem:
02415         if (hasStyleRule(w, PseudoElement_Item)) {
02416             QRenderRule subRule = renderRule(w, opt, PseudoElement_Item);
02417             if (subRule.hasBox() || subRule.hasBorder())
02418                 return subRule.boxSize(sz);
02419         }
02420         break;
02421 
02422     case CT_ComboBox:
02423         if (rule.hasBox() || rule.hasBorder())
02424             return rule.boxSize(sz);
02425         break;
02426 
02427     case CT_SpinBox:
02428         if (rule.hasBox() || rule.hasBorder())
02429             return sz;
02430 
02431     case CT_SizeGrip:
02432         if (rule.hasContentsSize())
02433             return rule.contentsSize();
02434         break;
02435 
02436     case CT_Splitter:
02437     case CT_ProgressBar:
02438         if (rule.hasBorder() || rule.hasBox())
02439             return rule.boxSize(sz);
02440         break;
02441 
02442     default:
02443         break;
02444     }
02445 
02446     return baseStyle()->sizeFromContents(ct, opt, sz, w);
02447 }

Here is the call graph for this function:

QIcon QStyleSheetStyle::standardIcon ( StandardPixmap  standardIcon,
const QStyleOption option,
const QWidget w = 0 
) const

Since:
4.1
Returns an icon for the given standardIcon.

The standardIcon is a standard pixmap which can follow some existing GUI style or guideline. The option argument can be used to pass extra information required when defining the appropriate icon. The widget argument is optional and can also be used to aid the determination of the icon.

Warning:
Because of binary compatibility constraints, this function is not virtual. If you want to provide your own icons in a QStyle subclass, reimplement the standardIconImplementation() slot in your subclass instead. The standardIcon() function will dynamically detect the slot and call it.
See also:
standardIconImplementation(), standardPixmap()

Reimplemented from QStyle.

Definition at line 2458 of file qstylesheetstyle.cpp.

References baseStyle(), QStyle::standardIcon(), and w.

02460 {
02461     return baseStyle()->standardIcon(standardIcon, option, w);
02462 }

Here is the call graph for this function:

QPalette QStyleSheetStyle::standardPalette (  )  const [virtual]

Returns the style's standard palette.

Note that on systems that support system colors, the style's standard palette is not used.

Reimplemented from QStyle.

Definition at line 2464 of file qstylesheetstyle.cpp.

References baseStyle(), and QStyle::standardPalette().

02465 {
02466     return baseStyle()->standardPalette();
02467 }

Here is the call graph for this function:

QPixmap QStyleSheetStyle::standardPixmap ( StandardPixmap  standardPixmap,
const QStyleOption option = 0,
const QWidget w = 0 
) const [virtual]

Reimplemented from QWindowsStyle.

Definition at line 2469 of file qstylesheetstyle.cpp.

References baseStyle(), QStyle::standardPixmap(), and w.

02471 {
02472     return baseStyle()->standardPixmap(standardPixmap, option, w);
02473 }

Here is the call graph for this function:

int QStyleSheetStyle::styleHint ( StyleHint  sh,
const QStyleOption opt = 0,
const QWidget w = 0,
QStyleHintReturn shret = 0 
) const [virtual]

Reimplemented from QWindowsStyle.

Definition at line 2475 of file qstylesheetstyle.cpp.

References baseStyle(), QStyleSheetPaletteData::foreground, QRenderRule::hasPalette(), QRenderRule::hasStyleHint(), hasStyleRule(), QColor::isValid(), QRenderRule::palette(), renderRule(), QColor::rgba(), s, QStyle::SH_ComboBox_ListMouseTracking, QStyle::SH_ComboBox_Popup, QStyle::SH_DialogButtonLayout, QStyle::SH_DitherDisabledText, QStyle::SH_DrawMenuBarSeparator, QStyle::SH_EtchDisabledText, QStyle::SH_GroupBox_TextLabelColor, QStyle::SH_ItemView_ActivateItemOnSingleClick, QStyle::SH_ItemView_ShowDecorationSelected, QStyle::SH_LineEdit_PasswordCharacter, QStyle::SH_MenuBar_AltKeyNavigation, QStyle::SH_MenuBar_MouseTracking, QStyle::SH_MessageBox_TextInteractionFlags, QStyle::SH_SpinBox_ClickAutoRepeatRate, QStyle::SH_SpinControls_DisableOnBounds, QStyle::SH_Table_GridLineColor, QStyle::SH_ToolTipLabel_Opacity, QStyle::styleHint(), QRenderRule::styleHint(), and w.

Referenced by drawComplexControl().

02477 {
02478     if (!hasStyleRule(w))
02479         return baseStyle()->styleHint(sh, opt, w, shret);
02480 
02481     QRenderRule rule = renderRule(w, opt);
02482     QString s;
02483     switch (sh) {
02484         case SH_LineEdit_PasswordCharacter: s = "lineedit-password-character"; break;
02485         case SH_DitherDisabledText: s = "dither-disabled-text"; break;
02486         case SH_EtchDisabledText: s = "etch-disabled-text"; break;
02487         case SH_ItemView_ActivateItemOnSingleClick: s = "activate-on-singleclick"; break;
02488         case SH_ItemView_ShowDecorationSelected: s = "show-decoration-selected"; break;
02489         case SH_Table_GridLineColor: s = "gridline-color"; break;
02490         case SH_DialogButtonLayout: s = "button-layout"; break;
02491         case SH_ToolTipLabel_Opacity: s = "opacity"; break;
02492         case SH_ComboBox_Popup: s = "combobox-popup"; break;
02493         case SH_ComboBox_ListMouseTracking: s = "combobox-list-mousetracking"; break;
02494         case SH_MenuBar_AltKeyNavigation: s = "menubar-altkey-navigation"; break;
02495         case SH_DrawMenuBarSeparator: s = "menubar-separator"; break;
02496         case SH_MenuBar_MouseTracking: s = "mouse-tracking"; break;
02497         case SH_SpinBox_ClickAutoRepeatRate: s = "spinbox-click-autorepeat-rate"; break;
02498         case SH_SpinControls_DisableOnBounds: s = "spincontrol-disable-on-bounds"; break;
02499         case SH_MessageBox_TextInteractionFlags: s = "messagebox-text-interaction-flags"; break;
02500         case SH_GroupBox_TextLabelColor:
02501             if (rule.hasPalette() && rule.palette()->foreground.isValid())
02502                 return rule.palette()->foreground.rgba();
02503         default: break;
02504     }
02505     if (!s.isEmpty() && rule.hasStyleHint(s)) {
02506         return rule.styleHint(s);
02507     }
02508 
02509     return baseStyle()->styleHint(sh, opt, w, shret);
02510 }

Here is the call graph for this function:

QRect QStyleSheetStyle::subElementRect ( SubElement  r,
const QStyleOption opt,
const QWidget widget = 0 
) const [virtual]

Reimplemented from QWindowsStyle.

Definition at line 2614 of file qstylesheetstyle.cpp.

References baseStyle(), QRenderRule::box(), QRenderRule::contentsRect(), QStyleOption::direction, QRenderRule::hasBorder(), QRenderRule::hasBox(), QRenderRule::hasGradientBackground(), hasStyleRule(), QRect::height(), QRect::left(), positionRect(), PseudoElement_Indicator, QStyleOption::rect, renderRule(), QStyle::SE_CheckBoxClickRect, QStyle::SE_CheckBoxContents, QStyle::SE_CheckBoxFocusRect, QStyle::SE_CheckBoxIndicator, QStyle::SE_FrameContents, QStyle::SE_LineEditContents, QStyle::SE_PushButtonContents, QStyle::SE_PushButtonFocusRect, QStyle::SE_RadioButtonClickRect, QStyle::SE_RadioButtonContents, QStyle::SE_RadioButtonFocusRect, QStyle::SE_RadioButtonIndicator, QRect::setRect(), QStyleSheetBoxData::spacing, spacing, QStyle::subElementRect(), QWindowsStyle::subElementRect(), QStyle::visualRect(), w, QRect::width(), and QRect::y().

02615 {
02616     if (!hasStyleRule(w))
02617         return baseStyle()->subElementRect(se, opt, w);
02618 
02619     QRenderRule rule = renderRule(w, opt);
02620     QRenderRule subRule;
02621 
02622     switch (se) {
02623     // PushButton
02624     case SE_PushButtonContents:
02625     case SE_PushButtonFocusRect:
02626         if (rule.hasBorder() || rule.hasBox())
02627             return visualRect(opt->direction, opt->rect, rule.contentsRect(opt->rect));
02628         break;
02629 
02630     case SE_LineEditContents:
02631     case SE_FrameContents:
02632         if (rule.hasBorder() || (se != SE_FrameContents && rule.hasGradientBackground())) {
02633             return visualRect(opt->direction, opt->rect, rule.contentsRect(opt->rect));
02634         } else {
02635             // ugly hack to support native frames with padding
02636             QRect baseRect = baseStyle()->subElementRect(se, opt, w);
02637             if (!rule.hasBox())
02638                 return baseRect;
02639             QRect parentRect = ParentStyle::subElementRect(se, opt, w);
02640             if (baseRect != parentRect)
02641                 return baseRect;
02642             return visualRect(opt->direction, opt->rect, rule.contentsRect(baseRect));
02643         }
02644         break;
02645 
02646     case SE_CheckBoxIndicator:
02647     case SE_RadioButtonIndicator:
02648         if (rule.hasBox() || rule.hasBorder() || hasStyleRule(w, PseudoElement_Indicator)) {
02649             QRenderRule subRule = renderRule(w, opt, PseudoElement_Indicator);
02650             return positionRect(rule, subRule, PseudoElement_Indicator, opt->rect, opt->direction);
02651         }
02652         break;
02653 
02654     case SE_CheckBoxContents:
02655     case SE_RadioButtonContents:
02656         if (rule.hasBox() || rule.hasBorder() || hasStyleRule(w, PseudoElement_Indicator)) {
02657             bool isRadio = se == SE_RadioButtonContents;
02658             QRect ir = subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator,
02659                                       opt, w);
02660             ir = visualRect(opt->direction, opt->rect, ir);
02661             int spacing = rule.hasBox() ? rule.box()->spacing : -1;
02662             if (spacing == -1)
02663                 spacing = 6;
02664             QRect cr = rule.contentsRect(opt->rect);
02665             ir.setRect(ir.left() + ir.width() + spacing, cr.y(),
02666                        cr.width() - ir.width() - spacing, cr.height());
02667             return visualRect(opt->direction, opt->rect, ir);
02668         }
02669         break;
02670 
02671     case SE_RadioButtonFocusRect:
02672     case SE_RadioButtonClickRect: // focusrect | indicator
02673     case SE_CheckBoxFocusRect:
02674     case SE_CheckBoxClickRect: // relies on indicator and contents
02675         return ParentStyle::subElementRect(se, opt, w);
02676 
02677     default:
02678         break;
02679     }
02680 
02681     return baseStyle()->subElementRect(se, opt, w);
02682 }

Here is the call graph for this function:

QRect QStyleSheetStyle::subControlRect ( ComplexControl  cc,
const QStyleOptionComplex opt,
SubControl  sc,
const QWidget w = 0 
) const [virtual]

Reimplemented from QCommonStyle.

Definition at line 2512 of file qstylesheetstyle.cpp.

References baseStyle(), QRenderRule::borderRect(), QStyle::CC_ComboBox, QStyle::CC_GroupBox, QStyle::CC_SpinBox, QRect::center(), QRenderRule::contentsRect(), QStyleOption::direction, QRenderRule::geo, QRenderRule::hasBorder(), QRenderRule::hasBox(), QRenderRule::hasDrawable(), QRenderRule::hasGeometry(), hasStyleRule(), QRect::left(), pixelMetric(), QStyle::PM_CheckBoxLabelSpacing, QStyle::PM_IndicatorHeight, QStyle::PM_IndicatorWidth, positionRect(), PseudoElement_DropDown, PseudoElement_GroupBoxIndicator, PseudoElement_GroupBoxTitle, PseudoElement_SpinBoxDownButton, PseudoElement_SpinBoxUpButton, qMax(), QStyleOption::rect, renderRule(), QStyle::SC_ComboBoxArrow, QStyle::SC_ComboBoxEditField, QStyle::SC_ComboBoxFrame, QStyle::SC_ComboBoxListBoxPopup, QStyle::SC_GroupBoxCheckBox, QStyle::SC_GroupBoxContents, QStyle::SC_GroupBoxFrame, QStyle::SC_GroupBoxLabel, QStyle::SC_SpinBoxDown, QStyle::SC_SpinBoxEditField, QStyle::SC_SpinBoxFrame, QStyle::SC_SpinBoxUp, QRect::setLeft(), QRect::setTop(), spacing, QStyle::subControlRect(), w, and QPoint::y().

Referenced by drawComplexControl(), and drawControl().

02514 {
02515     if (!hasStyleRule(w))
02516         return baseStyle()->subControlRect(cc, opt, sc, w);
02517 
02518     QRenderRule rule = renderRule(w, opt);
02519     switch (cc) {
02520     case CC_ComboBox:
02521         if (rule.hasBorder() || rule.hasBox() || hasStyleRule(w, PseudoElement_DropDown)) {
02522             switch (sc) {
02523             case SC_ComboBoxArrow: {
02524                 QRenderRule subRule = renderRule(w, PseudoElement_DropDown);
02525                 return positionRect(rule, subRule, PseudoElement_DropDown, opt->rect, opt->direction);
02526                 break;
02527                                    }
02528             case SC_ComboBoxEditField:
02529                 return rule.contentsRect(opt->rect);
02530             case SC_ComboBoxFrame:
02531                 return rule.contentsRect(opt->rect);
02532             case SC_ComboBoxListBoxPopup:
02533             default:
02534                return opt->rect;
02535             }
02536         }
02537         break;
02538 
02539     case CC_SpinBox:
02540         if (rule.hasBorder() || rule.hasBox() || hasStyleRule(w, PseudoElement_SpinBoxUpButton)
02541             || hasStyleRule(w, PseudoElement_SpinBoxDownButton)) {
02542             switch (sc) {
02543             case SC_SpinBoxUp:
02544             case SC_SpinBoxDown: {
02545                 int pe = (sc == SC_SpinBoxUp ? PseudoElement_SpinBoxUpButton : PseudoElement_SpinBoxDownButton);
02546                 QRenderRule subRule = renderRule(w, opt, pe);
02547                 return positionRect(rule, subRule, pe, opt->rect, opt->direction);
02548             }
02549             case SC_SpinBoxEditField:
02550             case SC_SpinBoxFrame:
02551                 return rule.contentsRect(opt->rect);
02552             default:
02553                 return opt->rect;
02554             }
02555         }
02556         break;
02557 
02558     case CC_GroupBox:
02559         if (rule.hasDrawable() || rule.hasBox() || hasStyleRule(w, PseudoElement_GroupBoxTitle)
02560             || hasStyleRule(w, PseudoElement_GroupBoxIndicator)) {
02561             if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
02562                 switch (sc) {
02563                 case SC_GroupBoxFrame:
02564                     return rule.borderRect(opt->rect);
02565                 case SC_GroupBoxContents:
02566                     return rule.contentsRect(opt->rect);
02567                 default:
02568                 case SC_GroupBoxLabel:
02569                 case SC_GroupBoxCheckBox: {
02570                     QRenderRule labelRule = renderRule(w, opt, PseudoElement_GroupBoxTitle);
02571                     int tw = opt->fontMetrics.width(gb->text);
02572                     int th = opt->fontMetrics.height();
02573                     int spacing = pixelMetric(QStyle::PM_CheckBoxLabelSpacing, opt, w);
02574                     int iw = pixelMetric(QStyle::PM_IndicatorWidth, opt, w);
02575                     int ih = pixelMetric(QStyle::PM_IndicatorHeight, opt, w);
02576 
02577                     if (gb->subControls & QStyle::SC_GroupBoxCheckBox) {
02578                         tw = tw + iw + spacing;
02579                         th = qMax(th, ih);
02580                     }
02581                     if (!labelRule.hasGeometry()) {
02582                         labelRule.geo = new QStyleSheetGeometryData(tw, th, tw, th);
02583                     } else {
02584                         labelRule.geo->width = tw;
02585                         labelRule.geo->height = th;
02586                     }
02587                     QRect r = positionRect(rule, labelRule, PseudoElement_GroupBoxTitle,
02588                                           opt->rect, opt->direction);
02589                     if (gb->subControls & SC_GroupBoxCheckBox) {
02590                         r = labelRule.contentsRect(r);
02591                         if (sc == SC_GroupBoxLabel) {
02592                             r.setLeft(r.left() + iw + spacing);
02593                             r.setTop(r.center().y() - th/2);
02594                         } else {
02595                             r = QRect(r.left(), r.center().y() - ih/2, iw, ih);
02596                         }
02597                         return r;
02598                     } else {
02599                         return labelRule.contentsRect(r);
02600                     }
02601                 }
02602                 }
02603             }
02604         }
02605         break;
02606 
02607     default:
02608         break;
02609     }
02610 
02611     return baseStyle()->subControlRect(cc, opt, sc, w);
02612 }

Here is the call graph for this function:

void QStyleSheetStyle::setBaseStyle ( QStyle style  )  [inline]

Definition at line 93 of file qstylesheetstyle_p.h.

References base.

00093 { base = style; }

QStyle * QStyleSheetStyle::baseStyle (  )  const

Definition at line 1648 of file qstylesheetstyle.cpp.

References base, and qApp.

Referenced by drawComplexControl(), drawControl(), drawItemPixmap(), drawItemText(), drawPrimitive(), generatedIconPixmap(), hitTestComplexControl(), itemPixmapRect(), itemTextRect(), pixelMetric(), polish(), renderRule(), sizeFromContents(), standardIcon(), standardPalette(), standardPixmap(), styleHint(), subControlRect(), subElementRect(), and unpolish().

01649 {
01650     if (base)
01651         return base;
01652     if (QStyleSheetStyle *me = qobject_cast<QStyleSheetStyle *>(qApp->style()))
01653         return me->base;
01654     return qApp->style();
01655 }

void QStyleSheetStyle::repolish ( QWidget widget  ) 

Definition at line 1723 of file qstylesheetstyle.cpp.

References QList< T >::append(), QObject::children(), styleSheetCache, updateWidgets(), and w.

Referenced by QWidgetPrivate::inheritStyle(), QApplication::setStyleSheet(), and QWidget::setStyleSheet().

01724 {
01725     QList<const QWidget *> children = qFindChildren<const QWidget *>(w, QString());
01726     children.append(w);
01727     styleSheetCache->remove(w);
01728     updateWidgets(children);
01729 }

Here is the call graph for this function:

void QStyleSheetStyle::repolish ( QApplication app  ) 

Definition at line 1731 of file qstylesheetstyle.cpp.

References styleRulesCache, styleSheetCache, and updateWidgets().

01732 {
01733     styleSheetCache->remove(0);
01734     updateWidgets(styleRulesCache->keys());
01735 }

Here is the call graph for this function:

void QStyleSheetStyle::unpolish ( QWidget widget  )  [virtual]

Reimplemented from QWindowsStyle.

Definition at line 1737 of file qstylesheetstyle.cpp.

References baseStyle(), QObject::destroyed(), QObject::disconnect(), renderRulesCache, SIGNAL, SLOT, styleRulesCache, styleSheetCache, QStyle::unpolish(), unsetPalette(), w, and widgetDestroyed().

01738 {
01739     styleRulesCache->remove(w);
01740     renderRulesCache->remove(w);
01741     styleSheetCache->remove(w);
01742     baseStyle()->unpolish(w);
01743     unsetPalette(w);
01744     QObject::disconnect(w, SIGNAL(destroyed(QObject*)),
01745                        this, SLOT(widgetDestroyed(QObject*)));
01746 }

Here is the call graph for this function:

void QStyleSheetStyle::unpolish ( QApplication app  )  [virtual]

Reimplemented from QWindowsStyle.

Definition at line 1748 of file qstylesheetstyle.cpp.

References baseStyle(), renderRulesCache, styleRulesCache, styleSheetCache, and QStyle::unpolish().

01749 {
01750     styleRulesCache->clear();
01751     renderRulesCache->clear();
01752     styleSheetCache->remove(0);
01753     baseStyle()->unpolish(app);
01754 }

Here is the call graph for this function:

void QStyleSheetStyle::ref (  )  [inline]

Definition at line 102 of file qstylesheetstyle_p.h.

References refcount.

00102 { ++refcount; }

void QStyleSheetStyle::deref (  )  [inline]

Definition at line 103 of file qstylesheetstyle_p.h.

References refcount.

00103 { Q_ASSERT(refcount > 0); if (!--refcount) delete this; }

QIcon QStyleSheetStyle::standardIconImplementation ( StandardPixmap  standardIcon,
const QStyleOption opt = 0,
const QWidget widget = 0 
) const [protected, slot]

Since:
4.1
Returns an icon for the given standardIcon.

Reimplement this slot to provide your own icons in a QStyle subclass; because of binary compatibility constraints, the standardIcon() function (introduced in Qt 4.1) is not virtual. Instead, standardIcon() will dynamically detect and call this slot. The default implementation simply calls the standardPixmap() function with the given parameters.

The standardIcon is a standard pixmap which can follow some existing GUI style or guideline. The option argument can be used to pass extra information required when defining the appropriate icon. The widget argument is optional and can also be used to aid the determination of the icon.

See also:
standardIcon()

Reimplemented from QWindowsStyle.

Definition at line 2452 of file qstylesheetstyle.cpp.

References QCommonStyle::standardIconImplementation().

02454 {
02455     return QCommonStyle::standardIconImplementation(standardIcon, opt, widget);
02456 }

void QStyleSheetStyle::widgetDestroyed ( QObject  )  [private, slot]

Definition at line 1657 of file qstylesheetstyle.cpp.

References customPaletteWidgets, o, renderRulesCache, and styleRulesCache.

Referenced by polish(), and unpolish().

01658 {
01659     styleRulesCache->remove((const QWidget *)o);
01660     renderRulesCache->remove((const QWidget *)o);
01661     customPaletteWidgets->remove((const QWidget *)o);
01662 }

void QStyleSheetStyle::setPalette ( QWidget w  )  [private]

Definition at line 1558 of file qstylesheetstyle.cpp.

References QPalette::Active, customFontWidgets, customPaletteWidgets, QPalette::Disabled, embeddedWidget(), QRenderRule::hasDrawable(), i, QPalette::Inactive, p, PseudoElement_Item, PseudoElement_None, renderRule(), QStyle::State_Enabled, QStyle::State_MouseOver, QStyle::State_None, w, and Qt::WA_Hover.

Referenced by polish().

01559 {
01560     const QRenderRule &hoverRule = renderRule(w, PseudoElement_None, QStyle::State_MouseOver);
01561     if (hoverRule.hasDrawable())
01562         w->setAttribute(Qt::WA_Hover);
01563 
01564     // put stuff for which palette is not set here
01565 #ifndef QT_NO_MENUBAR
01566     if (qobject_cast<QMenuBar *>(w)) {
01567         // MenuBar has autoFillBackground set which does not play well with our stuff
01568         const QRenderRule& subRule = renderRule(w, PseudoElement_Item, QStyle::State_MouseOver);
01569         if (subRule.hasDrawable())
01570             w->setAttribute(Qt::WA_Hover);
01571         return;
01572     }
01573 #endif
01574 
01575     struct RuleRoleMap {
01576         QStyle::StateFlag state;
01577         QPalette::ColorGroup group;
01578     } map[3] = {
01579         { QStyle::State_Enabled, QPalette::Active },
01580         { QStyle::State_None, QPalette::Disabled },
01581         { QStyle::State_Enabled, QPalette::Inactive }
01582     };
01583 
01584     QPalette p = w->palette();
01585     QWidget *ew = embeddedWidget(w);
01586 
01587     for (int i = 0; i < 3; i++) {
01588         QRenderRule rule = renderRule(w, PseudoElement_None, map[i].state);
01589         if (i == 0) {
01590             customFontWidgets->insert(w, rule.font.resolve() & ~w->font().resolve());
01591             w->setFont(rule.font);
01592         }
01593 
01594         rule.configurePalette(&p, map[i].group, ew, ew != w);
01595     }
01596 
01597     if (w->palette() != p) {
01598         customPaletteWidgets->insert(w, p.resolve() & ~w->palette().resolve());
01599         w->setPalette(p);
01600     }
01601 }

Here is the call graph for this function:

QRenderRule QStyleSheetStyle::renderRule ( const QWidget ,
const QString ,
QStyle::State  = QStyle::State_None 
) const [private]

Definition at line 1312 of file qstylesheetstyle.cpp.

References QVector< T >::at(), baseStyle(), Qt::CaseInsensitive, QString::compare(), QHash< Key, T >::contains(), i, QCss::PseudoState_Disabled, QCss::PseudoState_Enabled, QCss::PseudoState_Focus, QCss::PseudoState_Hover, QCss::PseudoState_Indeterminate, QCss::PseudoState_Off, QCss::PseudoState_On, QCss::PseudoState_Pressed, QCss::PseudoState_Unspecified, QStyle::State_Enabled, QStyle::State_HasFocus, QStyle::State_MouseOver, QStyle::State_NoChange, QStyle::State_Off, QStyle::State_On, QStyle::State_Selected, QStyle::State_Sunken, styleRules(), styleRulesCache, and w.

Referenced by drawComplexControl(), drawControl(), drawPrimitive(), pixelMetric(), renderRule(), setPalette(), sizeFromContents(), styleHint(), subControlRect(), and subElementRect().

01313 {
01314     Q_ASSERT(w);
01315     Q_ASSERT(styleRulesCache->contains(w)); // style sheet rules must have been computed!
01316     const QVector<StyleRule> styleRules = styleRulesCache->value(w);
01317     QHash<int, QRenderRule> &renderRules = (*renderRulesCache)[w][part];
01318 
01319     int pseudoState = (state & QStyle::State_Enabled)
01320                                  ? PseudoState_Enabled : PseudoState_Disabled;
01321     if (state & QStyle::State_Sunken)
01322         pseudoState |= PseudoState_Pressed;
01323     if (state & QStyle::State_MouseOver || state & QStyle::State_Selected)
01324         pseudoState |= PseudoState_Hover;
01325     if (state & QStyle::State_HasFocus)
01326         pseudoState |= PseudoState_Focus;
01327     if (state & QStyle::State_On)
01328         pseudoState |= PseudoState_On;
01329     if (state & QStyle::State_Off)
01330         pseudoState |= PseudoState_Off;
01331     if (state & QStyle::State_NoChange)
01332         pseudoState |= PseudoState_Indeterminate;
01333 
01334     if (renderRules.contains(pseudoState))
01335         return renderRules[pseudoState]; // already computed before
01336 
01337     QVector<Declaration> declarations;
01338     for (int i = 0; i < styleRules.count(); i++) {
01339         const Selector& selector = styleRules.at(i).selectors.at(0);
01340         // Rules with pseudo elements don't cascade. This is an intentional
01341         // diversion for CSS
01342         if (part.compare(selector.pseudoElement(), Qt::CaseInsensitive) != 0)
01343             continue;
01344         const int cssState = selector.pseudoState();
01345         if ((cssState == PseudoState_Unspecified) || ((cssState & pseudoState) == cssState))
01346             declarations += styleRules.at(i).declarations;
01347     }
01348 
01349     QRenderRule newRule(declarations, w, part, baseStyle());
01350     renderRules[pseudoState] = newRule;
01351     return newRule;
01352 }

Here is the call graph for this function:

QRenderRule QStyleSheetStyle::renderRule ( const QWidget ,
int  ,
QStyle::State  = QStyle::State_None 
) const [private]

Definition at line 1355 of file qstylesheetstyle.cpp.

References knownPseudoElements, name, renderRule(), and w.

01356 {
01357     return renderRule(w, knownPseudoElements[pseudoElement].name, state);
01358 }

Here is the call graph for this function:

QRenderRule QStyleSheetStyle::renderRule ( const QWidget ,
const QStyleOption ,
int  = 0 
) const [private]

Definition at line 1360 of file qstylesheetstyle.cpp.

References knownPseudoElements, name, PseudoElement_DropDown, PseudoElement_DropDownArrow, PseudoElement_GroupBoxTitle, PseudoElement_None, PseudoElement_SpinBoxDownArrow, PseudoElement_SpinBoxDownButton, PseudoElement_SpinBoxUpArrow, PseudoElement_SpinBoxUpButton, renderRule(), QStyle::SC_ComboBoxEditField, QStyleOption::state, QStyle::State_Enabled, QStyle::State_MouseOver, QStyle::State_None, QStyle::State_Off, QStyle::State_On, QStyle::State_Sunken, QAbstractSpinBox::StepDownEnabled, QAbstractSpinBox::StepUpEnabled, styleRulesCache, PseudoElementInfo::subControl, and w.

01361 {
01362     Q_ASSERT(w && !styleRulesCache->value(w).isEmpty());
01363     QStyle::State state = opt ? opt->state : QStyle::State(QStyle::State_None);
01364 
01365     if (const QStyleOptionComplex *complex = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {
01366         if (pseudoElement != PseudoElement_None) {
01367             // if not an active subcontrol, just pass enabled/disabled
01368             QStyle::SubControl subControl = knownPseudoElements[pseudoElement].subControl;
01369 
01370             if (!(complex->activeSubControls & subControl))
01371                 state = QStyle::State(opt->state & QStyle::State_Enabled);
01372         }
01373 
01374         switch (pseudoElement) {
01375         case PseudoElement_DropDown:
01376         case PseudoElement_DropDownArrow:
01377             state |= (opt->state & QStyle::State_On); // propagate popup state as on/off
01378             break;
01379         case PseudoElement_SpinBoxUpButton:
01380         case PseudoElement_SpinBoxDownButton:
01381         case PseudoElement_SpinBoxUpArrow:
01382         case PseudoElement_SpinBoxDownArrow:
01383 #ifndef QT_NO_SPINBOX
01384             if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
01385                 bool on = false;
01386                 bool up = pseudoElement == PseudoElement_SpinBoxUpButton
01387                           || pseudoElement == PseudoElement_SpinBoxUpArrow;
01388                 if ((sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) && up)
01389                     on = true;
01390                 else if ((sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) && !up)
01391                     on = true;
01392                 state |= (on ? QStyle::State_On : QStyle::State_Off);
01393             }
01394 #endif // QT_NO_SPINBOX
01395             break;
01396         case PseudoElement_GroupBoxTitle:
01397             state |= (opt->state & (QStyle::State_MouseOver | QStyle::State_Sunken));
01398             break;
01399         case PseudoElement_None:
01400         default:
01401             // QStyle::State_On is set when the popup is being shown
01402             // Propagate EditField Pressed state
01403             if ((complex->activeSubControls & QStyle::SC_ComboBoxEditField)
01404                 && (!(opt->state & QStyle::State_MouseOver)))
01405                 state = opt->state | QStyle::State_Sunken;
01406         }
01407     } else {
01408         // Add hacks for simple controls here
01409 #ifndef QT_NO_LINEEDIT
01410         // LineEdit sets Sunken flag to indicate Sunken frame (argh)
01411         if (qobject_cast<const QLineEdit *>(w)) {
01412             state &= ~QStyle::State_Sunken;
01413         } else
01414 #endif
01415 #ifndef QT_NO_MENUBAR
01416         if (qobject_cast<const QMenuBar *>(w)) {
01417             if (state & QStyle::State_Sunken) {
01418                 state &= ~QStyle::State_Sunken;
01419                 state |= QStyle::State_On;
01420             }
01421         } else
01422 #endif
01423         { } // required for the above ifdef'ery
01424     }
01425 
01426     return renderRule(w, knownPseudoElements[pseudoElement].name, state);
01427 }

Here is the call graph for this function:

bool QStyleSheetStyle::hasStyleRule ( const QWidget ,
int  = 0 
) const [private]

Definition at line 1429 of file qstylesheetstyle.cpp.

References QVector< T >::at(), Qt::CaseInsensitive, QString::compare(), QVector< T >::count(), i, QVector< T >::isEmpty(), knownPseudoElements, PseudoElementInfo::name, PseudoElement_None, QCss::StyleRule::selectors, styleRules(), styleRulesCache, and w.

Referenced by drawComplexControl(), drawControl(), drawPrimitive(), pixelMetric(), sizeFromContents(), styleHint(), subControlRect(), and subElementRect().

01430 {
01431     const QVector<StyleRule> &styleRules = styleRulesCache->value(w);
01432     if (part == PseudoElement_None)
01433         return w && !styleRules.isEmpty();
01434 
01435     // ### cache the result
01436     QString pseudoElement = knownPseudoElements[part].name;
01437     QVector<Declaration> declarations;
01438     for (int i = 0; i < styleRules.count(); i++) {
01439         const Selector& selector = styleRules.at(i).selectors.at(0);
01440         if (pseudoElement.compare(selector.pseudoElement(), Qt::CaseInsensitive) == 0)
01441             return true;
01442     }
01443 
01444     return false;
01445 }

Here is the call graph for this function:


Member Data Documentation

QStyle* QStyleSheetStyle::base

Definition at line 101 of file qstylesheetstyle_p.h.

Referenced by baseStyle(), QWidgetPrivate::inheritStyle(), and QApplication::setStyleSheet().

int QStyleSheetStyle::refcount [private]

Definition at line 118 of file qstylesheetstyle_p.h.


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 19:12:10 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1