diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-15 09:57:36 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-15 09:57:36 (GMT) |
commit | 336dfcef05cb63df0a6d550b59a4badc7a0f01c1 (patch) | |
tree | a218ec97413e0c8ebc9600ac5db9b2adea485b32 /src/gui/styles | |
parent | e44d64510e019e5d3b379b704cfb824e0d7ccc9d (diff) | |
download | Qt-336dfcef05cb63df0a6d550b59a4badc7a0f01c1.zip Qt-336dfcef05cb63df0a6d550b59a4badc7a0f01c1.tar.gz Qt-336dfcef05cb63df0a6d550b59a4badc7a0f01c1.tar.bz2 |
Merge of master
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qcleanlooksstyle.cpp | 148 | ||||
-rw-r--r-- | src/gui/styles/qcommonstyle.cpp | 536 | ||||
-rw-r--r-- | src/gui/styles/qgtkstyle.cpp | 118 | ||||
-rw-r--r-- | src/gui/styles/qmacstyle_mac.mm | 92 | ||||
-rw-r--r-- | src/gui/styles/qmotifstyle.cpp | 156 | ||||
-rw-r--r-- | src/gui/styles/qplastiquestyle.cpp | 102 | ||||
-rw-r--r-- | src/gui/styles/qproxystyle.cpp | 366 | ||||
-rw-r--r-- | src/gui/styles/qproxystyle.h | 114 | ||||
-rw-r--r-- | src/gui/styles/qproxystyle_p.h | 79 | ||||
-rw-r--r-- | src/gui/styles/qstyle.cpp | 34 | ||||
-rw-r--r-- | src/gui/styles/qstyle.h | 5 | ||||
-rw-r--r-- | src/gui/styles/qstyle_p.h | 14 | ||||
-rw-r--r-- | src/gui/styles/qwindowsstyle.cpp | 94 | ||||
-rw-r--r-- | src/gui/styles/qwindowsvistastyle.cpp | 76 | ||||
-rw-r--r-- | src/gui/styles/qwindowsxpstyle.cpp | 144 | ||||
-rw-r--r-- | src/gui/styles/styles.pri | 4 |
16 files changed, 1344 insertions, 738 deletions
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index aff0af3..ac433b4 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -763,7 +763,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, QStyleOptionButton button; button.QStyleOption::operator=(*option); button.state &= ~State_MouseOver; - drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget); + proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget); } return; case PE_IndicatorHeaderArrow: @@ -783,7 +783,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, } break; case PE_IndicatorButtonDropDown: - drawPrimitive(PE_PanelButtonCommand, option, painter, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); break; case PE_IndicatorToolBarSeparator: { @@ -868,9 +868,9 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, if (widget && widget->inherits("QDockWidgetTitleButton")) { if (option->state & State_MouseOver) - drawPrimitive(PE_PanelButtonCommand, option, painter, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); } else { - drawPrimitive(PE_PanelButtonCommand, option, painter, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); } } painter->restore(); @@ -883,7 +883,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, dockWidgetHandle.state &= ~State_Horizontal; else dockWidgetHandle.state |= State_Horizontal; - drawControl(CE_Splitter, &dockWidgetHandle, painter, widget); + proxy()->drawControl(CE_Splitter, &dockWidgetHandle, painter, widget); } break; case PE_FrameWindow: @@ -909,7 +909,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, #endif // QT_NO_LINEEDIT #ifdef QT3_SUPPORT if (widget && widget->inherits("Q3ToolBar")) { - drawPrimitive(PE_Q3Separator, option, painter, widget); + proxy()->drawPrimitive(PE_Q3Separator, option, painter, widget); break; } #endif @@ -1238,7 +1238,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, QColor alphaCornerColor = mergedColors(borderColor, option->palette.background().color()); QColor innerShadow = mergedColors(borderColor, option->palette.base().color()); - int borderThickness = pixelMetric(PM_TabBarBaseOverlap, twf, widget); + int borderThickness = proxy()->pixelMetric(PM_TabBarBaseOverlap, twf, widget); bool reverse = (twf->direction == Qt::RightToLeft); QRect tabBarRect; @@ -1351,9 +1351,9 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, if (d->tabBarcloseButtonIcon.isNull()) d->tabBarcloseButtonIcon = standardIcon(SP_DialogCloseButton, option, widget); if ((option->state & State_Enabled) && (option->state & State_MouseOver)) - drawPrimitive(PE_PanelButtonCommand, option, painter, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(QSize(16, 16), QIcon::Normal, QIcon::On); - drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap); + proxy()->drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap); } break; @@ -1630,7 +1630,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o QString titleText = painter->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, titleRect.width()); - drawItemText(painter, + proxy()->drawItemText(painter, titleRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette, dwOpt->state & State_Enabled, titleText, @@ -1844,7 +1844,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; if (!styleHint(SH_UnderlineShortcut, mbi, widget)) alignment |= Qt::TextHideMnemonic; - drawItemText(painter, item.rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole); + proxy()->drawItemText(painter, item.rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole); } } @@ -1871,7 +1871,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o int w = 0; if (!menuItem->text.isEmpty()) { painter->setFont(menuItem->font); - drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter, + proxy()->drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter, menuItem->palette, menuItem->state & State_Enabled, menuItem->text, QPalette::Text); w = menuItem->fontMetrics.width(menuItem->text) + 5; @@ -1975,7 +1975,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o mode = QIcon::Active; QPixmap pixmap; - int smallIconSize = pixelMetric(PM_SmallIconSize, option, widget); + int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget); QSize iconSize(smallIconSize, smallIconSize); #ifndef QT_NO_COMBOBOX if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget)) @@ -2001,7 +2001,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o } opt.state |= State_Sunken; opt.rect = vCheckRect; - drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget); } painter->drawPixmap(pmr.topLeft(), pixmap); } @@ -2034,7 +2034,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o if (t >= 0) { QRect vShortcutRect = visualRect(opt->direction, menuitem->rect, QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom()))); - if (dis && !act && styleHint(SH_EtchDisabledText, option, widget)) { + if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) { p->setPen(menuitem->palette.light().color()); p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, s.mid(t + 1)); p->setPen(discol); @@ -2048,7 +2048,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o font.setBold(true); p->setFont(font); - if (dis && !act && styleHint(SH_EtchDisabledText, option, widget)) { + if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) { p->setPen(menuitem->palette.light().color()); p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, s.left(t)); p->setPen(discol); @@ -2071,7 +2071,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o if (selected) newMI.palette.setColor(QPalette::ButtonText, newMI.palette.highlightedText().color()); - drawPrimitive(arrow, &newMI, painter, widget); + proxy()->drawPrimitive(arrow, &newMI, painter, widget); } } painter->restore(); @@ -2132,7 +2132,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o if (button->features & QStyleOptionButton::HasMenu) ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0); - drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled), + proxy()->drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled), button->text, QPalette::ButtonText); } break; @@ -2187,7 +2187,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o || (rtlHorTabs && tab->selectedPosition == QStyleOptionTab::PreviousIsSelected)); - int tabBarAlignment = styleHint(SH_TabBar_Alignment, tab, widget); + int tabBarAlignment = proxy()->styleHint(SH_TabBar_Alignment, tab, widget); bool leftAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignLeft) || (rtlHorTabs && tabBarAlignment == Qt::AlignRight); @@ -2200,7 +2200,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o QColor midlight = tab->palette.midlight().color(); QColor background = tab->palette.background().color(); - int borderThinkness = pixelMetric(PM_TabBarBaseOverlap, tab, widget); + int borderThinkness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget); if (selected) borderThinkness /= 2; QRect r2(option->rect); @@ -2453,10 +2453,10 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp QRect rect = pixmapRect; QStyleOptionSpinBox spinBoxCopy = *spinBox; spinBoxCopy.rect = pixmapRect; - QRect upRect = subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxUp, widget); - QRect downRect = subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxDown, widget); + QRect upRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxUp, widget); + QRect downRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxDown, widget); - int fw = spinBoxCopy.frame ? pixelMetric(PM_SpinBoxFrameWidth, &spinBoxCopy, widget) : 0; + int fw = spinBoxCopy.frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, &spinBoxCopy, widget) : 0; cachePainter.fillRect(rect.adjusted(1, qMax(fw - 1, 0), -1, -fw), option->palette.base()); @@ -2678,7 +2678,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp if (widget && widget->inherits("Q3DockWindowTitleBar")) { QStyleOptionDockWidgetV2 dockwidget; dockwidget.QStyleOption::operator=(*option); - drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget); + proxy()->drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget); } else #endif // QT3_SUPPORT { @@ -2721,7 +2721,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp painter->drawLine(fullRect.left() + 6, fullRect.top() + 1, fullRect.right() - 6, fullRect.top() + 1); } // draw title - QRect textRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget); + QRect textRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget); QFont font = painter->font(); font.setBold(true); painter->setFont(font); @@ -2736,7 +2736,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp // min button if ((titleBar->subControls & SC_TitleBarMinButton) && (titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) && !(titleBar->titleBarState& Qt::WindowMinimized)) { - QRect minButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget); + QRect minButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget); if (minButtonRect.isValid()) { bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken); @@ -2757,7 +2757,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp // max button if ((titleBar->subControls & SC_TitleBarMaxButton) && (titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) && !(titleBar->titleBarState & Qt::WindowMaximized)) { - QRect maxButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget); + QRect maxButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget); if (maxButtonRect.isValid()) { bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken); @@ -2779,7 +2779,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp // close button if ((titleBar->subControls & SC_TitleBarCloseButton) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) { - QRect closeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget); + QRect closeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget); if (closeButtonRect.isValid()) { bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken); @@ -2813,7 +2813,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp (titleBar->titleBarState & Qt::WindowMinimized)) || ((titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) && (titleBar->titleBarState & Qt::WindowMaximized)))) { - QRect normalButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget); + QRect normalButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget); if (normalButtonRect.isValid()) { bool hover = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver); @@ -2853,7 +2853,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp // context help button if (titleBar->subControls & SC_TitleBarContextHelpButton && (titleBar->titleBarFlags & Qt::WindowContextHelpButtonHint)) { - QRect contextHelpButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget); + QRect contextHelpButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget); if (contextHelpButtonRect.isValid()) { bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken); @@ -2872,7 +2872,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp // shade button if (titleBar->subControls & SC_TitleBarShadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) { - QRect shadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget); + QRect shadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget); if (shadeButtonRect.isValid()) { bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken); @@ -2885,7 +2885,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp // unshade button if (titleBar->subControls & SC_TitleBarUnshadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) { - QRect unshadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget); + QRect unshadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget); if (unshadeButtonRect.isValid()) { bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken); @@ -2897,7 +2897,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp } if ((titleBar->subControls & SC_TitleBarSysMenu) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) { - QRect iconRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget); + QRect iconRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget); if (iconRect.isValid()) { if (!titleBar->icon.isNull()) { titleBar->icon.paint(painter, iconRect); @@ -2907,7 +2907,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp QPixmap pm = standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(16, 16); tool.rect = iconRect; painter->save(); - drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm); + proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm); painter->restore(); } } @@ -2927,10 +2927,10 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp painter->fillRect(option->rect, option->palette.background()); QRect rect = scrollBar->rect; - QRect scrollBarSubLine = subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget); - QRect scrollBarAddLine = subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget); - QRect scrollBarSlider = subControlRect(control, scrollBar, SC_ScrollBarSlider, widget); - QRect grooveRect = subControlRect(control, scrollBar, SC_ScrollBarGroove, widget); + QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget); + QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget); + QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget); + QRect grooveRect = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget); // paint groove if (scrollBar->subControls & SC_ScrollBarGroove) { @@ -3065,7 +3065,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp // The SubLine (up/left) buttons if (scrollBar->subControls & SC_ScrollBarSubLine) { - //int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, option, widget); + //int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, option, widget); QRect pixmapRect = scrollBarSubLine; if (isEnabled ) { QRect fillRect = pixmapRect.adjusted(1, 1, -1, -1); @@ -3111,7 +3111,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp arrow = PE_IndicatorArrowUp; QStyleOption arrowOpt = *option; arrowOpt.rect = scrollBarSubLine.adjusted(3, 3, -2, -2); - drawPrimitive(arrow, &arrowOpt, painter, widget); + proxy()->drawPrimitive(arrow, &arrowOpt, painter, widget); // The AddLine (down/right) button @@ -3162,7 +3162,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp QStyleOption arrowOpt = *option; arrowOpt.rect = scrollBarAddLine.adjusted(3, 3, -2, -2); - drawPrimitive(arrow, &arrowOpt, painter, widget); + proxy()->drawPrimitive(arrow, &arrowOpt, painter, widget); } } } @@ -3194,9 +3194,9 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp comboBoxCopy.rect = pixmapRect; QRect rect = pixmapRect; - QRect downArrowRect = subControlRect(CC_ComboBox, &comboBoxCopy, + QRect downArrowRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxArrow, widget); - QRect editRect = subControlRect(CC_ComboBox, &comboBoxCopy, + QRect editRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxEditField, widget); // Draw a push button if (comboBox->editable) { @@ -3210,7 +3210,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp buttonOption.state &= ~State_MouseOver; } - drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget); //remove shadow from left side of edit field when pressed: if (comboBox->direction != Qt::RightToLeft) @@ -3252,7 +3252,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp buttonOption.state |= State_Sunken; buttonOption.state &= ~State_MouseOver; } - drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget); cachePainter.setPen(buttonShadow.darker(102)); int borderSize = 4; @@ -3308,9 +3308,9 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp if (focus && !comboBox->editable && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) { QStyleOptionFocusRect focus; - focus.rect = subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxEditField, widget) + focus.rect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxEditField, widget) .adjusted(0, 2, option->direction == Qt::RightToLeft ? 1 : -1, -2); - drawPrimitive(PE_FrameFocusRect, &focus, &cachePainter, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &focus, &cachePainter, widget); } cachePainter.end(); QPixmapCache::insert(pixmapName, cache); @@ -3324,8 +3324,8 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp case CC_GroupBox: painter->save(); if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { - QRect textRect = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget); - QRect checkBoxRect = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget); + QRect textRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget); + QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget); bool flat = groupBox->features & QStyleOptionFrameV2::Flat; if(!flat) { @@ -3335,7 +3335,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp frame.features = groupBox->features; frame.lineWidth = groupBox->lineWidth; frame.midLineWidth = groupBox->midLineWidth; - frame.rect = subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget); + frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget); painter->save(); QRegion region(groupBox->rect); @@ -3344,7 +3344,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp if (!groupBox->text.isEmpty() || groupBox->subControls & SC_GroupBoxCheckBox) painter->setClipRegion(region); frame.palette.setBrush(QPalette::Dark, option->palette.mid().color().lighter(110)); - drawPrimitive(PE_FrameGroupBox, &frame, painter); + proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter); painter->restore(); } } @@ -3372,7 +3372,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp QStyleOptionButton box; box.QStyleOption::operator=(*groupBox); box.rect = checkBoxRect; - drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); + proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); } } painter->restore(); @@ -3381,9 +3381,9 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp #ifndef QT_NO_SLIDER case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - QRect groove = subControlRect(CC_Slider, option, SC_SliderGroove, widget); - QRect handle = subControlRect(CC_Slider, option, SC_SliderHandle, widget); - QRect ticks = subControlRect(CC_Slider, option, SC_SliderTickmarks, widget); + QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); + QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); + QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget); bool horizontal = slider->orientation == Qt::Horizontal; bool ticksAbove = slider->tickPosition & QSlider::TicksAbove; @@ -3569,13 +3569,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*slider); fropt.rect = slider->rect; - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } } if (option->subControls & SC_SliderTickmarks) { painter->setPen(darkOutline); - int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget); - int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget); + int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); + int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget); int interval = slider->tickInterval; if (interval <= 0) { interval = slider->singleStep; @@ -3589,7 +3589,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp interval = 1; int v = slider->minimum; - int len = pixelMetric(PM_SliderLength, slider, widget); + int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); while (v <= slider->maximum + 1) { if (v == slider->maximum + 1 && interval == 1) break; @@ -3770,8 +3770,8 @@ QSize QCleanlooksStyle::sizeFromContents(ContentsType type, const QStyleOption * QFontMetrics metrics(font); int baseWidth = metrics.width(gb->title()) + metrics.width(QLatin1Char(' ')); if (gb->isCheckable()) { - baseWidth += pixelMetric(QStyle::PM_IndicatorWidth, option, widget); - baseWidth += pixelMetric(QStyle::PM_CheckBoxLabelSpacing, option, widget); + baseWidth += proxy()->pixelMetric(QStyle::PM_IndicatorWidth, option, widget); + baseWidth += proxy()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, option, widget); } newSize.setWidth(qMax(baseWidth, newSize.width())); } @@ -3955,7 +3955,7 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio #ifndef QT_NO_SLIDER case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget); + int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); switch (subControl) { case SC_SliderHandle: { if (slider->orientation == Qt::Horizontal) { @@ -4010,7 +4010,7 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { QSize bs; int center = spinbox->rect.height() / 2; - int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; + int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; int y = fw; bs.setHeight(qMax(8, spinbox->rect.height()/2 - y)); bs.setWidth(15); @@ -4051,7 +4051,7 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { int topMargin = 0; int topHeight = 0; - int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget); + int verticalAlignment = proxy()->styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget); bool flat = groupBox->features & QStyleOptionFrameV2::Flat; if (!groupBox->text.isEmpty()) { topHeight = groupBox->fontMetrics.height(); @@ -4082,8 +4082,8 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio QSize textRect = fontMetrics.boundingRect(groupBoxWidget->title()).size() + QSize(2, 2); if (subControl == SC_GroupBoxCheckBox) { - int indicatorWidth = pixelMetric(PM_IndicatorWidth, option, widget); - int indicatorHeight = pixelMetric(PM_IndicatorHeight, option, widget); + int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget); + int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget); rect.setWidth(indicatorWidth); rect.setHeight(indicatorHeight); rect.moveTop((fontMetrics.height() - indicatorHeight) / 2 + 2); @@ -4104,7 +4104,7 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio rect = visualRect(option->direction, option->rect, rect); break; case SC_ComboBoxEditField: { - int frameWidth = pixelMetric(PM_DefaultFrameWidth); + int frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth); rect = visualRect(option->direction, option->rect, rect); rect.setRect(option->rect.left() + frameWidth, option->rect.top() + frameWidth, option->rect.width() - 19 - 2 * frameWidth, @@ -4427,8 +4427,8 @@ QIcon QCleanlooksStyle::standardIconImplementation(StandardPixmap standardIcon, d->lookupIconTheme(); switch (standardIcon) { case SP_DirIcon: { - icon = QIcon(standardPixmap(standardIcon, option, widget)); - icon.addPixmap(standardPixmap(SP_DirClosedIcon, option, widget), + icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget)); + icon.addPixmap(proxy()->standardPixmap(SP_DirClosedIcon, option, widget), QIcon::Normal, QIcon::Off); pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory.png")); if (!pixmap.isNull()) @@ -4446,10 +4446,10 @@ QIcon QCleanlooksStyle::standardIconImplementation(StandardPixmap standardIcon, break; case SP_DirLinkIcon: { - icon = QIcon(standardPixmap(standardIcon, option, widget)); + icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget)); QPixmap link = d->findIcon(12, QLatin1String("emblem-symbolic-link.png")); if (!link.isNull()) { - icon.addPixmap(standardPixmap(SP_DirLinkIcon, option, widget)); + icon.addPixmap(proxy()->standardPixmap(SP_DirLinkIcon, option, widget)); pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory.png")); if (!pixmap.isNull()) { QPainter painter(&pixmap); @@ -4546,10 +4546,10 @@ QIcon QCleanlooksStyle::standardIconImplementation(StandardPixmap standardIcon, } case SP_FileLinkIcon: { - icon = QIcon(standardPixmap(standardIcon, option, widget)); + icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget)); QPixmap link = d->findIcon(12, QLatin1String("emblem-symbolic-link.png")); if (!link.isNull()) { - icon.addPixmap(standardPixmap(SP_FileLinkIcon,option, widget)); + icon.addPixmap(proxy()->standardPixmap(SP_FileLinkIcon,option, widget)); pixmap = d->findIcon(16, QLatin1String("unknown.png")); if (pixmap.isNull()) pixmap = d->findIcon(16, QLatin1String("stock_new.png")); @@ -4571,7 +4571,7 @@ QIcon QCleanlooksStyle::standardIconImplementation(StandardPixmap standardIcon, return standardIconImplementation(SP_ArrowRight, option, widget); return standardIconImplementation(SP_ArrowLeft, option, widget); default: - icon = QIcon(standardPixmap(standardIcon, option, widget)); + icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget)); } if (!icon.isNull()) return icon; diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 74eacf6..7d8436e 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -155,7 +155,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q &opt->palette.brush(QPalette::Button)); break; case PE_IndicatorViewItemCheck: - drawPrimitive(PE_IndicatorCheckBox, opt, p, widget); + proxy()->drawPrimitive(PE_IndicatorCheckBox, opt, p, widget); break; case PE_IndicatorCheckBox: if (opt->state & State_NoChange) { @@ -505,7 +505,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q QIcon::Active, QIcon::Off); } - int size = pixelMetric(QStyle::PM_SmallIconSize); + int size = proxy()->pixelMetric(QStyle::PM_SmallIconSize); QIcon::Mode mode = opt->state & State_Enabled ? (opt->state & State_Raised ? QIcon::Active : QIcon::Normal) : QIcon::Disabled; @@ -516,7 +516,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q QIcon::State state = opt->state & State_Sunken ? QIcon::On : QIcon::Off; QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(size, mode, state); - drawItemPixmap(p, opt->rect, Qt::AlignCenter, pixmap); + proxy()->drawItemPixmap(p, opt->rect, Qt::AlignCenter, pixmap); break; } #endif // QT_NO_TABBAR @@ -525,7 +525,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q qDrawWinPanel(p, opt->rect, opt->palette, false, 0); break; case PE_FrameLineEdit: - drawPrimitive(PE_Frame, opt, p, widget); + proxy()->drawPrimitive(PE_Frame, opt, p, widget); break; #ifndef QT_NO_GROUPBOX case PE_FrameGroupBox: @@ -550,7 +550,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) { int lw = frame->lineWidth; if (lw <= 0) - lw = pixelMetric(PM_DockWidgetFrameWidth); + lw = proxy()->pixelMetric(PM_DockWidgetFrameWidth); qDrawShadePanel(p, frame->rect, frame->palette, false, lw); } @@ -582,7 +582,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q p->restore(); break; case PE_Q3DockWindowSeparator: - drawPrimitive(PE_IndicatorToolBarSeparator, opt, p, widget); + proxy()->drawPrimitive(PE_IndicatorToolBarSeparator, opt, p, widget); break; case PE_IndicatorToolBarSeparator: { @@ -602,7 +602,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q case PE_IndicatorSpinPlus: case PE_IndicatorSpinMinus: { QRect r = opt->rect; - int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget); + int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); QRect br = r.adjusted(fw, fw, -fw, -fw); int offset = (opt->state & State_Sunken) ? 1 : 0; @@ -619,7 +619,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q case PE_IndicatorSpinUp: case PE_IndicatorSpinDown: { QRect r = opt->rect; - int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget); + int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); // QRect br = r.adjusted(fw, fw, -fw, -fw); int x = r.x(), y = r.y(), w = r.width(), h = r.height(); int sw = w-4; @@ -644,8 +644,8 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q int bsx = 0; int bsy = 0; if (opt->state & State_Sunken) { - bsx = pixelMetric(PM_ButtonShiftHorizontal); - bsy = pixelMetric(PM_ButtonShiftVertical); + bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); + bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); } p->save(); p->translate(sx + bsx, sy + bsy); @@ -694,7 +694,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q panel->palette.brush(QPalette::Base)); if (panel->lineWidth > 0) - drawPrimitive(PE_FrameLineEdit, panel, p, widget); + proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget); } break; #endif // QT_NO_LINEEDIT @@ -766,7 +766,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active)) cg = QPalette::Inactive; - if ((vopt->state & QStyle::State_Selected) && styleHint(QStyle::SH_ItemView_ShowDecorationSelected, opt, widget)) + if ((vopt->state & QStyle::State_Selected) && proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, opt, widget)) p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Highlight)); else if (vopt->features & QStyleOptionViewItemV2::Alternate) p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase)); @@ -849,7 +849,7 @@ void QCommonStylePrivate::lookupIconTheme() const dataDirs = QLatin1String("/usr/local/share/:/usr/share/"); dataDirs += QLatin1Char(':') + QApplicationPrivate::kdeHome() + QLatin1String("/share"); dataDirs.prepend(QDir::homePath() + QLatin1String("/:")); - QStringList kdeDirs = QString::fromLocal8Bit(getenv("KDEDIRS")).split(QLatin1Char(':')); + QStringList kdeDirs = QString::fromLocal8Bit(getenv("KDEDIRS")).split(QLatin1Char(':'), QString::SkipEmptyParts); foreach (const QString &dirName, kdeDirs) dataDirs.append(QLatin1Char(':') + dirName + QLatin1String("/share")); iconDirs = dataDirs.split(QLatin1Char(':')); @@ -1291,24 +1291,24 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, case CE_PushButton: if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { - drawControl(CE_PushButtonBevel, btn, p, widget); + proxy()->drawControl(CE_PushButtonBevel, btn, p, widget); QStyleOptionButton subopt = *btn; subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); - drawControl(CE_PushButtonLabel, &subopt, p, widget); + proxy()->drawControl(CE_PushButtonLabel, &subopt, p, widget); if (btn->state & State_HasFocus) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*btn); fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); } } break; case CE_PushButtonBevel: if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { QRect br = btn->rect; - int dbi = pixelMetric(PM_ButtonDefaultIndicator, btn, widget); + int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); if (btn->features & QStyleOptionButton::DefaultButton) - drawPrimitive(PE_FrameDefaultButton, opt, p, widget); + proxy()->drawPrimitive(PE_FrameDefaultButton, opt, p, widget); if (btn->features & QStyleOptionButton::AutoDefaultButton) br.setCoords(br.left() + dbi, br.top() + dbi, br.right() - dbi, br.bottom() - dbi); if (!(btn->features & (QStyleOptionButton::Flat | QStyleOptionButton::CommandLinkButton)) @@ -1316,14 +1316,14 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, || (btn->features & QStyleOptionButton::CommandLinkButton && btn->state & State_MouseOver)) { QStyleOptionButton tmpBtn = *btn; tmpBtn.rect = br; - drawPrimitive(PE_PanelButtonCommand, &tmpBtn, p, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, p, widget); } if (btn->features & QStyleOptionButton::HasMenu) { - int mbi = pixelMetric(PM_MenuButtonIndicator, btn, widget); + int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, btn, widget); QRect ir = btn->rect; QStyleOptionButton newBtn = *btn; newBtn.rect = QRect(ir.right() - mbi + 2, ir.height()/2 - mbi/2 + 3, mbi - 6, mbi - 6); - drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); } } break; @@ -1331,7 +1331,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(opt)) { QRect textRect = button->rect; uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic; - if (!styleHint(SH_UnderlineShortcut, button, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, button, widget)) tf |= Qt::TextHideMnemonic; if (!button->icon.isNull()) { @@ -1366,24 +1366,24 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, textRect.setLeft(iconRect.left() + iconRect.width() + iconSpacing); if (button->state & (State_On | State_Sunken)) - iconRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, widget), - pixelMetric(PM_ButtonShiftVertical, opt, widget)); + iconRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget), + proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget)); p->drawPixmap(iconRect, pixmap); } else { tf |= Qt::AlignHCenter; } if (button->state & (State_On | State_Sunken)) - textRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, widget), - pixelMetric(PM_ButtonShiftVertical, opt, widget)); + textRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget), + proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget)); if (button->features & QStyleOptionButton::HasMenu) { - int indicatorSize = pixelMetric(PM_MenuButtonIndicator, button, widget); + int indicatorSize = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget); if (button->direction == Qt::LeftToRight) textRect = textRect.adjusted(0, 0, -indicatorSize, 0); else textRect = textRect.adjusted(indicatorSize, 0, 0, 0); } - drawItemText(p, textRect, tf, button->palette, (button->state & State_Enabled), + proxy()->drawItemText(p, textRect, tf, button->palette, (button->state & State_Enabled), button->text, QPalette::ButtonText); } break; @@ -1394,17 +1394,17 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, QStyleOptionButton subopt = *btn; subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator, btn, widget); - drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, + proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, &subopt, p, widget); subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents : SE_CheckBoxContents, btn, widget); - drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget); + proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget); if (btn->state & State_HasFocus) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*btn); fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect : SE_CheckBoxFocusRect, btn, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); } } break; @@ -1413,20 +1413,20 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { uint alignment = visualAlignment(btn->direction, Qt::AlignLeft | Qt::AlignVCenter); - if (!styleHint(SH_UnderlineShortcut, btn, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, btn, widget)) alignment |= Qt::TextHideMnemonic; QPixmap pix; QRect textRect = btn->rect; if (!btn->icon.isNull()) { pix = btn->icon.pixmap(btn->iconSize, btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled); - drawItemPixmap(p, btn->rect, alignment, pix); + proxy()->drawItemPixmap(p, btn->rect, alignment, pix); if (btn->direction == Qt::RightToLeft) textRect.setRight(textRect.right() - btn->iconSize.width() - 4); else textRect.setLeft(textRect.left() + btn->iconSize.width() + 4); } if (!btn->text.isEmpty()){ - drawItemText(p, textRect, alignment | Qt::TextShowMnemonic, + proxy()->drawItemText(p, textRect, alignment | Qt::TextShowMnemonic, btn->palette, btn->state & State_Enabled, btn->text, QPalette::WindowText); } } @@ -1436,7 +1436,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, p->fillRect(opt->rect, opt->palette.background()); QStyleOption arrowOpt = *opt; arrowOpt.state |= State_Enabled; - drawPrimitive(((opt->state & State_DownArrow) ? PE_IndicatorArrowDown : PE_IndicatorArrowUp), + proxy()->drawPrimitive(((opt->state & State_DownArrow) ? PE_IndicatorArrowDown : PE_IndicatorArrowUp), &arrowOpt, p, widget); break; } case CE_MenuTearoff: @@ -1458,13 +1458,13 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; - if (!styleHint(SH_UnderlineShortcut, mbi, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget)) alignment |= Qt::TextHideMnemonic; - QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize), (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); + QPixmap pix = mbi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); if (!pix.isNull()) - drawItemPixmap(p,mbi->rect, alignment, pix); + proxy()->drawItemPixmap(p,mbi->rect, alignment, pix); else - drawItemText(p, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled, + proxy()->drawItemText(p, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, QPalette::ButtonText); } break; @@ -1479,12 +1479,12 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) { QStyleOptionProgressBarV2 subopt = *pb; subopt.rect = subElementRect(SE_ProgressBarGroove, pb, widget); - drawControl(CE_ProgressBarGroove, &subopt, p, widget); + proxy()->drawControl(CE_ProgressBarGroove, &subopt, p, widget); subopt.rect = subElementRect(SE_ProgressBarContents, pb, widget); - drawControl(CE_ProgressBarContents, &subopt, p, widget); + proxy()->drawControl(CE_ProgressBarContents, &subopt, p, widget); if (pb->textVisible) { subopt.rect = subElementRect(SE_ProgressBarLabel, pb, widget); - drawControl(CE_ProgressBarLabel, &subopt, p, widget); + proxy()->drawControl(CE_ProgressBarLabel, &subopt, p, widget); } } break; @@ -1510,10 +1510,10 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, ? QColor(255,255,255,160) : QColor(0,0,0,160); QPalette shadowPalette = pb->palette; shadowPalette.setColor(textRole, shadowColor); - drawItemText(p, shadowRect, Qt::AlignCenter | Qt::TextSingleLine, shadowPalette, + proxy()->drawItemText(p, shadowRect, Qt::AlignCenter | Qt::TextSingleLine, shadowPalette, pb->state & State_Enabled, pb->text, textRole); } - drawItemText(p, pb->rect, Qt::AlignCenter | Qt::TextSingleLine, pb->palette, + proxy()->drawItemText(p, pb->rect, Qt::AlignCenter | Qt::TextSingleLine, pb->palette, pb->state & State_Enabled, pb->text, textRole); } } @@ -1560,7 +1560,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, p->setPen(QPen(pal2.highlight().color(), 4)); p->drawLine(x, rect.y(), x, rect.height()); } else { - const int unit_width = pixelMetric(PM_ProgressBarChunkWidth, pb, widget); + const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, pb, widget); if (!unit_width) return; @@ -1602,7 +1602,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, for (int i = 0; i < nu; ++i) { pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight); pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect(); - drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget); + proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget); x += reverse ? -unit_width : unit_width; } @@ -1613,7 +1613,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, int offset = reverse ? x0 + x + unit_width-pixels_left : x0 + x; pbBits.rect.setRect(offset, myY, pixels_left, myHeight); pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect(); - drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget); + proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget); } } } @@ -1624,7 +1624,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, QRect rect = header->rect; if (!header->icon.isNull()) { QPixmap pixmap - = header->icon.pixmap(pixelMetric(PM_SmallIconSize), (header->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); + = header->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), (header->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); int pixw = pixmap.width(); QRect aligned = alignedRect(header->direction, QFlag(header->iconAlignment), pixmap.size(), rect); @@ -1641,7 +1641,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, fnt.setBold(true); p->setFont(fnt); } - drawItemText(p, rect, header->textAlignment, header->palette, + proxy()->drawItemText(p, rect, header->textAlignment, header->palette, (header->state & State_Enabled), header->text, QPalette::ButtonText); } break; @@ -1653,19 +1653,19 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, int shiftX = 0; int shiftY = 0; if (toolbutton->state & (State_Sunken | State_On)) { - shiftX = pixelMetric(PM_ButtonShiftHorizontal, toolbutton, widget); - shiftY = pixelMetric(PM_ButtonShiftVertical, toolbutton, widget); + shiftX = proxy()->pixelMetric(PM_ButtonShiftHorizontal, toolbutton, widget); + shiftY = proxy()->pixelMetric(PM_ButtonShiftVertical, toolbutton, widget); } // Arrow type always overrules and is always shown bool hasArrow = toolbutton->features & QStyleOptionToolButton::Arrow; if (((!hasArrow && toolbutton->icon.isNull()) && !toolbutton->text.isEmpty()) || toolbutton->toolButtonStyle == Qt::ToolButtonTextOnly) { int alignment = Qt::AlignCenter | Qt::TextShowMnemonic; - if (!styleHint(SH_UnderlineShortcut, opt, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget)) alignment |= Qt::TextHideMnemonic; rect.translate(shiftX, shiftY); p->setFont(toolbutton->font); - drawItemText(p, rect, alignment, toolbutton->palette, + proxy()->drawItemText(p, rect, alignment, toolbutton->palette, opt->state & State_Enabled, toolbutton->text, QPalette::ButtonText); } else { @@ -1690,7 +1690,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, QRect pr = rect, tr = rect; int alignment = Qt::TextShowMnemonic; - if (!styleHint(SH_UnderlineShortcut, opt, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget)) alignment |= Qt::TextHideMnemonic; if (toolbutton->toolButtonStyle == Qt::ToolButtonTextUnderIcon) { @@ -1698,7 +1698,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, tr.adjust(0, pr.height() - 1, 0, -3); pr.translate(shiftX, shiftY); if (!hasArrow) { - drawItemPixmap(p, pr, Qt::AlignCenter, pm); + proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pm); } else { drawArrow(this, toolbutton, pr, p, widget); } @@ -1708,14 +1708,14 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, tr.adjust(pr.width(), 0, 0, 0); pr.translate(shiftX, shiftY); if (!hasArrow) { - drawItemPixmap(p, QStyle::visualRect(opt->direction, rect, pr), Qt::AlignCenter, pm); + proxy()->drawItemPixmap(p, QStyle::visualRect(opt->direction, rect, pr), Qt::AlignCenter, pm); } else { drawArrow(this, toolbutton, pr, p, widget); } alignment |= Qt::AlignLeft | Qt::AlignVCenter; } tr.translate(shiftX, shiftY); - drawItemText(p, QStyle::visualRect(opt->direction, rect, tr), alignment, toolbutton->palette, + proxy()->drawItemText(p, QStyle::visualRect(opt->direction, rect, tr), alignment, toolbutton->palette, toolbutton->state & State_Enabled, toolbutton->text, QPalette::ButtonText); } else { @@ -1723,7 +1723,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (hasArrow) { drawArrow(this, toolbutton, rect, p, widget); } else { - drawItemPixmap(p, rect, Qt::AlignCenter, pm); + proxy()->drawItemPixmap(p, rect, Qt::AlignCenter, pm); } } } @@ -1733,8 +1733,8 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, #ifndef QT_NO_TOOLBOX case CE_ToolBoxTab: if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) { - drawControl(CE_ToolBoxTabShape, tb, p, widget); - drawControl(CE_ToolBoxTabLabel, tb, p, widget); + proxy()->drawControl(CE_ToolBoxTabShape, tb, p, widget); + proxy()->drawControl(CE_ToolBoxTabLabel, tb, p, widget); } break; case CE_ToolBoxTabShape: @@ -1780,8 +1780,8 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, #ifndef QT_NO_TABBAR case CE_TabBarTab: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { - drawControl(CE_TabBarTabShape, tab, p, widget); - drawControl(CE_TabBarTabLabel, tab, p, widget); + proxy()->drawControl(CE_TabBarTabShape, tab, p, widget); + proxy()->drawControl(CE_TabBarTabLabel, tab, p, widget); } break; case CE_TabBarTabShape: @@ -1791,7 +1791,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, QRect rect(tab->rect); bool selected = tab->state & State_Selected; bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab; - int tabOverlap = onlyOne ? 0 : pixelMetric(PM_TabBarTabOverlap, opt, widget); + int tabOverlap = onlyOne ? 0 : proxy()->pixelMetric(PM_TabBarTabOverlap, opt, widget); if (!selected) { switch (tab->shape) { @@ -1895,7 +1895,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) { bool enabled = tb->state & State_Enabled; bool selected = tb->state & State_Selected; - QPixmap pm = tb->icon.pixmap(pixelMetric(QStyle::PM_SmallIconSize, tb, widget), + QPixmap pm = tb->icon.pixmap(proxy()->pixelMetric(QStyle::PM_SmallIconSize, tb, widget), enabled ? QIcon::Normal : QIcon::Disabled); QRect cr = subElementRect(QStyle::SE_ToolBoxTabContents, tb, widget); @@ -1911,7 +1911,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, tr = QRect(ir.right(), cr.top(), cr.width() - ir.right() - 4, cr.height()); } - if (selected && styleHint(QStyle::SH_ToolBox_SelectedPageTitleBold, tb, widget)) { + if (selected && proxy()->styleHint(QStyle::SH_ToolBox_SelectedPageTitleBold, tb, widget)) { QFont f(p->font()); f.setBold(true); p->setFont(f); @@ -1923,16 +1923,16 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, p->drawPixmap(ir.left(), (tb->rect.height() - ih) / 2, pm); int alignment = Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic; - if (!styleHint(QStyle::SH_UnderlineShortcut, tb, widget)) + if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, tb, widget)) alignment |= Qt::TextHideMnemonic; - drawItemText(p, tr, alignment, tb->palette, enabled, txt, QPalette::ButtonText); + proxy()->drawItemText(p, tr, alignment, tb->palette, enabled, txt, QPalette::ButtonText); if (!txt.isEmpty() && opt->state & State_HasFocus) { QStyleOptionFocusRect opt; opt.rect = tr; opt.palette = tb->palette; opt.state = QStyle::State_None; - drawPrimitive(QStyle::PE_FrameFocusRect, &opt, p, widget); + proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &opt, p, widget); } } break; @@ -1947,7 +1947,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, || tabV2.shape == QTabBar::TriangularWest; int alignment = Qt::AlignCenter | Qt::TextShowMnemonic; - if (!styleHint(SH_UnderlineShortcut, opt, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget)) alignment |= Qt::TextHideMnemonic; if (verticalTabs) { @@ -1973,7 +1973,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (!tabV2.icon.isNull()) { QSize iconSize = tabV2.iconSize; if (!iconSize.isValid()) { - int iconExtent = pixelMetric(PM_SmallIconSize); + int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); iconSize = QSize(iconExtent, iconExtent); } QSize tabIconSize = tabV2.icon.actualSize(iconSize, @@ -1998,7 +1998,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, p->drawPixmap(iconRect.x(), iconRect.y(), tabIcon); } - drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText); + proxy()->drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText); if (verticalTabs) p->restore(); @@ -2109,7 +2109,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, p->save(); QRect r = opt->rect; QStyleHintReturnMask mask; - if (styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask)) + if (proxy()->styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask)) p->setClipRegion(mask.region); p->drawTiledPixmap(r.x(), r.y(), r.width(), r.height(), tiledPixmap); p->setPen(opt->palette.color(QPalette::Active, QPalette::WindowText)); @@ -2147,7 +2147,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, } const int indent = p->fontMetrics().descent(); - drawItemText(p, r.adjusted(indent + 1, 1, -indent - 1, -1), + proxy()->drawItemText(p, r.adjusted(indent + 1, 1, -indent - 1, -1), Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette, dwOpt->state & State_Enabled, dwOpt->title, QPalette::WindowText); @@ -2162,14 +2162,14 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) { QRegion clipRegion = p->clipRegion(); p->setClipRect(opt->rect); - drawControl(CE_HeaderSection, header, p, widget); + proxy()->drawControl(CE_HeaderSection, header, p, widget); QStyleOptionHeader subopt = *header; subopt.rect = subElementRect(SE_HeaderLabel, header, widget); if (subopt.rect.isValid()) - drawControl(CE_HeaderLabel, &subopt, p, widget); + proxy()->drawControl(CE_HeaderLabel, &subopt, p, widget); if (header->sortIndicator != QStyleOptionHeader::None) { subopt.rect = subElementRect(SE_HeaderArrow, opt, widget); - drawPrimitive(PE_IndicatorHeaderArrow, &subopt, p, widget); + proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, p, widget); } p->setClipRegion(clipRegion); } @@ -2188,7 +2188,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, #ifndef QT_NO_COMBOBOX case CE_ComboBoxLabel: if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { - QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); + QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); p->save(); p->setClipRect(editRect); if (!cb->currentIcon.isNull()) { @@ -2202,7 +2202,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, iconRect.size(), editRect); if (cb->editable) p->fillRect(iconRect, opt->palette.brush(QPalette::Base)); - drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap); + proxy()->drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap); if (cb->direction == Qt::RightToLeft) editRect.translate(-4 - cb->iconSize.width(), 0); @@ -2210,7 +2210,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, editRect.translate(cb->iconSize.width() + 4, 0); } if (!cb->currentText.isEmpty() && !cb->editable) { - drawItemText(p, editRect.adjusted(1, 0, -1, 0), + proxy()->drawItemText(p, editRect.adjusted(1, 0, -1, 0), visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter), cb->palette, cb->state & State_Enabled, cb->currentText); } @@ -2226,7 +2226,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, frame.QStyleOption::operator=(*toolBar); frame.lineWidth = toolBar->lineWidth; frame.midLineWidth = toolBar->midLineWidth; - drawPrimitive(PE_PanelToolBar, opt, p, widget); + proxy()->drawPrimitive(PE_PanelToolBar, opt, p, widget); if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) break; @@ -2268,7 +2268,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, QRect textRect = subElementRect(SE_ItemViewItemText, vopt, widget); // draw the background - drawPrimitive(PE_PanelItemViewItem, opt, p, widget); + proxy()->drawPrimitive(PE_PanelItemViewItem, opt, p, widget); // draw the check mark if (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator) { @@ -2287,7 +2287,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, option.state |= QStyle::State_On; break; } - drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, p, widget); + proxy()->drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, p, widget); } // draw the icon @@ -2330,7 +2330,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, ? QPalette::Normal : QPalette::Disabled; o.backgroundColor = vopt->palette.color(cg, (vopt->state & QStyle::State_Selected) ? QPalette::Highlight : QPalette::Window); - drawPrimitive(QStyle::PE_FrameFocusRect, &o, p, widget); + proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, p, widget); } p->restore(); @@ -2369,7 +2369,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (widget) { widget->style()->drawPrimitive(QStyle::PE_Frame, opt, p, widget); } else { - drawPrimitive(QStyle::PE_Frame, opt, p, widget); + proxy()->drawPrimitive(QStyle::PE_Frame, opt, p, widget); } break; case QFrame::Panel: @@ -2427,9 +2427,9 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, case SE_PushButtonContents: if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { int dx1, dx2; - dx1 = pixelMetric(PM_DefaultFrameWidth, btn, widget); + dx1 = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget); if (btn->features & QStyleOptionButton::AutoDefaultButton) - dx1 += pixelMetric(PM_ButtonDefaultIndicator, btn, widget); + dx1 += proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); dx2 = dx1 * 2; r.setRect(opt->rect.x() + dx1, opt->rect.y() + dx1, opt->rect.width() - dx2, opt->rect.height() - dx2); @@ -2440,11 +2440,11 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { int dbw1 = 0, dbw2 = 0; if (btn->features & QStyleOptionButton::AutoDefaultButton){ - dbw1 = pixelMetric(PM_ButtonDefaultIndicator, btn, widget); + dbw1 = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); dbw2 = dbw1 * 2; } - int dfw1 = pixelMetric(PM_DefaultFrameWidth, btn, widget) + 1, + int dfw1 = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget) + 1, dfw2 = dfw1 * 2; r.setRect(btn->rect.x() + dfw1 + dbw1, btn->rect.y() + dfw1 + dbw1, @@ -2454,9 +2454,9 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, break; case SE_CheckBoxIndicator: { - int h = pixelMetric(PM_IndicatorHeight, opt, widget); + int h = proxy()->pixelMetric(PM_IndicatorHeight, opt, widget); r.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - h) / 2), - pixelMetric(PM_IndicatorWidth, opt, widget), h); + proxy()->pixelMetric(PM_IndicatorWidth, opt, widget), h); r = visualRect(opt->direction, opt->rect, r); } break; @@ -2466,7 +2466,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, // Deal with the logical first, then convert it back to screen coords. QRect ir = visualRect(opt->direction, opt->rect, subElementRect(SE_CheckBoxIndicator, opt, widget)); - int spacing = pixelMetric(PM_CheckBoxLabelSpacing, opt, widget); + int spacing = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, opt, widget); r.setRect(ir.right() + spacing, opt->rect.y(), opt->rect.width() - ir.width() - spacing, opt->rect.height()); r = visualRect(opt->direction, opt->rect, r); @@ -2506,9 +2506,9 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, case SE_RadioButtonIndicator: { - int h = pixelMetric(PM_ExclusiveIndicatorHeight, opt, widget); + int h = proxy()->pixelMetric(PM_ExclusiveIndicatorHeight, opt, widget); r.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - h) / 2), - pixelMetric(PM_ExclusiveIndicatorWidth, opt, widget), h); + proxy()->pixelMetric(PM_ExclusiveIndicatorWidth, opt, widget), h); r = visualRect(opt->direction, opt->rect, r); } break; @@ -2517,7 +2517,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, { QRect ir = visualRect(opt->direction, opt->rect, subElementRect(SE_RadioButtonIndicator, opt, widget)); - int spacing = pixelMetric(PM_RadioButtonLabelSpacing, opt, widget); + int spacing = proxy()->pixelMetric(PM_RadioButtonLabelSpacing, opt, widget); r.setRect(ir.left() + ir.width() + spacing, opt->rect.y(), opt->rect.width() - ir.width() - spacing, opt->rect.height()); r = visualRect(opt->direction, opt->rect, r); @@ -2554,8 +2554,8 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, #ifndef QT_NO_SLIDER case SE_SliderFocusRect: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { - int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget); - int thickness = pixelMetric(PM_SliderControlThickness, slider, widget); + int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); + int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); if (slider->orientation == Qt::Horizontal) r.setRect(0, tickOffset - 1, slider->rect.width(), thickness + 2); else @@ -2626,7 +2626,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, break; #endif // QT_NO_TOOLBOX case SE_HeaderLabel: { - int margin = pixelMetric(QStyle::PM_HeaderMargin, opt, widget); + int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, opt, widget); r.setRect(opt->rect.x() + margin, opt->rect.y() + margin, opt->rect.width() - margin * 2, opt->rect.height() - margin * 2); @@ -2646,7 +2646,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, int w = opt->rect.width(); int x = opt->rect.x(); int y = opt->rect.y(); - int margin = pixelMetric(QStyle::PM_HeaderMargin, opt, widget); + int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, opt, widget); if (opt->state & State_Horizontal) { int horiz_size = h / 2; @@ -2682,7 +2682,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, r.setWidth(qMin(r.width(), twf->rect.width() - twf->leftCornerWidgetSize.width() - twf->rightCornerWidgetSize.width())); - switch (styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { + switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { default: case Qt::AlignLeft: r.moveTopLeft(QPoint(twf->leftCornerWidgetSize.width(), 0)); @@ -2704,7 +2704,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, r.setWidth(qMin(r.width(), twf->rect.width() - twf->leftCornerWidgetSize.width() - twf->rightCornerWidgetSize.width())); - switch (styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { + switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { default: case Qt::AlignLeft: r.moveTopLeft(QPoint(twf->leftCornerWidgetSize.width(), @@ -2729,7 +2729,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, r.setHeight(qMin(r.height(), twf->rect.height() - twf->leftCornerWidgetSize.height() - twf->rightCornerWidgetSize.height())); - switch (styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { + switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { default: case Qt::AlignLeft: r.moveTopLeft(QPoint(twf->rect.width() - twf->tabBarSize.width(), @@ -2751,7 +2751,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, r.setHeight(qMin(r.height(), twf->rect.height() - twf->leftCornerWidgetSize.height() - twf->rightCornerWidgetSize.height())); - switch (styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { + switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { default: case Qt::AlignLeft: r.moveTopLeft(QPoint(0, twf->leftCornerWidgetSize.height())); @@ -2773,7 +2773,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { QStyleOptionTab tabopt; tabopt.shape = twf->shape; - int overlap = pixelMetric(PM_TabBarBaseOverlap, &tabopt, widget); + int overlap = proxy()->pixelMetric(PM_TabBarBaseOverlap, &tabopt, widget); if (twf->lineWidth == 0) overlap = 0; switch (twf->shape) { @@ -2853,8 +2853,8 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, tr.setRect(0, 0, tr.height(), tr.width()); int verticalShift = pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget); int horizontalShift = pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget); - int hpadding = pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2; - int vpadding = pixelMetric(QStyle::PM_TabBarTabVSpace, opt, widget) / 2; + int hpadding = proxy()->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2; + int vpadding = proxy()->pixelMetric(QStyle::PM_TabBarTabVSpace, opt, widget) / 2; if (tabV2.shape == QTabBar::RoundedSouth || tabV2.shape == QTabBar::TriangularSouth) verticalShift = -verticalShift; tr.adjust(hpadding, vpadding, horizontalShift - hpadding, verticalShift - vpadding); @@ -2874,7 +2874,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, if (!tabV2.icon.isNull()) { QSize iconSize = tabV2.iconSize; if (!iconSize.isValid()) { - int iconExtent = pixelMetric(PM_SmallIconSize); + int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); iconSize = QSize(iconExtent, iconExtent); } QSize tabIconSize = tabV2.icon.actualSize(iconSize, @@ -2906,8 +2906,8 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, case SE_TabBarTabRightButton: if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) { bool selected = tab->state & State_Selected; - int verticalShift = pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget); - int horizontalShift = pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget); + int verticalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget); + int horizontalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget); bool verticalTabs = tab->shape == QTabBar::RoundedEast || tab->shape == QTabBar::RoundedWest @@ -2996,7 +2996,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, break; case SE_FrameContents: if (const QStyleOptionFrameV2 *f = qstyleoption_cast<const QStyleOptionFrameV2 *>(opt)) { - int fw = pixelMetric(PM_DefaultFrameWidth, f, widget); + int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, f, widget); r = opt->rect.adjusted(fw, fw, -fw, -fw); r = visualRect(opt->direction, opt->rect, r); } @@ -3063,9 +3063,9 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, case SE_DockWidgetFloatButton: case SE_DockWidgetTitleBarText: case SE_DockWidgetIcon: { - int iconSize = pixelMetric(PM_SmallIconSize, opt, widget); - int buttonMargin = pixelMetric(PM_DockWidgetTitleBarButtonMargin, opt, widget); - int margin = pixelMetric(QStyle::PM_DockWidgetTitleMargin, opt, widget); + int iconSize = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); + int buttonMargin = proxy()->pixelMetric(PM_DockWidgetTitleBarButtonMargin, opt, widget); + int margin = proxy()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, opt, widget); QRect rect = opt->rect; const QStyleOptionDockWidget *dwOpt @@ -3262,11 +3262,11 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (slider->subControls == SC_SliderTickmarks) { - int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget); + int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); int ticks = slider->tickPosition; - int thickness = pixelMetric(PM_SliderControlThickness, slider, widget); - int len = pixelMetric(PM_SliderLength, slider, widget); - int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget); + int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); + int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); + int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget); int interval = slider->tickInterval; if (interval <= 0) { interval = slider->singleStep; @@ -3324,71 +3324,71 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl if (scrollbar->subControls & SC_ScrollBarSubLine) { newScrollbar.state = saveFlags; - newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarSubLine, widget); + newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSubLine, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); - drawControl(CE_ScrollBarSubLine, &newScrollbar, p, widget); + proxy()->drawControl(CE_ScrollBarSubLine, &newScrollbar, p, widget); } } if (scrollbar->subControls & SC_ScrollBarAddLine) { newScrollbar.rect = scrollbar->rect; newScrollbar.state = saveFlags; - newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarAddLine, widget); + newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarAddLine, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); - drawControl(CE_ScrollBarAddLine, &newScrollbar, p, widget); + proxy()->drawControl(CE_ScrollBarAddLine, &newScrollbar, p, widget); } } if (scrollbar->subControls & SC_ScrollBarSubPage) { newScrollbar.rect = scrollbar->rect; newScrollbar.state = saveFlags; - newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarSubPage, widget); + newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSubPage, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarSubPage)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); - drawControl(CE_ScrollBarSubPage, &newScrollbar, p, widget); + proxy()->drawControl(CE_ScrollBarSubPage, &newScrollbar, p, widget); } } if (scrollbar->subControls & SC_ScrollBarAddPage) { newScrollbar.rect = scrollbar->rect; newScrollbar.state = saveFlags; - newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarAddPage, widget); + newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarAddPage, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarAddPage)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); - drawControl(CE_ScrollBarAddPage, &newScrollbar, p, widget); + proxy()->drawControl(CE_ScrollBarAddPage, &newScrollbar, p, widget); } } if (scrollbar->subControls & SC_ScrollBarFirst) { newScrollbar.rect = scrollbar->rect; newScrollbar.state = saveFlags; - newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarFirst, widget); + newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarFirst, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarFirst)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); - drawControl(CE_ScrollBarFirst, &newScrollbar, p, widget); + proxy()->drawControl(CE_ScrollBarFirst, &newScrollbar, p, widget); } } if (scrollbar->subControls & SC_ScrollBarLast) { newScrollbar.rect = scrollbar->rect; newScrollbar.state = saveFlags; - newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarLast, widget); + newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarLast, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarLast)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); - drawControl(CE_ScrollBarLast, &newScrollbar, p, widget); + proxy()->drawControl(CE_ScrollBarLast, &newScrollbar, p, widget); } } if (scrollbar->subControls & SC_ScrollBarSlider) { newScrollbar.rect = scrollbar->rect; newScrollbar.state = saveFlags; - newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarSlider, widget); + newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSlider, widget); if (newScrollbar.rect.isValid()) { if (!(scrollbar->activeSubControls & SC_ScrollBarSlider)) newScrollbar.state &= ~(State_Sunken | State_MouseOver); - drawControl(CE_ScrollBarSlider, &newScrollbar, p, widget); + proxy()->drawControl(CE_ScrollBarSlider, &newScrollbar, p, widget); if (scrollbar->state & State_HasFocus) { QStyleOptionFocusRect fropt; @@ -3396,7 +3396,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl fropt.rect.setRect(newScrollbar.rect.x() + 2, newScrollbar.rect.y() + 2, newScrollbar.rect.width() - 5, newScrollbar.rect.height() - 5); - drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); } } } @@ -3418,7 +3418,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl PrimitiveElement pe; if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) { - QRect r = subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget); + QRect r = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget); qDrawWinPanel(p, r, sb->palette, true); } @@ -3442,10 +3442,10 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus : PE_IndicatorSpinUp); - copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); - drawPrimitive(PE_PanelButtonBevel, ©, p, widget); + copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); + proxy()->drawPrimitive(PE_PanelButtonBevel, ©, p, widget); copy.rect.adjust(3, 0, -4, 0); - drawPrimitive(pe, ©, p, widget); + proxy()->drawPrimitive(pe, ©, p, widget); } if (sb->subControls & SC_SpinBoxDown) { @@ -3468,10 +3468,10 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus : PE_IndicatorSpinDown); - copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); - drawPrimitive(PE_PanelButtonBevel, ©, p, widget); + copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); + proxy()->drawPrimitive(PE_PanelButtonBevel, ©, p, widget); copy.rect.adjust(3, 0, -4, 0); - drawPrimitive(pe, ©, p, widget); + proxy()->drawPrimitive(pe, ©, p, widget); } } break; @@ -3481,8 +3481,8 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) { QRect button, menuarea; - button = subControlRect(cc, toolbutton, SC_ToolButton, widget); - menuarea = subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget); + button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget); + menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget); State bflags = toolbutton->state & ~State_Sunken; @@ -3504,7 +3504,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl if (bflags & (State_Sunken | State_On | State_Raised)) { tool.rect = button; tool.state = bflags; - drawPrimitive(PE_PanelButtonTool, &tool, p, widget); + proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); } } @@ -3513,28 +3513,28 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl fr.QStyleOption::operator=(*toolbutton); fr.rect.adjust(3, 3, -3, -3); if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup) - fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator, + fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, toolbutton, widget), 0); - drawPrimitive(PE_FrameFocusRect, &fr, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget); } QStyleOptionToolButton label = *toolbutton; label.state = bflags; - int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget); + int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); label.rect = button.adjusted(fw, fw, -fw, -fw); - drawControl(CE_ToolButtonLabel, &label, p, widget); + proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget); if (toolbutton->subControls & SC_ToolButtonMenu) { tool.rect = menuarea; tool.state = mflags; if (mflags & (State_Sunken | State_On | State_Raised)) - drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget); - drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget); + proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget); } else if (toolbutton->features & QStyleOptionToolButton::HasMenu) { - int mbi = pixelMetric(PM_MenuButtonIndicator, toolbutton, widget); + int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget); QRect ir = toolbutton->rect; QStyleOptionToolButton newBtn = *toolbutton; newBtn.rect = QRect(ir.right() + 5 - mbi, ir.y() + ir.height() - mbi + 4, mbi - 6, mbi - 6); - drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); } } break; @@ -3558,7 +3558,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl p->fillRect(opt->rect, fillBrush); - ir = subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget); + ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget); p->setPen(tb->palette.highlightedText().color()); p->drawText(ir.x() + 2, ir.y(), ir.width() - 2, ir.height(), @@ -3571,7 +3571,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl QStyleOption tool(0); tool.palette = tb->palette; if (tb->subControls & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) { - ir = subControlRect(CC_TitleBar, tb, SC_TitleBarCloseButton, widget); + ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarCloseButton, widget); down = tb->activeSubControls & SC_TitleBarCloseButton && (opt->state & State_Sunken); if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool #ifndef QT_NO_DOCKWIDGET @@ -3583,50 +3583,50 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl pm = standardIcon(SP_TitleBarCloseButton, &tool, widget).pixmap(10, 10); tool.rect = ir; tool.state = down ? State_Sunken : State_Raised; - drawPrimitive(PE_PanelButtonTool, &tool, p, widget); + proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); p->save(); if (down) - p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget), - pixelMetric(PM_ButtonShiftVertical, tb, widget)); - drawItemPixmap(p, ir, Qt::AlignCenter, pm); + p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), + proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); + proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); p->restore(); } if (tb->subControls & SC_TitleBarMaxButton && tb->titleBarFlags & Qt::WindowMaximizeButtonHint && !(tb->titleBarState & Qt::WindowMaximized)) { - ir = subControlRect(CC_TitleBar, tb, SC_TitleBarMaxButton, widget); + ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarMaxButton, widget); down = tb->activeSubControls & SC_TitleBarMaxButton && (opt->state & State_Sunken); pm = standardIcon(SP_TitleBarMaxButton, &tool, widget).pixmap(10, 10); tool.rect = ir; tool.state = down ? State_Sunken : State_Raised; - drawPrimitive(PE_PanelButtonTool, &tool, p, widget); + proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); p->save(); if (down) - p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget), - pixelMetric(PM_ButtonShiftVertical, tb, widget)); - drawItemPixmap(p, ir, Qt::AlignCenter, pm); + p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), + proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); + proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); p->restore(); } if (tb->subControls & SC_TitleBarMinButton && tb->titleBarFlags & Qt::WindowMinimizeButtonHint && !(tb->titleBarState & Qt::WindowMinimized)) { - ir = subControlRect(CC_TitleBar, tb, SC_TitleBarMinButton, widget); + ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarMinButton, widget); down = tb->activeSubControls & SC_TitleBarMinButton && (opt->state & State_Sunken); pm = standardIcon(SP_TitleBarMinButton, &tool, widget).pixmap(10, 10); tool.rect = ir; tool.state = down ? State_Sunken : State_Raised; - drawPrimitive(PE_PanelButtonTool, &tool, p, widget); + proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); p->save(); if (down) - p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget), - pixelMetric(PM_ButtonShiftVertical, tb, widget)); - drawItemPixmap(p, ir, Qt::AlignCenter, pm); + p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), + proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); + proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); p->restore(); } @@ -3637,81 +3637,81 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl && (tb->titleBarState & Qt::WindowMaximized))); if (drawNormalButton) { - ir = subControlRect(CC_TitleBar, tb, SC_TitleBarNormalButton, widget); + ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarNormalButton, widget); down = tb->activeSubControls & SC_TitleBarNormalButton && (opt->state & State_Sunken); pm = standardIcon(SP_TitleBarNormalButton, &tool, widget).pixmap(10, 10); tool.rect = ir; tool.state = down ? State_Sunken : State_Raised; - drawPrimitive(PE_PanelButtonTool, &tool, p, widget); + proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); p->save(); if (down) - p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget), - pixelMetric(PM_ButtonShiftVertical, tb, widget)); - drawItemPixmap(p, ir, Qt::AlignCenter, pm); + p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), + proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); + proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); p->restore(); } if (tb->subControls & SC_TitleBarShadeButton && tb->titleBarFlags & Qt::WindowShadeButtonHint && !(tb->titleBarState & Qt::WindowMinimized)) { - ir = subControlRect(CC_TitleBar, tb, SC_TitleBarShadeButton, widget); + ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarShadeButton, widget); down = (tb->activeSubControls & SC_TitleBarShadeButton && (opt->state & State_Sunken)); pm = standardIcon(SP_TitleBarShadeButton, &tool, widget).pixmap(10, 10); tool.rect = ir; tool.state = down ? State_Sunken : State_Raised; - drawPrimitive(PE_PanelButtonTool, &tool, p, widget); + proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); p->save(); if (down) - p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget), - pixelMetric(PM_ButtonShiftVertical, tb, widget)); - drawItemPixmap(p, ir, Qt::AlignCenter, pm); + p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), + proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); + proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); p->restore(); } if (tb->subControls & SC_TitleBarUnshadeButton && tb->titleBarFlags & Qt::WindowShadeButtonHint && tb->titleBarState & Qt::WindowMinimized) { - ir = subControlRect(CC_TitleBar, tb, SC_TitleBarUnshadeButton, widget); + ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarUnshadeButton, widget); down = tb->activeSubControls & SC_TitleBarUnshadeButton && (opt->state & State_Sunken); pm = standardIcon(SP_TitleBarUnshadeButton, &tool, widget).pixmap(10, 10); tool.rect = ir; tool.state = down ? State_Sunken : State_Raised; - drawPrimitive(PE_PanelButtonTool, &tool, p, widget); + proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); p->save(); if (down) - p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget), - pixelMetric(PM_ButtonShiftVertical, tb, widget)); - drawItemPixmap(p, ir, Qt::AlignCenter, pm); + p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), + proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); + proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); p->restore(); } if (tb->subControls & SC_TitleBarContextHelpButton && tb->titleBarFlags & Qt::WindowContextHelpButtonHint) { - ir = subControlRect(CC_TitleBar, tb, SC_TitleBarContextHelpButton, widget); + ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarContextHelpButton, widget); down = tb->activeSubControls & SC_TitleBarContextHelpButton && (opt->state & State_Sunken); pm = standardIcon(SP_TitleBarContextHelpButton, &tool, widget).pixmap(10, 10); tool.rect = ir; tool.state = down ? State_Sunken : State_Raised; - drawPrimitive(PE_PanelButtonTool, &tool, p, widget); + proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); p->save(); if (down) - p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget), - pixelMetric(PM_ButtonShiftVertical, tb, widget)); - drawItemPixmap(p, ir, Qt::AlignCenter, pm); + p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), + proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); + proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); p->restore(); } if (tb->subControls & SC_TitleBarSysMenu && tb->titleBarFlags & Qt::WindowSystemMenuHint) { - ir = subControlRect(CC_TitleBar, tb, SC_TitleBarSysMenu, widget); + ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarSysMenu, widget); if (!tb->icon.isNull()) { tb->icon.paint(p, ir); } else { - int iconSize = pixelMetric(PM_SmallIconSize, tb, widget); + int iconSize = proxy()->pixelMetric(PM_SmallIconSize, tb, widget); pm = standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(iconSize, iconSize); tool.rect = ir; p->save(); - drawItemPixmap(p, ir, Qt::AlignCenter, pm); + proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); p->restore(); } } @@ -3743,7 +3743,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl } if (dial->state & State_Enabled) { - p->setBrush(pal.brush(QPalette::ColorRole(styleHint(SH_Dial_BackgroundRole, + p->setBrush(pal.brush(QPalette::ColorRole(proxy()->styleHint(SH_Dial_BackgroundRole, dial, widget)))); p->setPen(Qt::NoPen); p->drawEllipse(br); @@ -3804,7 +3804,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl br.setHeight(br.height() + r / 3); } fropt.rect = br.adjusted(-2, -2, 2, 2); - drawPrimitive(QStyle::PE_FrameFocusRect, &fropt, p, widget); + proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &fropt, p, widget); } p->restore(); } @@ -3814,15 +3814,15 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl case CC_GroupBox: if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) { // Draw frame - QRect textRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, widget); - QRect checkBoxRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxCheckBox, widget); + QRect textRect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, widget); + QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxCheckBox, widget); if (groupBox->subControls & QStyle::SC_GroupBoxFrame) { QStyleOptionFrameV2 frame; frame.QStyleOption::operator=(*groupBox); frame.features = groupBox->features; frame.lineWidth = groupBox->lineWidth; frame.midLineWidth = groupBox->midLineWidth; - frame.rect = subControlRect(CC_GroupBox, opt, SC_GroupBoxFrame, widget); + frame.rect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxFrame, widget); p->save(); QRegion region(groupBox->rect); if (!groupBox->text.isEmpty()) { @@ -3837,7 +3837,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl region -= finalRect; } p->setClipRegion(region); - drawPrimitive(PE_FrameGroupBox, &frame, p, widget); + proxy()->drawPrimitive(PE_FrameGroupBox, &frame, p, widget); p->restore(); } @@ -3847,10 +3847,10 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl if (textColor.isValid()) p->setPen(textColor); int alignment = int(groupBox->textAlignment); - if (!styleHint(QStyle::SH_UnderlineShortcut, opt, widget)) + if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, opt, widget)) alignment |= Qt::TextHideMnemonic; - drawItemText(p, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, + proxy()->drawItemText(p, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, groupBox->palette, groupBox->state & State_Enabled, groupBox->text, textColor.isValid() ? QPalette::NoRole : QPalette::WindowText); @@ -3858,7 +3858,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*groupBox); fropt.rect = textRect; - drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); } } @@ -3867,7 +3867,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl QStyleOptionButton box; box.QStyleOption::operator=(*groupBox); box.rect = checkBoxRect; - drawPrimitive(PE_IndicatorCheckBox, &box, p, widget); + proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, p, widget); } } break; @@ -3884,52 +3884,52 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl if (opt->activeSubControls & QStyle::SC_MdiCloseButton && (opt->state & State_Sunken)) { btnOpt.state |= State_Sunken; btnOpt.state &= ~State_Raised; - bsx = pixelMetric(PM_ButtonShiftHorizontal); - bsy = pixelMetric(PM_ButtonShiftVertical); + bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); + bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); } else { btnOpt.state |= State_Raised; btnOpt.state &= ~State_Sunken; bsx = 0; bsy = 0; } - btnOpt.rect = subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget); - drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); + btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); QPixmap pm = standardIcon(SP_TitleBarCloseButton).pixmap(16, 16); - drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); + proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); } if (opt->subControls & QStyle::SC_MdiNormalButton) { if (opt->activeSubControls & QStyle::SC_MdiNormalButton && (opt->state & State_Sunken)) { btnOpt.state |= State_Sunken; btnOpt.state &= ~State_Raised; - bsx = pixelMetric(PM_ButtonShiftHorizontal); - bsy = pixelMetric(PM_ButtonShiftVertical); + bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); + bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); } else { btnOpt.state |= State_Raised; btnOpt.state &= ~State_Sunken; bsx = 0; bsy = 0; } - btnOpt.rect = subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget); - drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); + btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); QPixmap pm = standardIcon(SP_TitleBarNormalButton).pixmap(16, 16); - drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); + proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); } if (opt->subControls & QStyle::SC_MdiMinButton) { if (opt->activeSubControls & QStyle::SC_MdiMinButton && (opt->state & State_Sunken)) { btnOpt.state |= State_Sunken; btnOpt.state &= ~State_Raised; - bsx = pixelMetric(PM_ButtonShiftHorizontal); - bsy = pixelMetric(PM_ButtonShiftVertical); + bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); + bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); } else { btnOpt.state |= State_Raised; btnOpt.state &= ~State_Sunken; bsx = 0; bsy = 0; } - btnOpt.rect = subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget); - drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); + btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); QPixmap pm = standardIcon(SP_TitleBarMinButton).pixmap(16, 16); - drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); + proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); } } break; @@ -3951,11 +3951,11 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const #ifndef QT_NO_SLIDER case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { - QRect r = subControlRect(cc, slider, SC_SliderHandle, widget); + QRect r = proxy()->subControlRect(cc, slider, SC_SliderHandle, widget); if (r.isValid() && r.contains(pt)) { sc = SC_SliderHandle; } else { - r = subControlRect(cc, slider, SC_SliderGroove ,widget); + r = proxy()->subControlRect(cc, slider, SC_SliderGroove ,widget); if (r.isValid() && r.contains(pt)) sc = SC_SliderGroove; } @@ -3968,7 +3968,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const QRect r; uint ctrl = SC_ScrollBarAddLine; while (ctrl <= SC_ScrollBarGroove) { - r = subControlRect(cc, scrollbar, QStyle::SubControl(ctrl), widget); + r = proxy()->subControlRect(cc, scrollbar, QStyle::SubControl(ctrl), widget); if (r.isValid() && r.contains(pt)) { sc = QStyle::SubControl(ctrl); break; @@ -3984,7 +3984,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const QRect r; uint ctrl = SC_ToolButton; while (ctrl <= SC_ToolButtonMenu) { - r = subControlRect(cc, toolbutton, QStyle::SubControl(ctrl), widget); + r = proxy()->subControlRect(cc, toolbutton, QStyle::SubControl(ctrl), widget); if (r.isValid() && r.contains(pt)) { sc = QStyle::SubControl(ctrl); break; @@ -4008,7 +4008,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const QRect r; uint ctrl = SC_SpinBoxUp; while (ctrl <= SC_SpinBoxEditField) { - r = subControlRect(cc, spinbox, QStyle::SubControl(ctrl), widget); + r = proxy()->subControlRect(cc, spinbox, QStyle::SubControl(ctrl), widget); if (r.isValid() && r.contains(pt)) { sc = QStyle::SubControl(ctrl); break; @@ -4024,7 +4024,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const uint ctrl = SC_TitleBarSysMenu; while (ctrl <= SC_TitleBarLabel) { - r = subControlRect(cc, tb, QStyle::SubControl(ctrl), widget); + r = proxy()->subControlRect(cc, tb, QStyle::SubControl(ctrl), widget); if (r.isValid() && r.contains(pt)) { sc = QStyle::SubControl(ctrl); break; @@ -4039,7 +4039,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const QRect r; uint ctrl = SC_ComboBoxArrow; // Start here and go down. while (ctrl > 0) { - r = subControlRect(cc, cb, QStyle::SubControl(ctrl), widget); + r = proxy()->subControlRect(cc, cb, QStyle::SubControl(ctrl), widget); if (r.isValid() && r.contains(pt)) { sc = QStyle::SubControl(ctrl); break; @@ -4055,7 +4055,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const QRect r; uint ctrl = SC_GroupBoxCheckBox; while (ctrl <= SC_GroupBoxFrame) { - r = subControlRect(cc, groupBox, QStyle::SubControl(ctrl), widget); + r = proxy()->subControlRect(cc, groupBox, QStyle::SubControl(ctrl), widget); if (r.isValid() && r.contains(pt)) { sc = QStyle::SubControl(ctrl); break; @@ -4070,7 +4070,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const QRect r; uint ctrl = SC_MdiMinButton; while (ctrl <= SC_MdiCloseButton) { - r = subControlRect(CC_MdiControls, opt, QStyle::SubControl(ctrl), widget); + r = proxy()->subControlRect(CC_MdiControls, opt, QStyle::SubControl(ctrl), widget); if (r.isValid() && r.contains(pt) && (opt->subControls & ctrl)) { sc = QStyle::SubControl(ctrl); return sc; @@ -4096,13 +4096,13 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex #ifndef QT_NO_SLIDER case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { - int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget); - int thickness = pixelMetric(PM_SliderControlThickness, slider, widget); + int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); + int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); switch (sc) { case SC_SliderHandle: { int sliderPos = 0; - int len = pixelMetric(PM_SliderLength, slider, widget); + int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); bool horizontal = slider->orientation == Qt::Horizontal; sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderPosition, @@ -4133,7 +4133,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex case CC_ScrollBar: if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { const QRect scrollBarRect = scrollbar->rect; - int sbextent = pixelMetric(PM_ScrollBarExtent, scrollbar, widget); + int sbextent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget); int maxlen = ((scrollbar->orientation == Qt::Horizontal) ? scrollBarRect.width() : scrollBarRect.height()) - (sbextent * 2); int sliderlen; @@ -4143,7 +4143,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex uint range = scrollbar->maximum - scrollbar->minimum; sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep); - int slidermin = pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget); + int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget); if (sliderlen < slidermin || range > INT_MAX / 2) sliderlen = slidermin; if (sliderlen > maxlen) @@ -4216,7 +4216,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex case CC_SpinBox: if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { QSize bs; - int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; + int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; bs.setHeight(qMax(8, spinbox->rect.height()/2 - fw)); // 1.6 -approximate golden mean bs.setWidth(qMax(16, qMin(bs.height() * 8 / 5, spinbox->rect.width() / 4))); @@ -4257,7 +4257,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex #ifndef QT_NO_TOOLBUTTON case CC_ToolButton: if (const QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) { - int mbi = pixelMetric(PM_MenuButtonIndicator, tb, widget); + int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, tb, widget); ret = tb->rect; switch (sc) { case SC_ToolButton: @@ -4397,7 +4397,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex case SC_GroupBoxContents: { int topMargin = 0; int topHeight = 0; - int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget); + int verticalAlignment = proxy()->styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget); if (groupBox->text.size() || (groupBox->subControls & QStyle::SC_GroupBoxCheckBox)) { topHeight = groupBox->fontMetrics.height(); if (verticalAlignment & Qt::AlignVCenter) @@ -4417,7 +4417,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex int frameWidth = 0; if (!(widget && widget->inherits("Q3GroupBox")) && ((groupBox->features & QStyleOptionFrameV2::Flat) == 0)) { - frameWidth = pixelMetric(PM_DefaultFrameWidth, groupBox, widget); + frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget); } ret = frameRect.adjusted(frameWidth, frameWidth + topHeight - topMargin, -frameWidth, -frameWidth); @@ -4433,8 +4433,8 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex ret = groupBox->rect.adjusted(marg, 0, -marg, 0); ret.setHeight(h); - int indicatorWidth = pixelMetric(PM_IndicatorWidth, opt, widget); - int indicatorSpace = pixelMetric(PM_CheckBoxLabelSpacing, opt, widget) - 1; + int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, opt, widget); + int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, opt, widget) - 1; bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox; int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0; @@ -4448,7 +4448,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex int left = 0; // Adjust for check box if (sc == SC_GroupBoxCheckBox) { - int indicatorHeight = pixelMetric(PM_IndicatorHeight, opt, widget); + int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, opt, widget); left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth); int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2; totalRect.setRect(left, top, indicatorWidth, indicatorHeight); @@ -4594,7 +4594,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid case PM_MenuPanelWidth: case PM_TabBarBaseOverlap: case PM_TabBarBaseHeight: - ret = pixelMetric(PM_DefaultFrameWidth, opt, widget); + ret = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); break; case PM_MdiSubWindowFrameWidth: @@ -4630,7 +4630,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width(); - int thickness = pixelMetric(PM_SliderControlThickness, sl, widget); + int thickness = proxy()->pixelMetric(PM_SliderControlThickness, sl, widget); int ticks = sl->tickPosition; if (ticks == QSlider::TicksBothSides) @@ -4647,9 +4647,9 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid case PM_SliderSpaceAvailable: if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (sl->orientation == Qt::Horizontal) - ret = sl->rect.width() - pixelMetric(PM_SliderLength, sl, widget); + ret = sl->rect.width() - proxy()->pixelMetric(PM_SliderLength, sl, widget); else - ret = sl->rect.height() - pixelMetric(PM_SliderLength, sl, widget); + ret = sl->rect.height() - proxy()->pixelMetric(PM_SliderLength, sl, widget); } else { ret = 0; } @@ -4793,12 +4793,12 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid } else if (widget) { isWindow = widget->isWindow(); } - ret = pixelMetric(isWindow ? PM_DefaultTopLevelMargin : PM_DefaultChildMargin); + ret = proxy()->pixelMetric(isWindow ? PM_DefaultTopLevelMargin : PM_DefaultChildMargin); } break; case PM_LayoutHorizontalSpacing: case PM_LayoutVerticalSpacing: - ret = pixelMetric(PM_DefaultLayoutSpacing); + ret = proxy()->pixelMetric(PM_DefaultLayoutSpacing); break; case PM_DefaultTopLevelMargin: @@ -4814,7 +4814,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid case PM_TabBarIconSize: case PM_ToolBarIconSize: case PM_ListViewIconSize: - ret = pixelMetric(PM_SmallIconSize, opt, widget); + ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); break; case PM_ButtonIconSize: @@ -4822,7 +4822,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid ret = 16; break; case PM_IconViewIconSize: - ret = pixelMetric(PM_LargeIconSize, opt, widget); + ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget); break; case PM_LargeIconSize: @@ -4853,10 +4853,10 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid ret = 16; break; case PM_ScrollView_ScrollBarSpacing: - ret = 2 * pixelMetric(PM_DefaultFrameWidth, opt, widget); + ret = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); break; case PM_SubMenuOverlap: - ret = -pixelMetric(QStyle::PM_MenuPanelWidth, opt, widget); + ret = -proxy()->pixelMetric(QStyle::PM_MenuPanelWidth, opt, widget); break; default: ret = 0; @@ -4879,12 +4879,12 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { int w = csz.width(), h = csz.height(), - bm = pixelMetric(PM_ButtonMargin, btn, widget), - fw = pixelMetric(PM_DefaultFrameWidth, btn, widget) * 2; + bm = proxy()->pixelMetric(PM_ButtonMargin, btn, widget), + fw = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget) * 2; w += bm + fw; h += bm + fw; if (btn->features & QStyleOptionButton::AutoDefaultButton){ - int dbw = pixelMetric(PM_ButtonDefaultIndicator, btn, widget) * 2; + int dbw = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget) * 2; w += dbw; h += dbw; } @@ -4896,15 +4896,15 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { bool isRadio = (ct == CT_RadioButton); - int w = pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth + int w = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth : PM_IndicatorWidth, btn, widget); - int h = pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight + int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight : PM_IndicatorHeight, btn, widget); int margins = 0; // we add 4 pixels for label margins if (btn->icon.isNull() || !btn->text.isEmpty()) - margins = 4 + pixelMetric(isRadio ? PM_RadioButtonLabelSpacing + margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, opt, widget); sz += QSize(w + margins, 4); sz.setHeight(qMax(sz.height(), h)); @@ -4922,7 +4922,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, } else { h = mi->fontMetrics.height() + 8; if (!mi->icon.isNull()) { - int iconExtent = pixelMetric(PM_SmallIconSize); + int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4); } } @@ -4947,10 +4947,10 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, #ifndef QT_NO_COMBOBOX case CT_ComboBox: if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { - int fw = cmb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0; - const int textMargins = 2*(pixelMetric(PM_FocusFrameHMargin) + 1); + int fw = cmb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0; + const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1); // QItemDelegate::sizeHint expands the textMargins two times, thus the 2*textMargins... - int other = qMax(23, 2*textMargins + pixelMetric(QStyle::PM_ScrollBarExtent, opt, widget)); + int other = qMax(23, 2*textMargins + proxy()->pixelMetric(QStyle::PM_ScrollBarExtent, opt, widget)); sz = QSize(sz.width() + fw + other, sz.height() + fw); } break; @@ -4958,8 +4958,8 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, case CT_HeaderSection: if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) { bool nullIcon = hdr->icon.isNull(); - int margin = pixelMetric(QStyle::PM_HeaderMargin, hdr, widget); - int iconSize = nullIcon ? 0 : pixelMetric(QStyle::PM_SmallIconSize, hdr, widget); + int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, hdr, widget); + int iconSize = nullIcon ? 0 : proxy()->pixelMetric(QStyle::PM_SmallIconSize, hdr, widget); QSize txt = hdr->fontMetrics.size(0, hdr->text); sz.setHeight(margin + qMax(iconSize, txt.height()) + margin); sz.setWidth((nullIcon ? 0 : margin) + iconSize @@ -5157,8 +5157,8 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget if (widget) { if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) { mask->region = widget->rect(); - int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin), - hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin); + int vmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin), + hmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin); mask->region -= QRect(widget->rect().adjusted(hmargin, vmargin, -hmargin, -vmargin)); } } @@ -5171,7 +5171,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = true; if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) { mask->region = opt->rect; - int margin = pixelMetric(PM_DefaultFrameWidth) * 2; + int margin = proxy()->pixelMetric(PM_DefaultFrameWidth) * 2; mask->region -= opt->rect.adjusted(margin, margin, -margin, -margin); } } @@ -5614,12 +5614,12 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti case SP_CommandLink: case SP_ArrowForward: if (QApplication::layoutDirection() == Qt::RightToLeft) - return standardPixmap(SP_ArrowLeft, option, widget); - return standardPixmap(SP_ArrowRight, option, widget); + return proxy()->standardPixmap(SP_ArrowLeft, option, widget); + return proxy()->standardPixmap(SP_ArrowRight, option, widget); case SP_ArrowBack: if (QApplication::layoutDirection() == Qt::RightToLeft) - return standardPixmap(SP_ArrowRight, option, widget); - return standardPixmap(SP_ArrowLeft, option, widget); + return proxy()->standardPixmap(SP_ArrowRight, option, widget); + return proxy()->standardPixmap(SP_ArrowLeft, option, widget); case SP_ArrowLeft: return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/left-16.png")); case SP_ArrowRight: @@ -5629,7 +5629,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti case SP_ArrowDown: return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/down-16.png")); case SP_FileDialogToParent: - return standardPixmap(SP_ArrowUp, option, widget); + return proxy()->standardPixmap(SP_ArrowUp, option, widget); case SP_FileDialogNewFolder: return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/newdirectory-16.png")); case SP_FileDialogDetailedView: @@ -5641,7 +5641,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti case SP_FileDialogListView: return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/viewlist-16.png")); case SP_FileDialogBack: - return standardPixmap(SP_ArrowBack, option, widget); + return proxy()->standardPixmap(SP_ArrowBack, option, widget); case SP_DriveHDIcon: return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/harddrive-16.png")); case SP_TrashIcon: @@ -5942,7 +5942,7 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons } case SP_FileLinkIcon: { - icon = QIcon(standardPixmap(standardIcon, option, widget)); + icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget)); QPixmap pixmap = d->findIcon(32, QLatin1String("link_overlay.png")); if (!pixmap.isNull()) { QPixmap fileIcon = d->findIcon(32, QLatin1String("text-x-generic.png")); @@ -5957,7 +5957,7 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons } break; case SP_DirLinkIcon: { - icon = QIcon(standardPixmap(standardIcon, option, widget)); + icon = QIcon(proxy()->standardPixmap(standardIcon, option, widget)); QPixmap pixmap = d->findIcon(32, QLatin1String("link_overlay.png")); if (!pixmap.isNull()) { QPixmap fileIcon = d->findIcon(32, QLatin1String("folder.png")); @@ -6175,7 +6175,7 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons break; #endif // QT_NO_IMAGEFORMAT_PNG default: - icon.addPixmap(standardPixmap(standardIcon, option, widget)); + icon.addPixmap(proxy()->standardPixmap(standardIcon, option, widget)); break; } return icon; diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index ab81d97..28dff3b 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -674,14 +674,14 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, if (widget && widget->inherits("QComboBoxPrivateContainer")){ QStyleOption copy = *option; copy.state |= State_Raised; - drawPrimitive(PE_PanelMenu, ©, painter, widget); + proxy()->drawPrimitive(PE_PanelMenu, ©, painter, widget); break; } // Drawing the entire itemview frame is very expensive, especially on the native X11 engine // Instead we cheat a bit and draw a border image without the center part, hence only scaling // thin rectangular images const int pmSize = 64; - const int border = pixelMetric(PM_DefaultFrameWidth, option, widget); + const int border = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); const QString pmKey = QString(QLS("windowframe %0")).arg(option->state); QPixmap pixmap; @@ -892,8 +892,8 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, int border = (size > 9) ? (size/4) : 0; //Allow small arrows to have exact dimensions int bsx = 0, bsy = 0; if (option->state & State_Sunken) { - bsx = pixelMetric(PM_ButtonShiftHorizontal); - bsy = pixelMetric(PM_ButtonShiftVertical); + bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); + bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); } QRect arrowRect = option->rect.adjusted(border + bsx, border + bsy, -border + bsx, -border + bsy); GtkShadowType shadow = option->state & State_Sunken ? GTK_SHADOW_IN : GTK_SHADOW_OUT; @@ -973,7 +973,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) { GtkWidget *gtkEntry = QGtk::gtkWidget(QLS("GtkEntry")); if (panel->lineWidth > 0) - drawPrimitive(PE_FrameLineEdit, option, painter, widget); + proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget); uint resolve_mask = option->palette.resolve(); QRect textRect = option->rect.adjusted(gtkEntry->style->xthickness, gtkEntry->style->ythickness, -gtkEntry->style->xthickness, -gtkEntry->style->ythickness); @@ -1244,8 +1244,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom painter->save(); if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { - QRect textRect = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget); - QRect checkBoxRect = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget); + QRect textRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget); + QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget); // Draw title if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { @@ -1260,7 +1260,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if (!groupBox->text.isEmpty()) { int alignment = int(groupBox->textAlignment); - if (!styleHint(QStyle::SH_UnderlineShortcut, option, widget)) + if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, option, widget)) alignment |= Qt::TextHideMnemonic; QColor textColor = groupBox->textColor; // Note: custom textColor is currently ignored int labelState = GTK_STATE_INSENSITIVE; @@ -1285,7 +1285,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom QStyleOptionButton box; box.QStyleOption::operator=(*groupBox); box.rect = checkBoxRect; - drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); + proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); } } @@ -1308,7 +1308,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom bool focus = isEnabled && (comboBox->state & State_HasFocus); QColor buttonShadow = option->palette.dark().color(); GtkStateType state = gtkPainter.gtkState(option); - int appears_as_list = !styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget); + int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget); QPixmap cache; QString pixmapName; QStyleOptionComboBox comboBoxCopy = *comboBox; @@ -1316,9 +1316,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom bool reverse = (option->direction == Qt::RightToLeft); QRect rect = option->rect; - QRect arrowButtonRect = subControlRect(CC_ComboBox, &comboBoxCopy, + QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxArrow, widget); - QRect editRect = subControlRect(CC_ComboBox, &comboBoxCopy, + QRect editRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxEditField, widget); GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ? @@ -1497,8 +1497,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { QRect button, menuarea; - button = subControlRect(control, toolbutton, SC_ToolButton, widget); - menuarea = subControlRect(control, toolbutton, SC_ToolButtonMenu, widget); + button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget); + menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget); State bflags = toolbutton->state & ~(State_Sunken | State_MouseOver); if (bflags & State_AutoRaise) @@ -1527,7 +1527,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if (bflags & (State_Sunken | State_On | State_Raised | State_MouseOver)) { tool.rect = button; tool.state = bflags; - drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); + proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); } } @@ -1538,9 +1538,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if (toolbutton->state & State_HasFocus) { QStyleOptionFocusRect fr; fr.QStyleOption::operator=(*toolbutton); - fr.rect = subControlRect(CC_ToolButton, toolbutton, SC_ToolButton, widget); + fr.rect = proxy()->subControlRect(CC_ToolButton, toolbutton, SC_ToolButton, widget); fr.rect.adjust(1, 1, -1, -1); - drawPrimitive(PE_FrameFocusRect, &fr, painter, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fr, painter, widget); } QStyleOptionToolButton label = *toolbutton; @@ -1556,21 +1556,21 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom } label.rect = button.adjusted(style->xthickness, style->ythickness, -style->xthickness - popupArrowSize, -style->ythickness); - drawControl(CE_ToolButtonLabel, &label, painter, widget); + proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget); if (toolbutton->subControls & SC_ToolButtonMenu) { tool.rect = menuarea; tool.state = mflags; if ((mflags & State_Enabled && (mflags & (State_Sunken | State_Raised | State_MouseOver))) || !(mflags & State_AutoRaise)) - drawPrimitive(PE_IndicatorButtonDropDown, &tool, painter, widget); + proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, painter, widget); - drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget); } else if (drawMenuArrow) { QRect ir = toolbutton->rect; QStyleOptionToolButton newBtn = *toolbutton; newBtn.rect = QRect(ir.right() - popupArrowSize - style->xthickness - 3, ir.height()/2 - 1, popupArrowSize, popupArrowSize); - drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget); } } break; @@ -1587,10 +1587,10 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom painter->fillRect(option->rect, option->palette.background()); QRect rect = scrollBar->rect; - QRect scrollBarSubLine = subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget); - QRect scrollBarAddLine = subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget); - QRect scrollBarSlider = subControlRect(control, scrollBar, SC_ScrollBarSlider, widget); - QRect grooveRect = subControlRect(control, scrollBar, SC_ScrollBarGroove, widget); + QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget); + QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget); + QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget); + QRect grooveRect = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget); bool horizontal = scrollBar->orientation == Qt::Horizontal; GtkWidget * scrollbarWidget = horizontal ? gtkHScrollBar : gtkVScrollBar; style = scrollbarWidget->style; @@ -1734,7 +1734,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom bool reverse = (spinBox->direction == Qt::RightToLeft); //### Move this to subControlRect - QRect upRect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget); + QRect upRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget); upRect.setTop(option->rect.top()); if (reverse) @@ -1742,8 +1742,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom else upRect.setRight(option->rect.right()); - QRect editRect = subControlRect(CC_SpinBox, option, SC_SpinBoxEditField, widget); - QRect downRect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget); + QRect editRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxEditField, widget); + QRect downRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget); downRect.setBottom(option->rect.bottom()); if (reverse) @@ -1875,9 +1875,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom GtkWidget *hScaleWidget = QGtk::gtkWidget(QLS("GtkHScale")); GtkWidget *vScaleWidget = QGtk::gtkWidget(QLS("GtkVScale")); - QRect groove = subControlRect(CC_Slider, option, SC_SliderGroove, widget); - QRect handle = subControlRect(CC_Slider, option, SC_SliderHandle, widget); - QRect ticks = subControlRect(CC_Slider, option, SC_SliderTickmarks, widget); + QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); + QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); + QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget); bool horizontal = slider->orientation == Qt::Horizontal; bool ticksAbove = slider->tickPosition & QSlider::TicksAbove; @@ -1932,8 +1932,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom if (option->subControls & SC_SliderTickmarks) { painter->setPen(darkOutline); - int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget); - int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget); + int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); + int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget); int interval = slider->tickInterval; if (interval <= 0) { @@ -1950,7 +1950,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom interval = 1; int v = slider->minimum; - int len = pixelMetric(PM_SliderLength, slider, widget); + int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); while (v <= slider->maximum + 1) { if (v == slider->maximum + 1 && interval == 1) break; @@ -2011,7 +2011,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom fropt.rect.setLeft(handle.left() - 3); fropt.rect.setRight(handle.right() + 3); } - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } gtkPainter.paintSlider( scaleWidget, horizontal ? "hscale" : "vscale", handle, state, shadow, style, @@ -2101,9 +2101,9 @@ void QGtkStyle::drawControl(ControlElement element, if (option->state & State_Sunken) buttonShift = QPoint(pixelMetric(PM_ButtonShiftHorizontal, option, widget), - pixelMetric(PM_ButtonShiftVertical, option, widget)); + proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget)); - if (styleHint(SH_UnderlineShortcut, button, widget)) + if (proxy()->styleHint(SH_UnderlineShortcut, button, widget)) tf |= Qt::TextShowMnemonic; else tf |= Qt::TextHideMnemonic; @@ -2164,7 +2164,7 @@ void QGtkStyle::drawControl(ControlElement element, GdkColor gdkText = gtkButton->style->fg[labelState]; QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); pal.setBrush(QPalette::ButtonText, textColor); - drawItemText(painter, ir, tf, pal, (button->state & State_Enabled), + proxy()->drawItemText(painter, ir, tf, pal, (button->state & State_Enabled), button->text, QPalette::ButtonText); } break; @@ -2185,7 +2185,7 @@ void QGtkStyle::drawControl(ControlElement element, QStyleOptionButton subopt = *btn; subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator, btn, widget); - drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, + proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, &subopt, painter, widget); subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents : SE_CheckBoxContents, btn, widget); @@ -2199,14 +2199,14 @@ void QGtkStyle::drawControl(ControlElement element, QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); pal.setBrush(QPalette::WindowText, textColor); subopt.palette = pal; - drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget); + proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget); if (btn->state & State_HasFocus) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*btn); fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect : SE_CheckBoxFocusRect, btn, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } } break; @@ -2215,8 +2215,8 @@ void QGtkStyle::drawControl(ControlElement element, case CE_ComboBoxLabel: if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); - bool appearsAsList = !styleHint(QStyle::SH_ComboBox_Popup, cb, widget); + QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); + bool appearsAsList = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, cb, widget); painter->save(); painter->setClipRect(editRect); @@ -2234,7 +2234,7 @@ void QGtkStyle::drawControl(ControlElement element, if (cb->editable) painter->fillRect(iconRect, option->palette.brush(QPalette::Base)); - drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); + proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); if (cb->direction == Qt::RightToLeft) editRect.translate(-4 - cb->iconSize.width(), 0); @@ -2256,7 +2256,7 @@ void QGtkStyle::drawControl(ControlElement element, pal.setBrush(QPalette::ButtonText, textColor); - drawItemText(painter, editRect.adjusted(1, 0, -1, 0), + proxy()->drawItemText(painter, editRect.adjusted(1, 0, -1, 0), visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter), pal, cb->state & State_Enabled, cb->currentText, QPalette::ButtonText); } @@ -2302,7 +2302,7 @@ void QGtkStyle::drawControl(ControlElement element, QString titleText = painter->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, titleRect.width()); - drawItemText(painter, + proxy()->drawItemText(painter, titleRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette, dwOpt->state & State_Enabled, titleText, @@ -2423,10 +2423,10 @@ void QGtkStyle::drawControl(ControlElement element, QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText; uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; - if (!QCleanlooksStyle::styleHint(SH_UnderlineShortcut, mbi, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget)) alignment |= Qt::TextHideMnemonic; - drawItemText(painter, item.rect, alignment, item.palette, mbi->state & State_Enabled, mbi->text, textRole); + proxy()->drawItemText(painter, item.rect, alignment, item.palette, mbi->state & State_Enabled, mbi->text, textRole); } } painter->restore(); @@ -2598,7 +2598,7 @@ void QGtkStyle::drawControl(ControlElement element, mode = QIcon::Active; QPixmap pixmap; - int smallIconSize = pixelMetric(PM_SmallIconSize, option, widget); + int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget); QSize iconSize(smallIconSize, smallIconSize); #ifndef QT_NO_COMBOBOX @@ -2626,7 +2626,7 @@ void QGtkStyle::drawControl(ControlElement element, } opt.state |= State_Sunken; opt.rect = vCheckRect; - drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget); } painter->drawPixmap(pmr.topLeft(), pixmap); } @@ -2666,7 +2666,7 @@ void QGtkStyle::drawControl(ControlElement element, int t = s.indexOf(QLatin1Char('\t')); int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; - if (!styleHint(SH_UnderlineShortcut, menuitem, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget)) text_flags |= Qt::TextHideMnemonic; // Draw shortcut right aligned @@ -2699,7 +2699,7 @@ void QGtkStyle::drawControl(ControlElement element, // Arrow if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow QPoint buttonShift(pixelMetric(PM_ButtonShiftHorizontal, option, widget), - pixelMetric(PM_ButtonShiftVertical, option, widget)); + proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget)); QFontMetrics fm(menuitem->font); int arrow_size = fm.ascent() + fm.descent() - 2 * gtkMenuItem->style->ythickness; @@ -2727,7 +2727,7 @@ void QGtkStyle::drawControl(ControlElement element, case CE_PushButton: if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton")); - drawControl(CE_PushButtonBevel, btn, painter, widget); + proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget); QStyleOptionButton subopt = *btn; subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); gint interiorFocus = true; @@ -2737,14 +2737,14 @@ void QGtkStyle::drawControl(ControlElement element, if (btn->features & QStyleOptionButton::Flat && btn->state & State_HasFocus) // The normal button focus rect does not work well for flat buttons in Clearlooks - drawPrimitive(PE_FrameFocusRect, option, painter, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, option, painter, widget); else if (btn->state & State_HasFocus) gtkPainter.paintFocus(gtkButton, "button", option->rect.adjusted(xt, yt, -xt, -yt), btn->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL, gtkButton->style); - drawControl(CE_PushButtonLabel, &subopt, painter, widget); + proxy()->drawControl(CE_PushButtonLabel, &subopt, painter, widget); } break; @@ -2962,8 +2962,8 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple font.setBold(true); QFontMetrics fontMetrics(font); QSize textRect = fontMetrics.boundingRect(groupBoxWidget->title()).size() + QSize(4, 4); - int indicatorWidth = pixelMetric(PM_IndicatorWidth, option, widget); - int indicatorHeight = pixelMetric(PM_IndicatorHeight, option, widget); + int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget); + int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget); if (subControl == SC_GroupBoxCheckBox) { rect.setWidth(indicatorWidth); @@ -3044,7 +3044,7 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple QGtk::gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())}; QGtk::gtk_widget_size_allocate(gtkCombo, &geometry); - int appears_as_list = !styleHint(QStyle::SH_ComboBox_Popup, option, widget); + int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, option, widget); QString arrowPath = comboBoxPath + QLS(".GtkToggleButton"); if (!box->editable && !appears_as_list) @@ -3208,7 +3208,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, case CT_ComboBox: if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { GtkWidget *gtkCombo = QGtk::gtkWidget(QLS("GtkComboBox")); - QRect arrowButtonRect = subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget); + QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget); newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkCombo->style->xthickness, 4 + 2*gtkCombo->style->ythickness); if (!(widget && qobject_cast<QToolBar *>(widget->parentWidget()))) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 99894ad..ec75138 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -1051,7 +1051,7 @@ QSize QMacStylePrivate::pushButtonSizeFromContents(const QStyleOptionButton *btn : btn->fontMetrics.boundingRect(QRect(), Qt::AlignCenter, btn->text); csz.setWidth(iconSize.width() + textRect.width() + ((btn->features & QStyleOptionButton::HasMenu) - ? q->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, 0) : 0)); + ? q->proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, 0) : 0)); csz.setHeight(qMax(iconSize.height(), textRect.height())); return csz; } @@ -2222,7 +2222,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW ret = closeButtonSize; break; case PM_ToolBarIconSize: - ret = pixelMetric(PM_LargeIconSize); + ret = proxy()->pixelMetric(PM_LargeIconSize); break; case PM_FocusFrameVMargin: case PM_FocusFrameHMargin: @@ -2746,7 +2746,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w QPixmap pix(pixmapSize); pix.fill(QColor(fillR, fillG, fillB)); QPainter pix_paint(&pix); - drawControl(CE_FocusFrame, opt, &pix_paint, w); + proxy()->drawControl(CE_FocusFrame, opt, &pix_paint, w); pix_paint.end(); img = pix.toImage(); } @@ -3061,7 +3061,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai twf.rect = twf.rect.adjusted(0, -10, 0, 0); break; } - drawPrimitive(PE_FrameTabWidget, &twf, p, w); + proxy()->drawPrimitive(PE_FrameTabWidget, &twf, p, w); p->restore(); } break; @@ -3159,7 +3159,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) { // In HITheme, up is down, down is up and hamburgers eat people. if (header->sortIndicator != QStyleOptionHeader::None) - drawPrimitive( + proxy()->drawPrimitive( (header->sortIndicator == QStyleOptionHeader::SortDown) ? PE_IndicatorArrowUp : PE_IndicatorArrowDown, header, p, w); } @@ -3293,7 +3293,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai fdi.isFocused = (frame->state & State_HasFocus); int lw = frame->lineWidth; if (lw <= 0) - lw = pixelMetric(PM_DefaultFrameWidth, frame, w); + lw = proxy()->pixelMetric(PM_DefaultFrameWidth, frame, w); { //clear to base color p->save(); p->setPen(QPen(baseColor, lw)); @@ -3506,16 +3506,16 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QIcon::Mode mode = QIcon::Disabled; if (opt->state & State_Enabled) mode = QIcon::Normal; - QPixmap pixmap = header->icon.pixmap(pixelMetric(PM_SmallIconSize), mode); + QPixmap pixmap = header->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), mode); QRect pixr = header->rect; pixr.setY(header->rect.center().y() - (pixmap.height() - 1) / 2); - drawItemPixmap(p, pixr, Qt::AlignVCenter, pixmap); + proxy()->drawItemPixmap(p, pixr, Qt::AlignVCenter, pixmap); textr.translate(pixmap.width() + 2, 0); } - drawItemText(p, textr, header->textAlignment | Qt::AlignVCenter, header->palette, - header->state & State_Enabled, header->text, QPalette::ButtonText); + proxy()->drawItemText(p, textr, header->textAlignment | Qt::AlignVCenter, header->palette, + header->state & State_Enabled, header->text, QPalette::ButtonText); } break; case CE_ToolButtonLabel: @@ -3530,8 +3530,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter int alignment = 0; bool down = tb->state & (State_Sunken | State_On); if (down) { - shiftX = pixelMetric(PM_ButtonShiftHorizontal, tb, w); - shiftY = pixelMetric(PM_ButtonShiftVertical, tb, w); + shiftX = proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, w); + shiftY = proxy()->pixelMetric(PM_ButtonShiftVertical, tb, w); } // The down state is special for QToolButtons in a toolbar on the Mac // The text is a bit bolder and gets a drop shadow and the icons are also darkened. @@ -3574,7 +3574,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter pr.translate(shiftX, shiftY); pixmap = darkenPixmap(pixmap); } - drawItemPixmap(p, pr, Qt::AlignCenter, pixmap); + proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pixmap); break; } } @@ -3655,7 +3655,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); if (btn->features & QStyleOptionButton::HasMenu) { - int mbi = pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w); + int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w); QRect ir = btn->rect; HIRect arrowRect = CGRectMake(ir.right() - mbi - PushButtonRightOffset, ir.height() / 2 - 4, mbi, ir.height() / 2); @@ -3742,7 +3742,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (hasIcon) { int contentW = textRect.width(); if (hasMenu) - contentW += pixelMetric(PM_MenuButtonIndicator) + 4; + contentW += proxy()->pixelMetric(PM_MenuButtonIndicator) + 4; QIcon::Mode mode = btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled; if (mode == QIcon::Normal && btn->state & State_HasFocus) mode = QIcon::Active; @@ -3756,7 +3756,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter int iconTopOffset = freeContentRect.y() + (freeContentRect.height() - pixmap.height()) / 2; QRect iconDestRect(iconLeftOffset, iconTopOffset, pixmap.width(), pixmap.height()); QRect visualIconDestRect = visualRect(btn->direction, freeContentRect, iconDestRect); - drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap); + proxy()->drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap); int newOffset = iconDestRect.x() + iconDestRect.width() + PushButtonContentPadding - textRect.x(); textRect.adjust(newOffset, 0, newOffset, 0); @@ -3764,8 +3764,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // Draw the text: if (hasText) { textRect = visualRect(btn->direction, freeContentRect, textRect); - drawItemText(p, textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, btn->palette, - (btn->state & State_Enabled), btn->text, QPalette::ButtonText); + proxy()->drawItemText(p, textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, btn->palette, + (btn->state & State_Enabled), btn->text, QPalette::ButtonText); } } } @@ -3922,7 +3922,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QRect nr = subElementRect(SE_TabBarTabText, opt, w); nr.moveTop(+1); int alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextHideMnemonic; - drawItemText(p, nr, alignment, np, tab->state & State_Enabled, tab->text, QPalette::WindowText); + proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled, + tab->text, QPalette::WindowText); p->restore(); } @@ -4045,8 +4046,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } break; case CE_FocusFrame: { - int xOff = pixelMetric(PM_FocusFrameHMargin, opt, w) + 1; - int yOff = pixelMetric(PM_FocusFrameVMargin, opt, w) + 1; + int xOff = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, w) + 1; + int yOff = proxy()->pixelMetric(PM_FocusFrameVMargin, opt, w) + 1; HIRect hirect = CGRectMake(xOff+opt->rect.x(), yOff+opt->rect.y(), opt->rect.width() - 2 * xOff, opt->rect.height() - 2 * yOff); HIThemeDrawFocusRect(&hirect, true, QMacCGContext(p), kHIThemeOrientationNormal); @@ -4169,7 +4170,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QIcon::Mode mode = (mi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled; // Always be normal or disabled to follow the Mac style. - int smallIconSize = pixelMetric(PM_SmallIconSize); + int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize); QSize iconSize(smallIconSize, smallIconSize); if (const QComboBox *comboBox = qobject_cast<const QComboBox *>(w)) { iconSize = comboBox->iconSize(); @@ -4279,7 +4280,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter drawItemPixmap(p, mi->rect, Qt::AlignCenter | Qt::TextHideMnemonic | Qt::TextDontClip | Qt::TextSingleLine, - mi->icon.pixmap(pixelMetric(PM_SmallIconSize), + mi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), (mi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled)); } else { drawItemText(p, mi->rect, @@ -4916,7 +4917,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex treeOpt.state |= State_Children; if (item.state & State_Open) treeOpt.state |= State_Open; - drawPrimitive(PE_IndicatorBranch, &treeOpt, p, widget); + proxy()->drawPrimitive(PE_IndicatorBranch, &treeOpt, p, widget); } y += item.totalHeight; } @@ -4930,7 +4931,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex SInt32 frame_size; GetThemeMetric(kThemeMetricEditTextFrameOutset, &frame_size); - QRect lineeditRect = subControlRect(CC_SpinBox, sb, SC_SpinBoxEditField, widget); + QRect lineeditRect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxEditField, widget); lineeditRect.adjust(-frame_size, -frame_size, +frame_size, +frame_size); HIThemeFrameDrawInfo fdi; @@ -4974,9 +4975,9 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex bdi.value = kThemeButtonOff; bdi.adornment = kThemeAdornmentNone; - QRect updown = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); + QRect updown = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); - updown |= subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); + updown |= proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); HIRect newRect = qt_hirectForQRect(updown); QRect off_rct; HIRect outRect; @@ -5089,7 +5090,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex &titleRegion2); ptrHIShapeGetBounds(titleRegion2, &tmpRect); if (tmpRect.size.width != 1) { - int iconExtent = pixelMetric(PM_SmallIconSize); + int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); iw = titlebar->icon.actualSize(QSize(iconExtent, iconExtent)).width(); } } @@ -5107,7 +5108,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex else x += br.width() / 2 - p->fontMetrics().width(titlebar->text) / 2; if (iw) - p->drawPixmap(x - iw, y, titlebar->icon.pixmap(pixelMetric(PM_SmallIconSize), QIcon::Normal)); + p->drawPixmap(x - iw, y, + titlebar->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), QIcon::Normal)); drawItemText(p, br, Qt::AlignCenter, opt->palette, tds == kThemeStateActive, titlebar->text, QPalette::Text); p->restore(); @@ -5144,7 +5146,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex tti.truncationPosition = kHIThemeTextTruncationNone; tti.truncationMaxLines = 1 + groupBox->text.count(QLatin1Char('\n')); QCFString groupText = qt_mac_removeMnemonics(groupBox->text); - QRect r = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget); + QRect r = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget); HIRect bounds = qt_hirectForQRect(r); HIThemeDrawTextBox(groupText, &bounds, &tti, cg, kHIThemeOrientationNormal); p->restore(); @@ -5157,12 +5159,12 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) { if (tb->subControls & SC_ToolButtonMenu) { QStyleOption arrowOpt(0); - arrowOpt.rect = subControlRect(cc, tb, SC_ToolButtonMenu, widget); + arrowOpt.rect = proxy()->subControlRect(cc, tb, SC_ToolButtonMenu, widget); arrowOpt.rect.setY(arrowOpt.rect.y() + arrowOpt.rect.height() / 2); arrowOpt.rect.setHeight(arrowOpt.rect.height() / 2); arrowOpt.state = tb->state; arrowOpt.palette = tb->palette; - drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget); } else if ((tb->features & QStyleOptionToolButton::HasMenu) && (tb->toolButtonStyle != Qt::ToolButtonTextOnly && !tb->icon.isNull())) { drawToolbarButtonArrow(tb->rect, tds, cg); @@ -5185,7 +5187,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex p->setPen(oldPen); } } - drawControl(CE_ToolButtonLabel, opt, p, widget); + proxy()->drawControl(CE_ToolButtonLabel, opt, p, widget); } else { ThemeButtonKind bkind = kThemeBevelButton; switch (d->aquaSizeConstrain(opt, widget)) { @@ -5206,8 +5208,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex } QRect button, menuarea; - button = subControlRect(cc, tb, SC_ToolButton, widget); - menuarea = subControlRect(cc, tb, SC_ToolButtonMenu, widget); + button = proxy()->subControlRect(cc, tb, SC_ToolButton, widget); + menuarea = proxy()->subControlRect(cc, tb, SC_ToolButtonMenu, widget); State bflags = tb->state, mflags = tb->state; if (tb->subControls & SC_ToolButton) @@ -5270,11 +5272,11 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex } else if (tb->features & QStyleOptionToolButton::HasMenu) { drawToolbarButtonArrow(tb->rect, tds, cg); } - QRect buttonRect = subControlRect(CC_ToolButton, tb, SC_ToolButton, widget); - int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget); + QRect buttonRect = proxy()->subControlRect(CC_ToolButton, tb, SC_ToolButton, widget); + int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); QStyleOptionToolButton label = *tb; label.rect = buttonRect.adjusted(fw, fw, -fw, -fw); - drawControl(CE_ToolButtonLabel, &label, p, widget); + proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget); } } break; @@ -5505,7 +5507,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op else if (sc == SC_TitleBarLabel) wrc = kWindowTitleTextRgn; else if (sc == SC_TitleBarSysMenu) - ret.setRect(-1024, -1024, 10, pixelMetric(PM_TitleBarHeight, + ret.setRect(-1024, -1024, 10, proxy()->pixelMetric(PM_TitleBarHeight, titlebar, widget)); if (wrc != kWindowGlobalPortRgn) { QCFType<HIShapeRef> region; @@ -5602,7 +5604,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op QRect labelRect = alignedRect(groupBox->direction, groupBox->textAlignment, QSize(tw, h), ret); - int indicatorWidth = pixelMetric(PM_IndicatorWidth, opt, widget); + int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, opt, widget); bool rtl = groupBox->direction == Qt::RightToLeft; if (sc == SC_GroupBoxLabel) { if (checkable) { @@ -5624,7 +5626,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op if (sc == SC_GroupBoxCheckBox) { int left = rtl ? labelRect.right() - indicatorWidth : labelRect.left(); ret.setRect(left, ret.top(), - indicatorWidth, pixelMetric(PM_IndicatorHeight, opt, widget)); + indicatorWidth, proxy()->pixelMetric(PM_IndicatorHeight, opt, widget)); } break; } @@ -5662,7 +5664,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op QAquaWidgetSize aquaSize = d->aquaSizeConstrain(spin, widget); int spinner_w; int spinBoxSep; - int fw = pixelMetric(PM_SpinBoxFrameWidth, spin, widget); + int fw = proxy()->pixelMetric(PM_SpinBoxFrameWidth, spin, widget); switch (aquaSize) { default: case QAquaSizeUnknown: @@ -5784,7 +5786,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz.transpose(); if (newStyleTabs) { int defaultTabHeight; - int defaultExtraSpace = pixelMetric(PM_TabBarTabHSpace, tab, widget); // Remove spurious gcc warning (AFAIK) + int defaultExtraSpace = proxy()->pixelMetric(PM_TabBarTabHSpace, tab, widget); // Remove spurious gcc warning (AFAIK) QFontMetrics fm = opt->fontMetrics; switch (AquaSize) { case QAquaSizeUnknown: @@ -5891,7 +5893,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, h = qMax(h, iconSize.height() + 4); maxpmw = qMax(maxpmw, iconSize.width()); } else { - int iconExtent = pixelMetric(PM_SmallIconSize); + int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4); } } @@ -5938,7 +5940,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, QStyleHintReturnMask menuMask; QStyleOption myOption = *opt; myOption.rect.setSize(sz); - if (styleHint(SH_Menu_Mask, &myOption, widget, &menuMask)) { + if (proxy()->styleHint(SH_Menu_Mask, &myOption, widget, &menuMask)) { sz = menuMask.region.boundingRect().size(); } break; } diff --git a/src/gui/styles/qmotifstyle.cpp b/src/gui/styles/qmotifstyle.cpp index d6b8a7a..95f69b9 100644 --- a/src/gui/styles/qmotifstyle.cpp +++ b/src/gui/styles/qmotifstyle.cpp @@ -386,7 +386,7 @@ void QMotifStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP case PE_FrameTabWidget: case PE_FrameWindow: - qDrawShadePanel(p, opt->rect, opt->palette, QStyle::State_None, pixelMetric(PM_DefaultFrameWidth)); + qDrawShadePanel(p, opt->rect, opt->palette, QStyle::State_None, proxy()->pixelMetric(PM_DefaultFrameWidth)); break; case PE_FrameFocusRect: if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) { @@ -475,7 +475,7 @@ void QMotifStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP fill = opt->palette.brush(QPalette::Button); if ((opt->state & State_Enabled || opt->state & State_On) || !(opt->state & State_AutoRaise)) qDrawShadePanel(p, opt->rect, opt->palette, bool(opt->state & (State_Sunken | State_On)), - pixelMetric(PM_DefaultFrameWidth), &fill); + proxy()->pixelMetric(PM_DefaultFrameWidth), &fill); break; } case PE_IndicatorCheckBox: { @@ -490,9 +490,9 @@ void QMotifStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP opt->rect.x(), opt->rect.y() + opt->rect.height() - 1); } else { qDrawShadePanel(p, opt->rect, opt->palette, !showUp, - pixelMetric(PM_DefaultFrameWidth), &fill); + proxy()->pixelMetric(PM_DefaultFrameWidth), &fill); } - if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText)) + if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern)); break; } @@ -545,7 +545,7 @@ void QMotifStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP a.setPoints(INTARRLEN(bottom_pts), bottom_pts); a.translate(opt->rect.x(), opt->rect.y()); p->drawPolyline(a); - if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText)) + if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern)); p->setPen(oldPen); p->setBrush(oldBrush); @@ -736,13 +736,13 @@ void QMotifStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP #undef CLEFT #undef CTOP #undef CBOT - if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText)) + if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern)); break; } case PE_IndicatorDockWidgetResizeHandle: { const int motifOffset = 10; - int sw = pixelMetric(PM_SplitterWidth); + int sw = proxy()->pixelMetric(PM_SplitterWidth); if (opt->state & State_Horizontal) { int yPos = opt->rect.y() + opt->rect.height() / 2; int kPos = opt->rect.right() - motifOffset - sw; @@ -769,7 +769,7 @@ void QMotifStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP const int markH = 6; int posX = opt->rect.x() + (opt->rect.width() - markW) / 2 - 1; int posY = opt->rect.y() + (opt->rect.height() - markH) / 2; - int dfw = pixelMetric(PM_DefaultFrameWidth); + int dfw = proxy()->pixelMetric(PM_DefaultFrameWidth); if (dfw < 2) { // Could do with some optimizing/caching... @@ -843,7 +843,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q handleOpt.state &= ~State_Horizontal; else handleOpt.state |= State_Horizontal; - drawPrimitive(PE_IndicatorDockWidgetResizeHandle, &handleOpt, p, widget); + proxy()->drawPrimitive(PE_IndicatorDockWidgetResizeHandle, &handleOpt, p, widget); break; } case CE_ScrollBarSubLine: @@ -855,9 +855,9 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q pe = (opt->state & State_Horizontal) ? (opt->direction == Qt::LeftToRight ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight) : PE_IndicatorArrowUp; QStyleOption arrowOpt = *opt; arrowOpt.state |= State_Enabled; - drawPrimitive(pe, &arrowOpt, p, widget); - if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText)) { - int fw = pixelMetric(PM_DefaultFrameWidth); + proxy()->drawPrimitive(pe, &arrowOpt, p, widget); + if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) { + int fw = proxy()->pixelMetric(PM_DefaultFrameWidth); p->fillRect(opt->rect.adjusted(fw, fw, -fw, -fw), QBrush(p->background().color(), Qt::Dense5Pattern)); } }break; @@ -873,9 +873,9 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q bevelOpt.state &= ~(State_Sunken | State_On); p->save(); p->setBrushOrigin(bevelOpt.rect.topLeft()); - drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget); + proxy()->drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget); p->restore(); - if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText)) + if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern)); break; } @@ -886,31 +886,31 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q QStyleOptionButton subopt = *btn; subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator, btn, widget); - drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, + proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, &subopt, p, widget); subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents : SE_CheckBoxContents, btn, widget); - drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget); + proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget); if ((btn->state & State_HasFocus) && (!focus || !focus->isVisible())) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*btn); fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect : SE_CheckBoxFocusRect, btn, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); } } break; case CE_PushButton: if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { - drawControl(CE_PushButtonBevel, btn, p, widget); + proxy()->drawControl(CE_PushButtonBevel, btn, p, widget); QStyleOptionButton subopt = *btn; subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); - drawControl(CE_PushButtonLabel, &subopt, p, widget); + proxy()->drawControl(CE_PushButtonLabel, &subopt, p, widget); if ((btn->state & State_HasFocus) && (!focus || !focus->isVisible())) { QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*btn); fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); } } break; @@ -919,7 +919,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q int diw, x1, y1, x2, y2; p->setPen(opt->palette.foreground().color()); p->setBrush(QBrush(opt->palette.button().color(), Qt::NoBrush)); - diw = pixelMetric(PM_ButtonDefaultIndicator); + diw = proxy()->pixelMetric(PM_ButtonDefaultIndicator); opt->rect.getCoords(&x1, &y1, &x2, &y2); if (btn->features & (QStyleOptionButton::AutoDefaultButton|QStyleOptionButton::DefaultButton)) { x1 += diw; @@ -948,14 +948,14 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q QStyleOptionButton newOpt = *btn; newOpt.rect = QRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1); p->setBrushOrigin(p->brushOrigin()); - drawPrimitive(PE_PanelButtonCommand, &newOpt, p, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, &newOpt, p, widget); } if (btn->features & QStyleOptionButton::HasMenu) { - int mbi = pixelMetric(PM_MenuButtonIndicator, btn, widget); + int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, btn, widget); QRect ir = btn->rect; QStyleOptionButton newBtn = *btn; newBtn.rect = QRect(ir.right() - mbi - 3, ir.y() + 4, mbi, ir.height() - 8); - drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); } break; } @@ -963,7 +963,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q #ifndef QT_NO_TABBAR case CE_TabBarTabShape: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { - const int default_frame = pixelMetric(PM_DefaultFrameWidth, tab, widget); + const int default_frame = proxy()->pixelMetric(PM_DefaultFrameWidth, tab, widget); const int frame_offset = (default_frame > 1) ? 1 : 0; if (tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedEast || @@ -1081,7 +1081,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q } p->setTransform(m, true); } - const int unit_width = pixelMetric(PM_ProgressBarChunkWidth, opt, widget); + const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, opt, widget); int u = rect.width() / unit_width; int p_v = pb->progress - pb->minimum; int t_s = qMax(0, pb->maximum - pb->minimum); @@ -1150,7 +1150,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q QFont oldFont = p->font(); p->setFont(menuitem->font); p->fillRect(x, y, w, h, opt->palette.brush(QPalette::Button)); - drawItemText(p, menuitem->rect.adjusted(10, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter, + proxy()->drawItemText(p, menuitem->rect.adjusted(10, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter, menuitem->palette, menuitem->state & State_Enabled, menuitem->text, QPalette::Text); textWidth = menuitem->fontMetrics.width(menuitem->text) + 10; @@ -1220,10 +1220,10 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q } if (menuitem->checkType & QStyleOptionMenuItem::Exclusive) { newMenuItem.rect.setRect(xvis + 2, y + motifItemFrame + mh / 4, 11, 11); - drawPrimitive(PE_IndicatorRadioButton, &newMenuItem, p, widget); + proxy()->drawPrimitive(PE_IndicatorRadioButton, &newMenuItem, p, widget); } else { newMenuItem.rect.setRect(xvis + 5, y + motifItemFrame + mh / 4, 9, 9); - drawPrimitive(PE_IndicatorCheckBox, &newMenuItem, p, widget); + proxy()->drawPrimitive(PE_IndicatorCheckBox, &newMenuItem, p, widget); } } @@ -1258,14 +1258,14 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q int xv = vr.x(); QRect tr(xv, y+m, menuitem->tabWidth, h-2*m); p->drawText(tr, text_flags, s.mid(t+1)); - if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText)) + if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) p->fillRect(tr, QBrush(p->background().color(), Qt::Dense5Pattern)); s = s.left(t); } QRect tr(xvis, y+m, w - xm - menuitem->tabWidth + 1, h-2*m); p->drawText(tr, text_flags, s.left(t)); p->setFont(oldFont); - if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText)) + if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) p->fillRect(tr, QBrush(p->background().color(), Qt::Dense5Pattern)); } if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) { // draw sub menu arrow @@ -1279,7 +1279,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q arrowOpt.state = (State_Sunken | ((opt->state & State_Enabled) ? State_Enabled : State_None)); else arrowOpt.state = ((opt->state & State_Enabled) ? State_Enabled : State_None); - drawPrimitive(arrow, &arrowOpt, p, widget); + proxy()->drawPrimitive(arrow, &arrowOpt, p, widget); } break; } @@ -1296,7 +1296,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q p->save(); p->setBrushOrigin(opt->rect.topLeft()); qDrawShadePanel(p, opt->rect, opt->palette, bool(opt->state & (State_Sunken|State_On)), - pixelMetric(PM_DefaultFrameWidth), + proxy()->pixelMetric(PM_DefaultFrameWidth), &opt->palette.brush((opt->state & State_Sunken) ? QPalette::Mid : QPalette::Button)); p->restore(); break; @@ -1431,8 +1431,8 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) { QRect button, menuarea; - button = subControlRect(cc, toolbutton, SC_ToolButton, widget); - menuarea = subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget); + button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget); + menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget); State bflags = toolbutton->state & ~State_Sunken; if (bflags & State_AutoRaise) { @@ -1453,7 +1453,7 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple if (bflags & (State_Sunken | State_On | State_Raised)) { tool.rect = button; tool.state = bflags; - drawPrimitive(PE_PanelButtonTool, &tool, p, widget); + proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); } } @@ -1461,26 +1461,26 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple QStyleOptionFocusRect fr; fr.QStyleOption::operator=(*toolbutton); fr.rect = toolbutton->rect.adjusted(3, 3, -3, -3); - drawPrimitive(PE_FrameFocusRect, &fr, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget); } QStyleOptionToolButton label = *toolbutton; label.state = bflags; - int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget); + int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); label.rect = button.adjusted(fw, fw, -fw, -fw); - drawControl(CE_ToolButtonLabel, &label, p, widget); + proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget); if (toolbutton->subControls & SC_ToolButtonMenu) { tool.rect = menuarea; tool.state = mflags; if (mflags & (State_Sunken | State_On | State_Raised)) - drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget); - drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget); + proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget); } else if (toolbutton->features & QStyleOptionToolButton::HasMenu) { - int mbi = pixelMetric(PM_MenuButtonIndicator, toolbutton, widget); + int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget); QRect ir = toolbutton->rect; QStyleOptionToolButton newBtn = *toolbutton; newBtn.rect = QRect(ir.right() + 5 - mbi, ir.height() - mbi + 4, mbi - 6, mbi - 6); - drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); } } break; @@ -1491,18 +1491,18 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple PrimitiveElement pe; if (spinbox->frame && (spinbox->subControls & SC_SpinBoxFrame)) { - QRect r = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxFrame, widget); - qDrawShadePanel(p, r, opt->palette, false, pixelMetric(PM_SpinBoxFrameWidth)); + QRect r = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxFrame, widget); + qDrawShadePanel(p, r, opt->palette, false, proxy()->pixelMetric(PM_SpinBoxFrameWidth)); - int fw = pixelMetric(QStyle::PM_DefaultFrameWidth); - r = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxEditField, widget).adjusted(-fw,-fw,fw,fw); + int fw = proxy()->pixelMetric(QStyle::PM_DefaultFrameWidth); + r = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxEditField, widget).adjusted(-fw,-fw,fw,fw); QStyleOptionFrame lineOpt; lineOpt.QStyleOption::operator=(*opt); lineOpt.rect = r; lineOpt.lineWidth = fw; lineOpt.midLineWidth = 0; lineOpt.state |= QStyle::State_Sunken; - drawPrimitive(QStyle::PE_FrameLineEdit, &lineOpt, p, widget); + proxy()->drawPrimitive(QStyle::PE_FrameLineEdit, &lineOpt, p, widget); } if (spinbox->subControls & SC_SpinBoxUp) { @@ -1525,8 +1525,8 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple pe = (spinbox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus : PE_IndicatorSpinUp); - copy.rect = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxUp, widget); - drawPrimitive(pe, ©, p, widget); + copy.rect = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxUp, widget); + proxy()->drawPrimitive(pe, ©, p, widget); } if (spinbox->subControls & SC_SpinBoxDown) { @@ -1549,8 +1549,8 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple pe = (spinbox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus : PE_IndicatorSpinDown); - copy.rect = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxDown, widget); - drawPrimitive(pe, ©, p, widget); + copy.rect = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxDown, widget); + proxy()->drawPrimitive(pe, ©, p, widget); } } break; @@ -1558,16 +1558,16 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple #ifndef QT_NO_SLIDER case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { - QRect groove = subControlRect(CC_Slider, opt, SC_SliderGroove, widget), - handle = subControlRect(CC_Slider, opt, SC_SliderHandle, widget); + QRect groove = proxy()->subControlRect(CC_Slider, opt, SC_SliderGroove, widget), + handle = proxy()->subControlRect(CC_Slider, opt, SC_SliderHandle, widget); if ((opt->subControls & SC_SliderGroove) && groove.isValid()) { - qDrawShadePanel(p, groove, opt->palette, true, pixelMetric(PM_DefaultFrameWidth), + qDrawShadePanel(p, groove, opt->palette, true, proxy()->pixelMetric(PM_DefaultFrameWidth), &opt->palette.brush((opt->state & State_Enabled) ? QPalette::Mid : QPalette::Window)); if ((opt->state & State_HasFocus) && (!focus || !focus->isVisible())) { QStyleOption focusOpt = *opt; focusOpt.rect = subElementRect(SE_SliderFocusRect, opt, widget); - drawPrimitive(PE_FrameFocusRect, &focusOpt, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &focusOpt, p, widget); } } @@ -1577,7 +1577,7 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple bevelOpt.rect = handle; p->save(); p->setBrushOrigin(bevelOpt.rect.topLeft()); - drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget); + proxy()->drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget); p->restore(); if (slider->orientation == Qt::Horizontal) { @@ -1589,14 +1589,14 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple qDrawShadeLine(p, handle.x(), mid, handle.x() + handle.width() - 2, mid, opt->palette, true, 1); } - if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText)) + if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) p->fillRect(handle, QBrush(p->background().color(), Qt::Dense5Pattern)); } if (slider->subControls & SC_SliderTickmarks) { QStyleOptionSlider tmpSlider = *slider; tmpSlider.subControls = SC_SliderTickmarks; - int frameWidth = pixelMetric(PM_DefaultFrameWidth); + int frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth); tmpSlider.rect.translate(frameWidth - 1, 0); QCommonStyle::drawComplexControl(cc, &tmpSlider, p, widget); } @@ -1607,13 +1607,13 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { if (opt->subControls & SC_ComboBoxArrow) { int awh, ax, ay, sh, sy, dh, ew; - int fw = cb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0; + int fw = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0; if (cb->frame) { QStyleOptionButton btn; btn.QStyleOption::operator=(*cb); btn.state |= QStyle::State_Raised; - drawPrimitive(PE_PanelButtonCommand, &btn, p, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, &btn, p, widget); } else { p->fillRect(opt->rect, opt->palette.brush(QPalette::Button)); } @@ -1627,7 +1627,7 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple QStyleOption arrowOpt = *opt; arrowOpt.rect = ar; arrowOpt.state |= State_Enabled; - drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget); // draws the shaded line under the arrow @@ -1643,13 +1643,13 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple focus.QStyleOption::operator=(*opt); focus.rect = subElementRect(SE_ComboBoxFocusRect, opt, widget); focus.backgroundColor = opt->palette.button().color(); - drawPrimitive(PE_FrameFocusRect, &focus, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &focus, p, widget); } } if (opt->subControls & SC_ComboBoxEditField) { if (cb->editable) { - QRect er = subControlRect(CC_ComboBox, opt, SC_ComboBoxEditField, widget); + QRect er = proxy()->subControlRect(CC_ComboBox, opt, SC_ComboBoxEditField, widget); er.adjust(-1, -1, 1, 1); qDrawShadePanel(p, er, opt->palette, true, 1, &opt->palette.brush(QPalette::Base)); @@ -1663,7 +1663,7 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple case CC_ScrollBar: { if (opt->subControls & SC_ScrollBarGroove) qDrawShadePanel(p, opt->rect, opt->palette, true, - pixelMetric(PM_DefaultFrameWidth, opt, widget), + proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget), &opt->palette.brush((opt->state & State_Enabled) ? QPalette::Mid : QPalette::Window)); if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { @@ -1798,7 +1798,7 @@ int QMotifStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, break; case PM_ToolBarFrameWidth: - ret = pixelMetric(PM_DefaultFrameWidth); + ret = proxy()->pixelMetric(PM_DefaultFrameWidth); break; case PM_ToolBarItemMargin: @@ -1819,7 +1819,7 @@ int QMotifStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, break; case PM_SliderThickness: - ret = 16 + 4 * pixelMetric(PM_DefaultFrameWidth); + ret = 16 + 4 * proxy()->pixelMetric(PM_DefaultFrameWidth); break; #ifndef QT_NO_SLIDER case PM_SliderControlThickness: @@ -1849,9 +1849,9 @@ int QMotifStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, case PM_SliderSpaceAvailable: if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (sl->orientation == Qt::Horizontal) - ret = sl->rect.width() - pixelMetric(PM_SliderLength, opt, widget) - 2 * pixelMetric(PM_DefaultFrameWidth, opt, widget); + ret = sl->rect.width() - proxy()->pixelMetric(PM_SliderLength, opt, widget) - 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); else - ret = sl->rect.height() - pixelMetric(PM_SliderLength, opt, widget) - 2 * pixelMetric(PM_DefaultFrameWidth, opt, widget); + ret = sl->rect.height() - proxy()->pixelMetric(PM_SliderLength, opt, widget) - 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); } break; #endif // QT_NO_SLIDER @@ -1901,7 +1901,7 @@ QMotifStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, #ifndef QT_NO_SPINBOX case CC_SpinBox: if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { - int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; + int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; QSize bs; bs.setHeight(opt->rect.height()/2 - fw); bs.setWidth(qMin(bs.height() * 8 / 5, opt->rect.width() / 4)); // 1.6 -approximate golden mean @@ -1944,11 +1944,11 @@ QMotifStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { if (sc == SC_SliderHandle) { - int tickOffset = pixelMetric(PM_SliderTickmarkOffset, opt, widget); - int thickness = pixelMetric(PM_SliderControlThickness, opt, widget); + int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, opt, widget); + int thickness = proxy()->pixelMetric(PM_SliderControlThickness, opt, widget); bool horizontal = slider->orientation == Qt::Horizontal; - int len = pixelMetric(PM_SliderLength, opt, widget); - int motifBorder = pixelMetric(PM_DefaultFrameWidth); + int len = proxy()->pixelMetric(PM_SliderLength, opt, widget); + int motifBorder = proxy()->pixelMetric(PM_DefaultFrameWidth); int sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderPosition, horizontal ? slider->rect.width() - len - 2 * motifBorder : slider->rect.height() - len - 2 * motifBorder, @@ -1967,7 +1967,7 @@ QMotifStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, #ifndef QT_NO_SCROLLBAR case CC_ScrollBar: if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { - int dfw = pixelMetric(PM_DefaultFrameWidth); + int dfw = proxy()->pixelMetric(PM_DefaultFrameWidth); QRect rect = visualRect(scrollbar->direction, scrollbar->rect, QCommonStyle::subControlRect(cc, scrollbar, sc, widget)); if (sc == SC_ScrollBarSlider) { @@ -1991,7 +1991,7 @@ QMotifStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, switch (sc) { case SC_ComboBoxArrow: { int ew, awh, sh, dh, ax, ay, sy; - int fw = cb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0; + int fw = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0; QRect cr = opt->rect; cr.adjust(fw, fw, -fw, -fw); get_combo_parameters(cr, ew, awh, ax, ay, sh, dh, sy); @@ -1999,7 +1999,7 @@ QMotifStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, } case SC_ComboBoxEditField: { - int fw = cb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0; + int fw = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0; QRect rect = opt->rect; rect.adjust(fw, fw, -fw, -fw); int ew = get_combo_extra_width(rect.height(), rect.width()); @@ -2115,7 +2115,7 @@ QMotifStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidge case SE_ComboBoxFocusRect: { int awh, ax, ay, sh, sy, dh, ew; - int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget); + int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); QRect tr = opt->rect; tr.adjust(fw, fw, -fw, -fw); diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 0a56213..725e1d5 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -1129,7 +1129,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption switch (element) { case PE_IndicatorButtonDropDown: - drawPrimitive(PE_PanelButtonTool, option, painter, widget); + proxy()->drawPrimitive(PE_PanelButtonTool, option, painter, widget); break; case PE_FrameDefaultButton: { if (!(option->state & QStyle::State_Enabled)) @@ -1175,7 +1175,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption break; } - int borderThickness = pixelMetric(PM_TabBarBaseOverlap, twf, widget); + int borderThickness = proxy()->pixelMetric(PM_TabBarBaseOverlap, twf, widget); bool reverse = (twf->direction == Qt::RightToLeft); painter->save(); @@ -1354,7 +1354,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption painter->setPen(oldPen); } else { frameV2.state &= ~(State_Sunken | State_HasFocus); - drawPrimitive(PE_Frame, &frameV2, painter, widget); + proxy()->drawPrimitive(PE_Frame, &frameV2, painter, widget); } } break; @@ -1853,13 +1853,13 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption QStyleOptionButton button; button.QStyleOption::operator=(*option); button.state &= ~State_MouseOver; - drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget); + proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget); break; } case PE_FrameWindow: { painter->save(); bool active = (option->state & State_Active); - int titleBarStop = option->rect.top() + pixelMetric(PM_TitleBarHeight, option, widget); + int titleBarStop = option->rect.top() + proxy()->pixelMetric(PM_TitleBarHeight, option, widget); QPalette palette = option->palette; if (!active) @@ -2069,7 +2069,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op && !leftCornerWidget; bool reverseShadow = false; - int borderThickness = pixelMetric(PM_TabBarBaseOverlap, tab, widget); + int borderThickness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget); int marginLeft = 0; if ((atBeginning && !selected) || (selected && leftCornerWidget && ((tab->position == QStyleOptionTab::Beginning) || onlyTab))) { marginLeft = 1; @@ -2909,7 +2909,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op int w = 0; if (!menuItem->text.isEmpty()) { painter->setFont(menuItem->font); - drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter, + proxy()->drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter, menuItem->palette, menuItem->state & State_Enabled, menuItem->text, QPalette::Text); w = menuItem->fontMetrics.width(menuItem->text) + 5; @@ -2952,7 +2952,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op if (checked) button.state |= State_On; button.palette = menuItem->palette; - drawPrimitive(PE_IndicatorRadioButton, &button, painter, widget); + proxy()->drawPrimitive(PE_IndicatorRadioButton, &button, painter, widget); } else { if (menuItem->icon.isNull()) { QStyleOptionButton button; @@ -2961,7 +2961,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op if (checked) button.state |= State_On; button.palette = menuItem->palette; - drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget); + proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget); } else if (checked) { int iconSize = qMax(menuItem->maxIconWidth, 20); QRect sunkenRect(option->rect.left() + 1, @@ -3073,7 +3073,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op newMI.palette.highlightedText().color()); else newMI.palette.setColor(QPalette::ButtonText, textBrush.color()); - drawPrimitive(arrow, &newMI, painter, widget); + proxy()->drawPrimitive(arrow, &newMI, painter, widget); } painter->restore(); @@ -3570,7 +3570,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op // The SubLine (up/left) buttons QRect button1; QRect button2; - int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, option, widget); + int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, option, widget); if (horizontal) { button1.setRect(scrollBarSubLine.left(), scrollBarSubLine.top(), scrollBarExtent, scrollBarSubLine.height()); button2.setRect(scrollBarSubLine.right() - (scrollBarExtent - 1), scrollBarSubLine.top(), scrollBarExtent, scrollBarSubLine.height()); @@ -3710,7 +3710,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op pixmapRect.right() - 1, pixmapRect.bottom() - 1); sliderPainter.drawLines(lines, 2); - int sliderMinLength = pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget); + int sliderMinLength = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget); if ((horizontal && scrollBar->rect.width() > sliderMinLength) || (!horizontal && scrollBar->rect.height() > sliderMinLength)) { QImage pattern(horizontal ? qt_scrollbar_slider_pattern_horizontal @@ -3749,7 +3749,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op QWindowsStyle::drawControl(element, option, painter, widget); } else if (!comboBox->currentIcon.isNull()) { { - QRect editRect = subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget); + QRect editRect = proxy()->subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget); if (comboBox->direction == Qt::RightToLeft) editRect.adjust(0, 2, -2, -2); else @@ -3766,7 +3766,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op Qt::AlignLeft | Qt::AlignVCenter, iconRect.size(), editRect); painter->fillRect(iconRect, option->palette.brush(QPalette::Base)); - drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); + proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); } painter->restore(); } @@ -3809,9 +3809,9 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt #ifndef QT_NO_SLIDER case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - QRect grooveRegion = subControlRect(CC_Slider, option, SC_SliderGroove, widget); - QRect handle = subControlRect(CC_Slider, option, SC_SliderHandle, widget); - QRect ticks = subControlRect(CC_Slider, option, SC_SliderTickmarks, widget); + QRect grooveRegion = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); + QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); + QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget); bool horizontal = slider->orientation == Qt::Horizontal; bool ticksAbove = slider->tickPosition & QSlider::TicksAbove; bool ticksBelow = slider->tickPosition & QSlider::TicksBelow; @@ -3972,15 +3972,15 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*slider); fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); } } if (option->subControls & SC_SliderTickmarks) { QPen oldPen = painter->pen(); painter->setPen(borderColor); - int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget); - int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget); + int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); + int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget); int interval = slider->tickInterval; if (interval <= 0) { interval = slider->singleStep; @@ -3994,7 +3994,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt interval = 1; int v = slider->minimum; - int len = pixelMetric(PM_SliderLength, slider, widget); + int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); QVarLengthArray<QLine, 32> lines; while (v <= slider->maximum + 1) { if (v == slider->maximum + 1 && interval == 1) @@ -4049,8 +4049,8 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt bool reverse = (spinBox->direction == Qt::RightToLeft); // Rects - QRect upRect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget); - QRect downRect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget); + QRect upRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget); + QRect downRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget); QRect buttonRect = upRect | downRect; // Brushes @@ -4071,7 +4071,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt } else { d->drawPartialFrame(painter, option, - subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget), + proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget), widget); } // Paint buttons @@ -4411,7 +4411,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt Q_D(const QPlastiqueStyle); d->drawPartialFrame(painter, option, - subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget), + proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget), widget); QBrush border = qMapBrushToRect(option->palette.shadow(), buttonRect); @@ -4535,7 +4535,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt if (!sunken) { buttonOption.state &= ~State_Sunken; } - drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget); + proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget); // Draw the menu button separator line QBrush border = qMapBrushToRect(option->palette.shadow(), rect); @@ -4571,9 +4571,9 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt if ((option->state & State_HasFocus) && !comboBox->editable && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) { QStyleOptionFocusRect focus; - focus.rect = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget) + focus.rect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget) .adjusted(-2, 0, 2, 0); - drawPrimitive(PE_FrameFocusRect, &focus, painter, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &focus, painter, widget); } painter->setPen(oldPen); @@ -4603,7 +4603,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt QStyleOptionDockWidgetV2 dockwidget; dockwidget.QStyleOption::operator=(*option); dockwidget.title = titleBar->text; - drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget); + proxy()->drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget); } else #endif // QT3_SUPPORT @@ -4676,7 +4676,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt } } // draw title - QRect textRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget); + QRect textRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget); QFont font = painter->font(); font.setBold(true); @@ -4703,7 +4703,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken); - QRect minButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget); + QRect minButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget); qt_plastique_draw_mdibutton(painter, titleBar, minButtonRect, hover, sunken); int xoffset = minButtonRect.width() / 3; @@ -4747,7 +4747,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken); - QRect maxButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget); + QRect maxButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget); qt_plastique_draw_mdibutton(painter, titleBar, maxButtonRect, hover, sunken); int xoffset = maxButtonRect.width() / 3; @@ -4772,7 +4772,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken); - QRect closeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget); + QRect closeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget); qt_plastique_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken); int xoffset = closeButtonRect.width() / 3; @@ -4818,7 +4818,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt bool hover = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_Sunken); - QRect normalButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget); + QRect normalButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget); qt_plastique_draw_mdibutton(painter, titleBar, normalButtonRect, hover, sunken); int xoffset = int(normalButtonRect.width() / 3.5); int yoffset = int(normalButtonRect.height() / 3.5); @@ -4864,7 +4864,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken); - QRect contextHelpButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget); + QRect contextHelpButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget); qt_plastique_draw_mdibutton(painter, titleBar, contextHelpButtonRect, hover, sunken); @@ -4891,7 +4891,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken); - QRect shadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget); + QRect shadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget); qt_plastique_draw_mdibutton(painter, titleBar, shadeButtonRect, hover, sunken); int xoffset = shadeButtonRect.width() / 3; @@ -4915,7 +4915,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken); - QRect unshadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget); + QRect unshadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget); qt_plastique_draw_mdibutton(painter, titleBar, unshadeButtonRect, hover, sunken); int xoffset = unshadeButtonRect.width() / 3; @@ -4940,7 +4940,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt bool hover = (titleBar->activeSubControls & SC_TitleBarSysMenu) && (titleBar->state & State_MouseOver); bool sunken = (titleBar->activeSubControls & SC_TitleBarSysMenu) && (titleBar->state & State_Sunken); - QRect iconRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget); + QRect iconRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget); if (hover) qt_plastique_draw_mdibutton(painter, titleBar, iconRect, hover, sunken); @@ -4952,7 +4952,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt QPixmap pm = standardPixmap(SP_TitleBarMenuButton, &tool, widget); tool.rect = iconRect; painter->save(); - drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm); + proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm); painter->restore(); } } @@ -4987,7 +4987,7 @@ QSize QPlastiqueStyle::sizeFromContents(ContentsType type, const QStyleOption *o #ifndef QT_NO_SLIDER case CT_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget); + int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); if (slider->tickPosition & QSlider::TicksBelow) { if (slider->orientation == Qt::Horizontal) newSize.rheight() += tickSize; @@ -5006,8 +5006,8 @@ QSize QPlastiqueStyle::sizeFromContents(ContentsType type, const QStyleOption *o #ifndef QT_NO_SCROLLBAR case CT_ScrollBar: if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, option, widget); - int scrollBarSliderMinimum = pixelMetric(PM_ScrollBarSliderMin, option, widget); + int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, option, widget); + int scrollBarSliderMinimum = proxy()->pixelMetric(PM_ScrollBarSliderMin, option, widget); if (scrollBar->orientation == Qt::Horizontal) { newSize = QSize(scrollBarExtent * 3 + scrollBarSliderMinimum, scrollBarExtent); } else { @@ -5088,7 +5088,7 @@ QRect QPlastiqueStyle::subControlRect(ComplexControl control, const QStyleOption #ifndef QT_NO_SLIDER case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget); + int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); switch (subControl) { case SC_SliderHandle: @@ -5141,10 +5141,10 @@ QRect QPlastiqueStyle::subControlRect(ComplexControl control, const QStyleOption #ifndef QT_NO_SCROLLBAR case CC_ScrollBar: if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, scrollBar, widget); + int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollBar, widget); int sliderMaxLength = ((scrollBar->orientation == Qt::Horizontal) ? scrollBar->rect.width() : scrollBar->rect.height()) - (scrollBarExtent * 3); - int sliderMinLength = pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget); + int sliderMinLength = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget); int sliderLength; // calculate slider length @@ -5266,7 +5266,7 @@ QRect QPlastiqueStyle::subControlRect(ComplexControl control, const QStyleOption break; case SC_ComboBoxEditField: { if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - int frameWidth = pixelMetric(PM_DefaultFrameWidth); + int frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth); rect = visualRect(option->direction, option->rect, rect); if (box->editable) { @@ -5471,31 +5471,31 @@ QStyle::SubControl QPlastiqueStyle::hitTestComplexControl(ComplexControl control #ifndef QT_NO_SCROLLBAR case CC_ScrollBar: if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - QRect slider = subControlRect(control, scrollBar, SC_ScrollBarSlider, widget); + QRect slider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget); if (slider.contains(pos)) { ret = SC_ScrollBarSlider; break; } - QRect scrollBarAddLine = subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget); + QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget); if (scrollBarAddLine.contains(pos)) { ret = SC_ScrollBarAddLine; break; } - QRect scrollBarSubPage = subControlRect(control, scrollBar, SC_ScrollBarSubPage, widget); + QRect scrollBarSubPage = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubPage, widget); if (scrollBarSubPage.contains(pos)) { ret = SC_ScrollBarSubPage; break; } - QRect scrollBarAddPage = subControlRect(control, scrollBar, SC_ScrollBarAddPage, widget); + QRect scrollBarAddPage = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddPage, widget); if (scrollBarAddPage.contains(pos)) { ret = SC_ScrollBarAddPage; break; } - QRect scrollBarSubLine = subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget); + QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget); if (scrollBarSubLine.contains(pos)) { ret = SC_ScrollBarSubLine; break; diff --git a/src/gui/styles/qproxystyle.cpp b/src/gui/styles/qproxystyle.cpp new file mode 100644 index 0000000..f36ad64 --- /dev/null +++ b/src/gui/styles/qproxystyle.cpp @@ -0,0 +1,366 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qstyle.h> +#include <private/qstyle_p.h> +#include <private/qproxystyle_p.h> +#include <private/qapplication_p.h> +#include "qproxystyle.h" +#include "qstylefactory.h" + +#if !defined(QT_NO_STYLE_PROXY) || defined(QT_PLUGIN) + +QT_BEGIN_NAMESPACE + +/*! + \class QProxyStyle + + \brief The QProxyStyle is a convenience class that simplifies + the creation of proxy styles in Qt. + + \since 4.6 + + A proxy style is a style that wraps a different, + usually the default system style, to override the painting or + behavior of only specific parts. + + Here's an example allowing you to override the shortcut underline + behavior on all platforms: + + \snippet doc/src/snippets/code/src_gui_proxystyle.cpp 0 + + Warning: Note that even though Qt's internal styles should respect this. + hint, there is no guarantee that it will work for all styles. + The example above would for instance not work on Mac since menus are + handled by the operating system. + + \sa QStyle +*/ +void QProxyStylePrivate::ensureBaseStyle() const +{ + Q_Q(const QProxyStyle); + + if (baseStyle) + return; + + if (!baseStyle && !QApplicationPrivate::styleOverride.isEmpty()) { + baseStyle = QStyleFactory::create(QApplicationPrivate::styleOverride); + if (baseStyle) { + // If baseStyle is an instance of the same proxyStyle + // we destroy it and fall back to the desktop style + if (qstrcmp(baseStyle->metaObject()->className(), + q->metaObject()->className()) == 0) { + delete baseStyle; + baseStyle = 0; + } + } + } + + if (!baseStyle) // Use application desktop style + baseStyle = QStyleFactory::create(QApplicationPrivate::desktopStyleKey()); + + if (!baseStyle) // Fallback to windows style + baseStyle = QStyleFactory::create(QLatin1String("windows")); + + baseStyle->setProxy(const_cast<QProxyStyle*>(q)); + baseStyle->setParent(const_cast<QProxyStyle*>(q)); // Take ownership +} + +/*! + Constructs a QProxyStyle object. + + If no base style is provided, the current application style + will be used as the base style. + + Ownership of \style is transferred to QProxyStyle. +*/ +QProxyStyle::QProxyStyle(QStyle *style) : + QCommonStyle(*new QProxyStylePrivate()) +{ + Q_D(QProxyStyle); + if (style) { + style->setProxy(this); + style->setParent(this); // Take ownership + d->baseStyle = style; + } +} + +/*! + Destroys the QProxyStyle object. +*/ +QProxyStyle::~QProxyStyle() +{ +} + +/*! + Returns the proxy base style object. If no base style + is set on the proxy style, QProxyStyle will create + an instance of the application style instead. + + \sa setBaseStyle(), QStyle +*/ +QStyle *QProxyStyle::baseStyle() const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle; +} + +/*! + Sets the base style that should be proxied. + + Ownership of \style is transferred to QProxyStyle. + + If style is zero, a desktop-dependant style will be + assigned automatically. +*/ +void QProxyStyle::setBaseStyle(QStyle *style) +{ + Q_D (QProxyStyle); + + if (d->baseStyle && d->baseStyle->parent() == this) + d->baseStyle->deleteLater(); + + d->baseStyle = style; + + if (d->baseStyle) { + d->baseStyle->setProxy(this); + d->baseStyle->setParent(this); + } +} + +/*! reimp */ +void QProxyStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + d->baseStyle->drawPrimitive(element, option, painter, widget); +} + +/*! reimp */ +void QProxyStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + d->baseStyle->drawControl(element, option, painter, widget); +} + +/*! reimp */ +void QProxyStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + d->baseStyle->drawComplexControl(control, option, painter, widget); +} + +/*! reimp */ +void QProxyStyle::drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, + const QString &text, QPalette::ColorRole textRole) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + d->baseStyle->drawItemText(painter, rect, flags, pal, enabled, text, textRole); +} + +/*! reimp */ +void QProxyStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + d->baseStyle->drawItemPixmap(painter, rect, alignment, pixmap); +} + +/*! reimp */ +QSize QProxyStyle::sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->sizeFromContents(type, option, size, widget); +} + +/*! reimp */ +QRect QProxyStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->subElementRect(element, option, widget); +} + +/*! reimp */ +QRect QProxyStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *option, SubControl sc, const QWidget *widget) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->subControlRect(cc, option, sc, widget); +} + +/*! reimp */ +QRect QProxyStyle::itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->itemTextRect(fm, r, flags, enabled, text); +} + +/*! reimp */ +QRect QProxyStyle::itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->itemPixmapRect(r, flags, pixmap); +} + +/*! reimp */ +QStyle::SubControl QProxyStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->hitTestComplexControl(control, option, pos, widget); +} + +/*! reimp */ +int QProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->styleHint(hint, option, widget, returnData); +} + +/*! reimp */ +int QProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->pixelMetric(metric, option, widget); +} + +/*! reimp */ +QPixmap QProxyStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->standardPixmap(standardPixmap, opt, widget); +} + +/*! reimp */ +QPixmap QProxyStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->generatedIconPixmap(iconMode, pixmap, opt); +} + +/*! reimp */ +QPalette QProxyStyle::standardPalette() const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->standardPalette(); +} + +/*! reimp */ +void QProxyStyle::polish(QWidget *widget) +{ + Q_D (QProxyStyle); + d->ensureBaseStyle(); + d->baseStyle->polish(widget); +} + +/*! reimp */ +void QProxyStyle::polish(QPalette &pal) +{ + Q_D (QProxyStyle); + d->ensureBaseStyle(); + d->baseStyle->polish(pal); +} + +/*! reimp */ +void QProxyStyle::polish(QApplication *app) +{ + Q_D (QProxyStyle); + d->ensureBaseStyle(); + d->baseStyle->polish(app); +} + +/*! reimp */ +void QProxyStyle::unpolish(QWidget *widget) +{ + Q_D (QProxyStyle); + d->ensureBaseStyle(); + d->baseStyle->unpolish(widget); +} + +/*! reimp */ +void QProxyStyle::unpolish(QApplication *app) +{ + Q_D (QProxyStyle); + d->ensureBaseStyle(); + d->baseStyle->unpolish(app); +} + +/*! reimp */ +bool QProxyStyle::event(QEvent *e) +{ + Q_D (QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->event(e); +} + +/*! reimp */ +QIcon QProxyStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->standardIcon(standardIcon, option, widget); +} + +/*! reimp */ +int QProxyStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, + Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const +{ + Q_D (const QProxyStyle); + d->ensureBaseStyle(); + return d->baseStyle->layoutSpacing(control1, control2, orientation, option, widget); +} + +QT_END_NAMESPACE + +#endif // QT_NO_STYLE_PROXY diff --git a/src/gui/styles/qproxystyle.h b/src/gui/styles/qproxystyle.h new file mode 100644 index 0000000..76b0768 --- /dev/null +++ b/src/gui/styles/qproxystyle.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPROXYSTYLE_H +#define QPROXYSTYLE_H + +#include <QtGui/QCommonStyle> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if !defined(QT_NO_STYLE_PROXY) + +class QProxyStylePrivate; +class Q_GUI_EXPORT QProxyStyle : public QCommonStyle +{ + Q_OBJECT + +public: + QProxyStyle(QStyle *baseStyle = 0); + ~QProxyStyle(); + + QStyle *baseStyle() const; + void setBaseStyle(QStyle *style); + + void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; + void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; + void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const; + void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, + const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; + virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const; + + QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const; + + QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const; + QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const; + QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const; + QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const; + + SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget = 0) const; + int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const; + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; + + QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const; + QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const; + QPalette standardPalette() const; + + void polish(QWidget *widget); + void polish(QPalette &pal); + void polish(QApplication *app); + + void unpolish(QWidget *widget); + void unpolish(QApplication *app); + +protected: + bool event(QEvent *e); + +protected Q_SLOTS: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const; + int layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, + Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const; +private: + Q_DISABLE_COPY(QProxyStyle) + Q_DECLARE_PRIVATE(QProxyStyle) +}; + +#endif // QT_NO_STYLE_PROXY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPROXYSTYLE_H diff --git a/src/gui/styles/qproxystyle_p.h b/src/gui/styles/qproxystyle_p.h new file mode 100644 index 0000000..e7630d9 --- /dev/null +++ b/src/gui/styles/qproxystyle_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPROXYSTYLE_P_H +#define QPROXYSTYLE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#include "qcommonstyle.h" +#include "qcommonstyle_p.h" +#include "qproxystyle.h" + +#ifndef QT_NO_STYLE_PROXY + +QT_BEGIN_NAMESPACE + +class QProxyStylePrivate : public QCommonStylePrivate +{ + Q_DECLARE_PUBLIC(QProxyStyle) +public: + void ensureBaseStyle() const; +private: + QProxyStylePrivate() : + QCommonStylePrivate(), baseStyle(0) {} + mutable QPointer <QStyle> baseStyle; +}; + +QT_END_NAMESPACE + +#endif // QT_NO_STYLE_PROXY + +#endif //QPROXYSTYLE_P_H diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp index 3fab682..c0fdc83 100644 --- a/src/gui/styles/qstyle.cpp +++ b/src/gui/styles/qstyle.cpp @@ -325,9 +325,10 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C QStyle::QStyle() : QObject(*new QStylePrivate) { + Q_D(QStyle); + d->proxyStyle = this; } - /*! \internal @@ -336,6 +337,8 @@ QStyle::QStyle() QStyle::QStyle(QStylePrivate &dd) : QObject(dd) { + Q_D(QStyle); + d->proxyStyle = this; } /*! @@ -2444,4 +2447,33 @@ QDebug operator<<(QDebug debug, QStyle::State state) } #endif +/*! + \since 4.6 + + \fn const QStyle * proxy() const + + This function returns the current proxy for this style. + By default most styles will return themselves. However + when a proxy style is in use, it will allow the style to + call back into its proxy. + + \sa setProxyStyle +*/ +const QStyle * QStyle::proxy() const +{ + Q_D(const QStyle); + return d->proxyStyle; +} + +/* \internal + + This function sets the base style that style calls will be + redirected to. Note that ownership is not transferred. +*/ +void QStyle::setProxy(QStyle *style) +{ + Q_D(QStyle); + d->proxyStyle = style; +} + QT_END_NAMESPACE diff --git a/src/gui/styles/qstyle.h b/src/gui/styles/qstyle.h index cc92459..eec3326 100644 --- a/src/gui/styles/qstyle.h +++ b/src/gui/styles/qstyle.h @@ -848,6 +848,8 @@ public: QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, QStyleOption *option = 0, QWidget *widget = 0) const; + const QStyle * proxy() const; + protected Q_SLOTS: QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0, const QWidget *widget = 0) const; @@ -862,6 +864,9 @@ private: friend class QWidget; friend class QWidgetPrivate; friend class QApplication; + friend class QProxyStyle; + friend class QProxyStylePrivate; + void setProxy(QStyle *style); }; Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State) diff --git a/src/gui/styles/qstyle_p.h b/src/gui/styles/qstyle_p.h index 154321a..4cf20f0 100644 --- a/src/gui/styles/qstyle_p.h +++ b/src/gui/styles/qstyle_p.h @@ -43,6 +43,7 @@ #define QSTYLE_P_H #include "private/qobject_p.h" +#include <QtGui/qstyle.h> QT_BEGIN_NAMESPACE @@ -51,22 +52,24 @@ QT_BEGIN_NAMESPACE // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. +// of qstyle_*.cpp. This header file may change from version to version +// without notice, or even be removed. // // We mean it. // // Private class +class QStyle; + class QStylePrivate: public QObjectPrivate { - Q_DECLARE_PUBLIC(QStyle) + Q_DECLARE_PUBLIC(QStyle); public: inline QStylePrivate() - : layoutSpacingIndex(-1) - { } + : layoutSpacingIndex(-1), proxyStyle(0) {} mutable int layoutSpacingIndex; + QStyle *proxyStyle; }; @@ -89,6 +92,7 @@ public: } + #define END_STYLE_PIXMAPCACHE \ if (doPixmapCache) { \ p->end(); \ diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index bf3a3cb..c816907 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -304,7 +304,7 @@ void QWindowsStyle::polish(QApplication *app) QCommonStyle::polish(app); QWindowsStylePrivate *d = const_cast<QWindowsStylePrivate*>(d_func()); // We only need the overhead when shortcuts are sometimes hidden - if (!styleHint(SH_UnderlineShortcut, 0) && app) + if (!proxy()->styleHint(SH_UnderlineShortcut, 0) && app) app->installEventFilter(this); d->activeCaptionColor = app->palette().highlight().color(); @@ -427,7 +427,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW int thick = 6; // Magic constant to get 5 + 16 + 5 if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks) - thick += pixelMetric(PM_SliderLength, sl, widget) / 4; + thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4; space -= thick; if (space > 0) @@ -461,7 +461,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW break; case PM_IconViewIconSize: - ret = pixelMetric(PM_LargeIconSize, opt, widget); + ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget); break; case PM_ToolBarIconSize: @@ -1423,8 +1423,8 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, int bsy = 0; if (opt->state & State_Sunken) { - bsx = pixelMetric(PM_ButtonShiftHorizontal, opt, w); - bsy = pixelMetric(PM_ButtonShiftVertical, opt, w); + bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, w); + bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt, w); } QRect bounds = a.boundingRect(); @@ -1513,7 +1513,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, case PE_FrameFocusRect: if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) { //### check for d->alt_down - if (!(fropt->state & State_KeyboardFocusChange) && !styleHint(SH_UnderlineShortcut, opt)) + if (!(fropt->state & State_KeyboardFocusChange) && !proxy()->styleHint(SH_UnderlineShortcut, opt)) return; QRect r = opt->rect; p->save(); @@ -1580,8 +1580,8 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, //center when rect is larger than indicator size int xOffset = 0; int yOffset = 0; - int indicatorWidth = pixelMetric(PM_ExclusiveIndicatorWidth); - int indicatorHeight = pixelMetric(PM_ExclusiveIndicatorWidth); + int indicatorWidth = proxy()->pixelMetric(PM_ExclusiveIndicatorWidth); + int indicatorHeight = proxy()->pixelMetric(PM_ExclusiveIndicatorWidth); if (ir.width() > indicatorWidth) xOffset += (ir.width() - indicatorWidth)/2; if (ir.height() > indicatorHeight) @@ -1738,7 +1738,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, break; } case PE_FrameDockWidget: if (qstyleoption_cast<const QStyleOptionFrame *>(opt)) { - drawPrimitive(QStyle::PE_FrameWindow, opt, p, w); + proxy()->drawPrimitive(QStyle::PE_FrameWindow, opt, p, w); } break; #endif // QT_NO_DOCKWIDGET @@ -1757,7 +1757,7 @@ case PE_FrameDockWidget: } int space = 2; - int chunksize = pixelMetric(PM_ProgressBarChunkWidth, opt, w) - space; + int chunksize = proxy()->pixelMetric(PM_ProgressBarChunkWidth, opt, w) - space; if (!vertical) { if (opt->rect.width() <= chunksize) space = 0; @@ -1816,7 +1816,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->save(); QRect r = opt->rect; QStyleHintReturnMask mask; - if (styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask)) + if (proxy()->styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask)) p->setClipRegion(mask.region); p->drawTiledPixmap(r.x(), r.y(), r.width(), r.height(), tiledPixmap); p->restore(); @@ -1885,9 +1885,9 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai mode = QIcon::Active; QPixmap pixmap; if (checked) - pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, opt, widget), mode, QIcon::On); + pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode, QIcon::On); else - pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, opt, widget), mode); + pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode); int pixw = pixmap.width(); int pixh = pixmap.height(); if (act && !dis && !checked) @@ -1906,7 +1906,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai newMi.state |= State_On; newMi.rect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x() + windowsItemFrame, menuitem->rect.y() + windowsItemFrame, checkcol - 2 * windowsItemFrame, menuitem->rect.height() - 2*windowsItemFrame)); - drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget); + proxy()->drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget); } p->setPen(act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color()); @@ -1925,13 +1925,13 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->save(); int t = s.indexOf(QLatin1Char('\t')); int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; - if (!styleHint(SH_UnderlineShortcut, menuitem, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget)) text_flags |= Qt::TextHideMnemonic; text_flags |= Qt::AlignLeft; if (t >= 0) { QRect vShortcutRect = visualRect(opt->direction, menuitem->rect, QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom()))); - if (dis && !act && styleHint(SH_EtchDisabledText, opt, widget)) { + if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) { p->setPen(menuitem->palette.light().color()); p->drawText(vShortcutRect.adjusted(1,1,1,1), text_flags, s.mid(t + 1)); p->setPen(discol); @@ -1943,7 +1943,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) font.setBold(true); p->setFont(font); - if (dis && !act && styleHint(SH_EtchDisabledText, opt, widget)) { + if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) { p->setPen(menuitem->palette.light().color()); p->drawText(vTextRect.adjusted(1,1,1,1), text_flags, s.left(t)); p->setPen(discol); @@ -1963,7 +1963,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai if (act) newMI.palette.setColor(QPalette::ButtonText, newMI.palette.highlightedText().color()); - drawPrimitive(arrow, &newMI, p, widget); + proxy()->drawPrimitive(arrow, &newMI, p, widget); } } @@ -1985,8 +1985,8 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai qDrawShadeRect(p, mbi->rect.x(), mbi->rect.y(), mbi->rect.width(), mbi->rect.height(), mbi->palette, active && down, 1, 0, &b); if (active && down) { - newMbi.rect.translate(pixelMetric(PM_ButtonShiftHorizontal, mbi, widget), - pixelMetric(PM_ButtonShiftVertical, mbi, widget)); + newMbi.rect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, mbi, widget), + proxy()->pixelMetric(PM_ButtonShiftVertical, mbi, widget)); p->setBrushOrigin(p->brushOrigin() - QPoint(1, 1)); } } @@ -2020,7 +2020,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai || (rtlHorTabs && tab->selectedPosition == QStyleOptionTab::PreviousIsSelected)); - int tabBarAlignment = styleHint(SH_TabBar_Alignment, tab, widget); + int tabBarAlignment = proxy()->styleHint(SH_TabBar_Alignment, tab, widget); bool leftAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignLeft) || (rtlHorTabs && tabBarAlignment == Qt::AlignRight); @@ -2034,7 +2034,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai QColor dark = tab->palette.dark().color(); QColor shadow = tab->palette.shadow().color(); QColor background = tab->palette.background().color(); - int borderThinkness = pixelMetric(PM_TabBarBaseOverlap, tab, widget); + int borderThinkness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget); if (selected) borderThinkness /= 2; QRect r2(opt->rect); @@ -2266,7 +2266,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai } QStyleOption arrowOpt = *opt; arrowOpt.rect = opt->rect.adjusted(4, 4, -4, -4); - drawPrimitive(arrow, &arrowOpt, p, widget); + proxy()->drawPrimitive(arrow, &arrowOpt, p, widget); break; } case CE_ScrollBarAddPage: case CE_ScrollBarSubPage: { @@ -2452,7 +2452,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai int w = rect.width(); if (pb->minimum == 0 && pb->maximum == 0) { Q_D(const QWindowsStyle); - const int unit_width = pixelMetric(PM_ProgressBarChunkWidth, pb, widget); + const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, pb, widget); QStyleOptionProgressBarV2 pbBits = *pb; Q_ASSERT(unit_width >0); @@ -2476,7 +2476,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai for (int i = 0; i < chunksToDraw ; ++i) { pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight); pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect(); - drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget); + proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget); x += reverse ? -unit_width : unit_width; } //Draw wrap-around chunks @@ -2487,7 +2487,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai for (int i = 0; i < chunksToDraw ; ++i) { pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight); pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect(); - drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget); + proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget); x += reverse ? -unit_width : unit_width; } } @@ -2575,7 +2575,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai r.top() + titleRect.left() - rect.left(), titleRect.height(), titleRect.width()); } - drawItemText(p, titleRect, + proxy()->drawItemText(p, titleRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, palette, dwOpt->state & State_Enabled, dwOpt->title, floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText); @@ -2605,7 +2605,7 @@ QRect QWindowsStyle::subElementRect(SubElement sr, const QStyleOption *opt, cons const QStyleOptionDockWidgetV2 *v2 = qstyleoption_cast<const QStyleOptionDockWidgetV2*>(opt); bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar; - int m = pixelMetric(PM_DockWidgetTitleMargin, opt, w); + int m = proxy()->pixelMetric(PM_DockWidgetTitleMargin, opt, w); if (verticalTitleBar) { r.adjust(0, 0, 0, -m); } else { @@ -2639,11 +2639,11 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp #ifndef QT_NO_SLIDER case CC_Slider: if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { - int thickness = pixelMetric(PM_SliderControlThickness, slider, widget); - int len = pixelMetric(PM_SliderLength, slider, widget); + int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); + int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); int ticks = slider->tickPosition; - QRect groove = subControlRect(CC_Slider, slider, SC_SliderGroove, widget); - QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, widget); + QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget); + QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget); if ((slider->subControls & SC_SliderGroove) && groove.isValid()) { int mid = thickness / 2; @@ -2714,7 +2714,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*slider); fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); } if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) { @@ -3037,7 +3037,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp if (cmb->subControls & SC_ComboBoxArrow) { State flags = State_None; - QRect ar = subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget); + QRect ar = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget); bool sunkenArrow = cmb->activeSubControls == SC_ComboBoxArrow && cmb->state & State_Sunken; if (sunkenArrow) { @@ -3063,11 +3063,11 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp arrowOpt.rect = ar.adjusted(1, 1, -1, -1); arrowOpt.palette = cmb->palette; arrowOpt.state = flags; - drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget); } if (cmb->subControls & SC_ComboBoxEditField) { - QRect re = subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget); + QRect re = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget); if (cmb->state & State_HasFocus && !cmb->editable) p->fillRect(re.x(), re.y(), re.width(), re.height(), cmb->palette.brush(QPalette::Highlight)); @@ -3087,7 +3087,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp focus.rect = subElementRect(SE_ComboBoxFocusRect, cmb, widget); focus.state |= State_FocusAtBorder; focus.backgroundColor = cmb->palette.highlight().color(); - drawPrimitive(PE_FrameFocusRect, &focus, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &focus, p, widget); } } } @@ -3101,7 +3101,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp bool enabled = opt->state & State_Enabled; if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) { QBrush editBrush = sb->palette.brush(QPalette::Base); - QRect r = subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget); + QRect r = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget); QPalette shadePal = sb->palette; if (use2000style) shadePal.setColor(QPalette::Midlight, shadePal.button().color()); @@ -3132,7 +3132,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus : PE_IndicatorSpinUp); - copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); + copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On), ©.palette.brush(QPalette::Button)); copy.rect.adjust(4, 1, -5, -1); @@ -3140,9 +3140,9 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp QStyleOptionSpinBox lightCopy = copy; lightCopy.rect.adjust(1, 1, 1, 1); lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light()); - drawPrimitive(pe, &lightCopy, p, widget); + proxy()->drawPrimitive(pe, &lightCopy, p, widget); } - drawPrimitive(pe, ©, p, widget); + proxy()->drawPrimitive(pe, ©, p, widget); } if (sb->subControls & SC_SpinBoxDown) { @@ -3165,7 +3165,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus : PE_IndicatorSpinDown); - copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); + copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On), ©.palette.brush(QPalette::Button)); copy.rect.adjust(4, 0, -5, -1); @@ -3173,9 +3173,9 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp QStyleOptionSpinBox lightCopy = copy; lightCopy.rect.adjust(1, 1, 1, 1); lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light()); - drawPrimitive(pe, &lightCopy, p, widget); + proxy()->drawPrimitive(pe, &lightCopy, p, widget); } - drawPrimitive(pe, ©, p, widget); + proxy()->drawPrimitive(pe, ©, p, widget); } } break; @@ -3199,7 +3199,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, h = sz.height(); int defwidth = 0; if (btn->features & QStyleOptionButton::AutoDefaultButton) - defwidth = 2 * pixelMetric(PM_ButtonDefaultIndicator, btn, widget); + defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); #ifndef QT_QWS_SMALL_PUSHBUTTON if (w < 75 + defwidth && !btn->text.isEmpty()) w = 75 + defwidth; @@ -3224,7 +3224,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, } if (mi->menuItemType != QStyleOptionMenuItem::Separator && !mi->icon.isNull()) { - int iconExtent = pixelMetric(PM_SmallIconSize, opt, widget); + int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); sz.setHeight(qMax(sz.height(), mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 2 * windowsItemFrame)); @@ -3384,7 +3384,7 @@ QIcon QWindowsStyle::standardIconImplementation(StandardPixmap standardIcon, con && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based && pSHGetStockIconInfo) { - icon.addPixmap(standardPixmap(SP_VistaShield, option, widget)); //fetches small icon + icon.addPixmap(proxy()->standardPixmap(SP_VistaShield, option, widget)); //fetches small icon QSHSTOCKICONINFO iconInfo; //append large icon memset(&iconInfo, 0, sizeof(iconInfo)); iconInfo.cbSize = sizeof(iconInfo); diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index 9ea9a03..be76b24 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -403,7 +403,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt // pulsating default button into the intended target state. if (!anim) - drawPrimitive(element, &opt, &startPainter, 0); // Note that the widget pointer is intentionally 0 + proxy()->drawPrimitive(element, &opt, &startPainter, 0); // Note that the widget pointer is intentionally 0 else // this ensures that we do not recurse in the animation logic above anim->paint(&startPainter, &opt); @@ -417,7 +417,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt endImage.fill(0); QStyleOption opt2 = opt; opt2.state = option->state; - drawPrimitive(element, &opt2, &endPainter, 0); // Note that the widget pointer is intentionally 0 + proxy()->drawPrimitive(element, &opt2, &endPainter, 0); // Note that the widget pointer is intentionally 0 // this ensures that we do not recurse in the animation logic above t->setEndImage(endImage); @@ -645,7 +645,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt } } if (panel->lineWidth > 0) - drawPrimitive(PE_FrameLineEdit, panel, painter, widget); + proxy()->drawPrimitive(PE_FrameLineEdit, panel, painter, widget); return; } break; @@ -934,7 +934,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption QPainter startPainter(&startImage); if (!anim) { - drawControl(element, &opt, &startPainter, 0 /* Intentional */); + proxy()->drawControl(element, &opt, &startPainter, 0 /* Intentional */); } else { anim->paint(&startPainter, &opt); d->stopAnimation(widget); @@ -945,7 +945,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption endImage.fill(0); QPainter endPainter(&endImage); - drawControl(element, option, &endPainter, 0 /* Intentional */); + proxy()->drawControl(element, option, &endPainter, 0 /* Intentional */); t->setEndImage(endImage); int duration = 0; HTHEME theme = pOpenThemeData(0, L"Button"); @@ -1049,7 +1049,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption newBtn.rect = QStyle::visualRect(option->direction, option->rect, QRect(ir.right() - mbiw - 2, (option->rect.height()/2) - (mbih/2), mbiw + 1, mbih + 1)); - drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget); } return; } @@ -1197,10 +1197,10 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption break; QPalette::ColorRole textRole = disabled ? QPalette::Text : QPalette::ButtonText; - QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal); + QPixmap pix = mbi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal); uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; - if (!styleHint(SH_UnderlineShortcut, mbi, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget)) alignment |= Qt::TextHideMnemonic; //The rect adjustment is a workaround for the menu not really filling its background. @@ -1292,9 +1292,9 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption mode = QIcon::Active; QPixmap pixmap; if (checked) - pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On); + pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On); else - pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), mode); + pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode); int pixw = pixmap.width(); int pixh = pixmap.height(); QRect pmr(0, 0, pixw, pixh); @@ -1320,7 +1320,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption painter->save(); int t = s.indexOf(QLatin1Char('\t')); int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; - if (!styleHint(SH_UnderlineShortcut, menuitem, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget)) text_flags |= Qt::TextHideMnemonic; text_flags |= Qt::AlignLeft; if (t >= 0) { @@ -1346,7 +1346,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption QStyleOptionMenuItem newMI = *menuitem; newMI.rect = vSubMenuRect; newMI.state = dis ? State_None : State_Enabled; - drawPrimitive(arrow, &newMI, painter, widget); + proxy()->drawPrimitive(arrow, &newMI, painter, widget); } } break; @@ -1416,8 +1416,8 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption painter->drawRect(rect.adjusted(0, 1, -1, -3)); int buttonMargin = 4; - int mw = pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, widget); - int fw = pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget); + int mw = proxy()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, widget); + int fw = proxy()->pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget); const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget); bool isFloating = dw != 0 && dw->isFloating(); @@ -1556,7 +1556,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle if (qstyleoption_cast<const QStyleOptionSlider *>(option)) { QRect oldSliderPos = w->property("_q_stylesliderpos").toRect(); - QRect currentPos = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); + QRect currentPos = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); w->setProperty("_q_stylesliderpos", currentPos); if (oldSliderPos != currentPos) { doTransition = false; @@ -1587,7 +1587,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle QStyleOptionComboBox startCombo = *combo; startCombo.state = (QStyle::State)oldState; startCombo.activeSubControls = (QStyle::SubControl)oldActiveControls; - drawComplexControl(control, &startCombo, &startPainter, 0 /* Intentional */); + proxy()->drawComplexControl(control, &startCombo, &startPainter, 0 /* Intentional */); t->setStartImage(startImage); } else if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option)) { //This is a workaround for the direct3d engine as it currently has some issues with grabWindow @@ -1596,7 +1596,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle QStyleOptionSlider startSlider = *slider; startSlider.state = (QStyle::State)oldState; startSlider.activeSubControls = (QStyle::SubControl)oldActiveControls; - drawComplexControl(control, &startSlider, &startPainter, 0 /* Intentional */); + proxy()->drawComplexControl(control, &startSlider, &startPainter, 0 /* Intentional */); t->setStartImage(startImage); } else { QPoint offset(0, 0); @@ -1614,7 +1614,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle d->startAnimation(t); endImage.fill(0); QPainter endPainter(&endImage); - drawComplexControl(control, option, &endPainter, 0 /* Intentional */); + proxy()->drawComplexControl(control, option, &endPainter, 0 /* Intentional */); t->setEndImage(endImage); t->setStartTime(QTime::currentTime()); @@ -1653,9 +1653,9 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle d->drawBackground(theme); } if (sub & SC_ComboBoxArrow) { - QRect subRect = subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget); + QRect subRect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget); XPThemeData theme(widget, painter, QLatin1String("COMBOBOX")); - theme.rect = subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget); + theme.rect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget); partId = option->direction == Qt::RightToLeft ? CP_DROPDOWNBUTTONLEFT : CP_DROPDOWNBUTTONRIGHT; if (!(cmb->state & State_Enabled)) @@ -1679,7 +1679,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle btn.rect = option->rect.adjusted(-1, -1, 1, 1); if (sub & SC_ComboBoxArrow) btn.features = QStyleOptionButton::HasMenu; - drawControl(QStyle::CE_PushButton, &btn, painter, widget); + proxy()->drawControl(QStyle::CE_PushButton, &btn, painter, widget); } } } @@ -1696,7 +1696,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle bool isHorz = flags & State_Horizontal; bool isRTL = option->direction == Qt::RightToLeft; if (sub & SC_ScrollBarAddLine) { - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget); partId = SBP_ARROWBTN; if (!(flags & State_Enabled)) stateId = (isHorz ? (isRTL ? ABS_LEFTDISABLED : ABS_RIGHTDISABLED) : ABS_DOWNDISABLED); @@ -1713,7 +1713,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle d->drawBackground(theme); } if (sub & SC_ScrollBarSubLine) { - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget); partId = SBP_ARROWBTN; if (!(flags & State_Enabled)) stateId = (isHorz ? (isRTL ? ABS_RIGHTDISABLED : ABS_LEFTDISABLED) : ABS_UPDISABLED); @@ -1730,9 +1730,9 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle d->drawBackground(theme); } if (maxedOut) { - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); - theme.rect = theme.rect.united(subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget)); - theme.rect = theme.rect.united(subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget)); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); + theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget)); + theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget)); partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT; stateId = SCRBS_DISABLED; theme.partId = partId; @@ -1740,7 +1740,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle d->drawBackground(theme); } else { if (sub & SC_ScrollBarSubPage) { - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget); partId = flags & State_Horizontal ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT; if (!(flags & State_Enabled)) stateId = SCRBS_DISABLED; @@ -1755,7 +1755,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle d->drawBackground(theme); } if (sub & SC_ScrollBarAddPage) { - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget); partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT; if (!(flags & State_Enabled)) stateId = SCRBS_DISABLED; @@ -1770,7 +1770,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle d->drawBackground(theme); } if (sub & SC_ScrollBarSlider) { - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); if (!(flags & State_Enabled)) stateId = SCRBS_DISABLED; else if (scrollbar->activeSubControls & SC_ScrollBarSlider && (scrollbar->state & State_Sunken)) @@ -1783,7 +1783,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle stateId = SCRBS_NORMAL; // Draw handle - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); theme.partId = flags & State_Horizontal ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT; theme.stateId = stateId; d->drawBackground(theme); @@ -1851,7 +1851,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle d->drawBackground(ftheme); } if (sub & SC_SpinBoxUp) { - theme.rect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget).adjusted(0, 0, 0, 1); + theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget).adjusted(0, 0, 0, 1); partId = SPNP_UP; if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) || !(flags & State_Enabled)) stateId = UPS_DISABLED; @@ -1866,7 +1866,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle d->drawBackground(theme); } if (sub & SC_SpinBoxDown) { - theme.rect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget); + theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget); partId = SPNP_DOWN; if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) || !(flags & State_Enabled)) stateId = DNS_DISABLED; @@ -1947,7 +1947,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption { //Spinbox adds frame twice sz = QWindowsStyle::sizeFromContents(type, option, size, widget); - int border = pixelMetric(PM_SpinBoxFrameWidth, option, widget); + int border = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget); sz -= QSize(2*border, 2*border); } return sz; @@ -1985,7 +1985,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption else stateId = PBS_NORMAL; - int border = pixelMetric(PM_DefaultFrameWidth, btn, widget); + int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget); rect = option->rect.adjusted(border, border, -border, -border); int result = pGetThemeMargins(theme, @@ -2012,7 +2012,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption int w = option->rect.width(); int x = option->rect.x(); int y = option->rect.y(); - int margin = pixelMetric(QStyle::PM_HeaderMargin, option, widget); + int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, option, widget); XPThemeData theme(widget, 0, QLatin1String("HEADER"), HP_HEADERSORTARROW, HSAS_SORTEDDOWN, option->rect); @@ -2038,7 +2038,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption case SE_HeaderLabel: { - int margin = pixelMetric(QStyle::PM_HeaderMargin, option, widget); + int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, option, widget); QRect r = option->rect; r.setRect(option->rect.x() + margin, option->rect.y() + margin, option->rect.width() - margin * 2, option->rect.height() - margin * 2); @@ -2214,7 +2214,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt const int width = tb->rect.width(); int buttonWidth = GetSystemMetrics(SM_CXSIZE) - 4; - const int frameWidth = pixelMetric(PM_MdiSubWindowFrameWidth, option, widget); + const int frameWidth = proxy()->pixelMetric(PM_MdiSubWindowFrameWidth, option, widget); const bool sysmenuHint = (tb->titleBarFlags & Qt::WindowSystemMenuHint) != 0; const bool minimizeHint = (tb->titleBarFlags & Qt::WindowMinimizeButtonHint) != 0; const bool maximizeHint = (tb->titleBarFlags & Qt::WindowMaximizeButtonHint) != 0; @@ -2251,7 +2251,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt { const int controlTop = 6; const int controlHeight = height - controlTop - 3; - int iconExtent = pixelMetric(PM_SmallIconSize); + int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); QSize iconSize = tb->icon.actualSize(QSize(iconExtent, iconExtent)); if (tb->icon.isNull()) iconSize = QSize(controlHeight, controlHeight); diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index b5dfdbd..c8a4441 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -1026,7 +1026,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa Most of the functions are documented in the base classes QWindowsStyle, QCommonStyle, and QStyle, but the QWindowsXPStyle overloads of drawComplexControl(), drawControl(), - drawControlMask(), drawPrimitive(), subControlRect(), and + drawControlMask(), drawPrimitive(), proxy()->subControlRect(), and sizeFromContents(), are documented here. \img qwindowsxpstyle.png @@ -1193,8 +1193,8 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option, QStyleOptionTab otherOption; otherOption.shape = (twfOption->shape == QTabBar::RoundedNorth ? QTabBar::RoundedEast : QTabBar::RoundedSouth); - int overlap = pixelMetric(PM_TabBarBaseOverlap, &otherOption, widget); - int borderThickness = pixelMetric(PM_DefaultFrameWidth, option, widget); + int overlap = proxy()->pixelMetric(PM_TabBarBaseOverlap, &otherOption, widget); + int borderThickness = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); rect.adjust(-overlap + borderThickness, 0, -overlap + borderThickness, 0); } break;} @@ -1217,7 +1217,7 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option, else stateId = PBS_NORMAL; - int border = pixelMetric(PM_DefaultFrameWidth, btn, widget); + int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget); rect = option->rect.adjusted(border, border, -border, -border); int result = pGetThemeMargins(theme, @@ -1533,7 +1533,7 @@ case PE_Frame: } if (panel->lineWidth > 0) - drawPrimitive(PE_FrameLineEdit, panel, p, widget); + proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget); return; } break; @@ -1618,7 +1618,7 @@ case PE_Frame: else stateId = FS_INACTIVE; - int fwidth = pixelMetric(PM_DockWidgetFrameWidth, frm, widget); + int fwidth = proxy()->pixelMetric(PM_DockWidgetFrameWidth, frm, widget); XPThemeData theme(widget, p, name, 0, stateId); if (!theme.isValid()) @@ -1826,7 +1826,7 @@ case PE_Frame: QStyleOptionButton button; button.QStyleOption::operator=(*option); button.state &= ~State_MouseOver; - drawPrimitive(PE_IndicatorCheckBox, &button, p, widget); + proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, p, widget); return; } @@ -1954,7 +1954,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op QRect ir = btn->rect; QStyleOptionButton newBtn = *btn; newBtn.rect = QRect(ir.right() - mbiw - 1, 1 + (ir.height()/2) - (mbih/2), mbiw, mbih); - drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); } return; } @@ -1977,10 +1977,10 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op bool lastTab = tab->position == QStyleOptionTab::End; bool firstTab = tab->position == QStyleOptionTab::Beginning; bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab; - bool leftAligned = styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignLeft; - bool centerAligned = styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignCenter; - int borderThickness = pixelMetric(PM_DefaultFrameWidth, option, widget); - int tabOverlap = pixelMetric(PM_TabBarTabOverlap, option, widget); + bool leftAligned = proxy()->styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignLeft; + bool centerAligned = proxy()->styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignCenter; + int borderThickness = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); + int tabOverlap = proxy()->pixelMetric(PM_TabBarTabOverlap, option, widget); if (isDisabled) stateId = TIS_DISABLED; @@ -2125,8 +2125,8 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op if (act && !dis) mode = QIcon::Active; QPixmap pixmap = checked ? - menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On) : - menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), mode); + menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On) : + menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode); int pixw = pixmap.width(); int pixh = pixmap.height(); QRect iconRect(0, 0, pixw, pixh); @@ -2152,7 +2152,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op checkcol - 2 * windowsItemFrame, menuitem->rect.height() - 2*windowsItemFrame); newMi.rect = visualRect(option->direction, option->rect, checkMarkRect); - drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget); + proxy()->drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget); } QColor textColor = dis ? menuitem->palette.text().color() : @@ -2169,12 +2169,12 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op p->save(); int t = s.indexOf(QLatin1Char('\t')); int text_flags = Qt::AlignVCenter|Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine | Qt::AlignLeft; - if (!styleHint(SH_UnderlineShortcut, menuitem, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget)) text_flags |= Qt::TextHideMnemonic; // draw tab text ---------------- if (t >= 0) { QRect vShortcutRect = visualRect(option->direction, option->rect, QRect(textRect.topRight(), menuitem->rect.bottomRight())); - if (dis && !act && styleHint(SH_EtchDisabledText, option, widget)) { + if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) { p->setPen(menuitem->palette.light().color()); p->drawText(vShortcutRect.adjusted(1,1,1,1), text_flags, s.mid(t + 1)); p->setPen(textColor); @@ -2186,7 +2186,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) font.setBold(true); p->setFont(font); - if (dis && !act && styleHint(SH_EtchDisabledText, option, widget)) { + if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) { p->setPen(menuitem->palette.light().color()); p->drawText(vTextRect.adjusted(1,1,1,1), text_flags, s.left(t)); p->setPen(textColor); @@ -2207,7 +2207,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op newMI.state = dis ? State_None : State_Enabled; if (act) newMI.palette.setColor(QPalette::ButtonText, newMI.palette.highlightedText().color()); - drawPrimitive(arrow, &newMI, p, widget); + proxy()->drawPrimitive(arrow, &newMI, p, widget); } } return; @@ -2224,10 +2224,10 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op QBrush fill = mbi->palette.brush(act ? QPalette::Highlight : QPalette::Button); QPalette::ColorRole textRole = dis ? QPalette::Text: act ? QPalette::HighlightedText : QPalette::ButtonText; - QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal); + QPixmap pix = mbi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal); uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; - if (!styleHint(SH_UnderlineShortcut, mbi, widget)) + if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget)) alignment |= Qt::TextHideMnemonic; p->fillRect(rect, fill); @@ -2242,8 +2242,8 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) { int buttonMargin = 4; - int mw = pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, widget); - int fw = pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget); + int mw = proxy()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, widget); + int fw = proxy()->pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget); bool isFloating = widget && widget->isWindow(); bool isActive = dwOpt->state & State_Active; @@ -2264,12 +2264,12 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op QRect titleRect = r; if (dwOpt->closable) { - QSize sz = standardIcon(QStyle::SP_TitleBarCloseButton, dwOpt, widget).actualSize(QSize(10, 10)); + QSize sz = proxy()->standardIcon(QStyle::SP_TitleBarCloseButton, dwOpt, widget).actualSize(QSize(10, 10)); titleRect.adjust(0, 0, -sz.width() - mw - buttonMargin, 0); } if (dwOpt->floatable) { - QSize sz = standardIcon(QStyle::SP_TitleBarMaxButton, dwOpt, widget).actualSize(QSize(10, 10)); + QSize sz = proxy()->standardIcon(QStyle::SP_TitleBarMaxButton, dwOpt, widget).actualSize(QSize(10, 10)); titleRect.adjust(0, 0, -sz.width() - mw - buttonMargin, 0); } @@ -2455,7 +2455,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo d->drawBackground(ftheme); } if (sub & SC_SpinBoxUp) { - theme.rect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget); + theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget); partId = SPNP_UP; if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) || !(flags & State_Enabled)) stateId = UPS_DISABLED; @@ -2470,7 +2470,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo d->drawBackground(theme); } if (sub & SC_SpinBoxDown) { - theme.rect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget); + theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget); partId = SPNP_DOWN; if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) || !(flags & State_Enabled)) stateId = DNS_DISABLED; @@ -2507,7 +2507,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo p->fillRect(option->rect, editBrush); } if (!cmb->editable) { - QRect re = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget); + QRect re = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget); if (option->state & State_HasFocus) { p->fillRect(re, option->palette.highlight()); p->setPen(option->palette.highlightedText().color()); @@ -2522,7 +2522,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo if (sub & SC_ComboBoxArrow) { XPThemeData theme(widget, p, QLatin1String("COMBOBOX")); - theme.rect = subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget); + theme.rect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget); partId = CP_DROPDOWNBUTTON; if (!(flags & State_Enabled)) stateId = CBXS_DISABLED; @@ -2550,7 +2550,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo bool isHorz = flags & State_Horizontal; bool isRTL = option->direction == Qt::RightToLeft; if (sub & SC_ScrollBarAddLine) { - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget); partId = SBP_ARROWBTN; if (!(flags & State_Enabled)) stateId = (isHorz ? (isRTL ? ABS_LEFTDISABLED : ABS_RIGHTDISABLED) : ABS_DOWNDISABLED); @@ -2565,7 +2565,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo d->drawBackground(theme); } if (sub & SC_ScrollBarSubLine) { - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget); partId = SBP_ARROWBTN; if (!(flags & State_Enabled)) stateId = (isHorz ? (isRTL ? ABS_RIGHTDISABLED : ABS_LEFTDISABLED) : ABS_UPDISABLED); @@ -2580,9 +2580,9 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo d->drawBackground(theme); } if (maxedOut) { - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); - theme.rect = theme.rect.united(subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget)); - theme.rect = theme.rect.united(subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget)); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); + theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget)); + theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget)); partId = scrollbar->orientation == Qt::Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT; stateId = SCRBS_DISABLED; theme.partId = partId; @@ -2590,7 +2590,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo d->drawBackground(theme); } else { if (sub & SC_ScrollBarSubPage) { - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget); partId = flags & State_Horizontal ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT; if (!(flags & State_Enabled)) stateId = SCRBS_DISABLED; @@ -2605,7 +2605,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo d->drawBackground(theme); } if (sub & SC_ScrollBarAddPage) { - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget); partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT; if (!(flags & State_Enabled)) stateId = SCRBS_DISABLED; @@ -2620,7 +2620,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo d->drawBackground(theme); } if (sub & SC_ScrollBarSlider) { - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); if (!(flags & State_Enabled)) stateId = SCRBS_DISABLED; else if (scrollbar->activeSubControls & SC_ScrollBarSlider && (scrollbar->state & State_Sunken)) @@ -2631,7 +2631,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo stateId = SCRBS_NORMAL; // Draw handle - theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); + theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget); theme.partId = flags & State_Horizontal ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT; theme.stateId = stateId; d->drawBackground(theme); @@ -2687,7 +2687,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo QRect slrect = slider->rect; QRegion tickreg = slrect; if (sub & SC_SliderGroove) { - theme.rect = subControlRect(CC_Slider, option, SC_SliderGroove, widget); + theme.rect = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); if (slider->orientation == Qt::Horizontal) { partId = TKP_TRACK; stateId = TRS_NORMAL; @@ -2703,11 +2703,11 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo tickreg -= theme.rect; } if (sub & SC_SliderTickmarks) { - int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget); + int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); int ticks = slider->tickPosition; - int thickness = pixelMetric(PM_SliderControlThickness, slider, widget); - int len = pixelMetric(PM_SliderLength, slider, widget); - int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget); + int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); + int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); + int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget); int interval = slider->tickInterval; if (interval <= 0) { interval = slider->singleStep; @@ -2763,7 +2763,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } } if (sub & SC_SliderHandle) { - theme.rect = subControlRect(CC_Slider, option, SC_SliderHandle, widget); + theme.rect = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); if (slider->orientation == Qt::Horizontal) { if (slider->tickPosition == QSlider::TicksAbove) partId = TKP_THUMBTOP; @@ -2809,7 +2809,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo QStyleOptionFocusRect fropt; fropt.QStyleOption::operator=(*slider); fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); } } break; @@ -2819,8 +2819,8 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { QRect button, menuarea; - button = subControlRect(cc, toolbutton, SC_ToolButton, widget); - menuarea = subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget); + button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget); + menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget); State bflags = toolbutton->state & ~State_Sunken; State mflags = bflags; @@ -2868,9 +2868,9 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo tool.state = bflags; if (widget && !qobject_cast<QToolBar*>(widget->parentWidget()) && !(bflags & State_AutoRaise)) - drawPrimitive(PE_PanelButtonBevel, &tool, p, widget); + proxy()->drawPrimitive(PE_PanelButtonBevel, &tool, p, widget); else - drawPrimitive(PE_PanelButtonTool, &tool, p, widget); + proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); } } } @@ -2880,26 +2880,26 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo fr.QStyleOption::operator=(*toolbutton); fr.rect.adjust(3, 3, -3, -3); if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup) - fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator, + fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, toolbutton, widget), 0); - drawPrimitive(PE_FrameFocusRect, &fr, p, widget); + proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget); } QStyleOptionToolButton label = *toolbutton; label.state = bflags; int fw = 2; label.rect = button.adjusted(fw, fw, -fw, -fw); - drawControl(CE_ToolButtonLabel, &label, p, widget); + proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget); if (toolbutton->subControls & SC_ToolButtonMenu) { tool.rect = menuarea; tool.state = mflags; - drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget); + proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget); } else if (toolbutton->features & QStyleOptionToolButton::HasMenu) { - int mbi = pixelMetric(PM_MenuButtonIndicator, toolbutton, widget); + int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget); QRect ir = toolbutton->rect; QStyleOptionToolButton newBtn = *toolbutton; newBtn.rect = QRect(ir.right() + 4 - mbi, ir.height() - mbi + 4, mbi - 5, mbi - 5); - drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); + proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); } } break; @@ -2931,7 +2931,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo theme.stateId = stateId; d->drawBackground(theme); - QRect ir = subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget); + QRect ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget); int result = TST_NONE; pGetThemeEnumValue(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result); @@ -2950,7 +2950,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, tb->text); } if (sub & SC_TitleBarSysMenu && tb->titleBarFlags & Qt::WindowSystemMenuHint) { - theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarSysMenu, widget); + theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarSysMenu, widget); partId = WP_SYSBUTTON; if ((widget && !widget->isEnabled()) || !isActive) stateId = SBS_DISABLED; @@ -2968,8 +2968,8 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo SIZE sz; pGetThemePartSize(theme.handle(), qt_win_display_dc(), theme.partId, theme.stateId, 0, TS_TRUE, &sz); if (sz.cx == 0 || sz.cy == 0) { - int iconSize = pixelMetric(PM_SmallIconSize, tb, widget); - QPixmap pm = standardIcon(SP_TitleBarMenuButton, tb, widget).pixmap(iconSize, iconSize); + int iconSize = proxy()->pixelMetric(PM_SmallIconSize, tb, widget); + QPixmap pm = proxy()->standardIcon(SP_TitleBarMenuButton, tb, widget).pixmap(iconSize, iconSize); p->save(); drawItemPixmap(p, theme.rect, Qt::AlignCenter, pm); p->restore(); @@ -2981,7 +2981,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo if (sub & SC_TitleBarMinButton && tb->titleBarFlags & Qt::WindowMinimizeButtonHint && !(tb->titleBarState & Qt::WindowMinimized)) { - theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarMinButton, widget); + theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarMinButton, widget); partId = WP_MINBUTTON; if (widget && !widget->isEnabled()) stateId = MINBS_DISABLED; @@ -2999,7 +2999,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } if (sub & SC_TitleBarMaxButton && tb->titleBarFlags & Qt::WindowMaximizeButtonHint && !(tb->titleBarState & Qt::WindowMaximized)) { - theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarMaxButton, widget); + theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarMaxButton, widget); partId = WP_MAXBUTTON; if (widget && !widget->isEnabled()) stateId = MAXBS_DISABLED; @@ -3017,7 +3017,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } if (sub & SC_TitleBarContextHelpButton && tb->titleBarFlags & Qt::WindowContextHelpButtonHint) { - theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarContextHelpButton, widget); + theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarContextHelpButton, widget); partId = WP_HELPBUTTON; if (widget && !widget->isEnabled()) stateId = MINBS_DISABLED; @@ -3039,7 +3039,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo || ((tb->titleBarFlags & Qt::WindowMaximizeButtonHint) && (tb->titleBarState & Qt::WindowMaximized))); if (drawNormalButton) { - theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarNormalButton, widget); + theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarNormalButton, widget); partId = WP_RESTOREBUTTON; if (widget && !widget->isEnabled()) stateId = RBS_DISABLED; @@ -3057,7 +3057,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } if (sub & SC_TitleBarShadeButton && tb->titleBarFlags & Qt::WindowShadeButtonHint && !(tb->titleBarState & Qt::WindowMinimized)) { - theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarShadeButton, widget); + theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarShadeButton, widget); partId = WP_MINBUTTON; if (widget && !widget->isEnabled()) stateId = MINBS_DISABLED; @@ -3075,7 +3075,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } if (sub & SC_TitleBarUnshadeButton && tb->titleBarFlags & Qt::WindowShadeButtonHint && tb->titleBarState & Qt::WindowMinimized) { - theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarUnshadeButton, widget); + theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarUnshadeButton, widget); partId = WP_RESTOREBUTTON; if (widget && !widget->isEnabled()) stateId = RBS_DISABLED; @@ -3092,7 +3092,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo d->drawBackground(theme); } if (sub & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) { - theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarCloseButton, widget); + theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarCloseButton, widget); //partId = titlebar->testWFlags(Qt::WA_WState_Tool) ? WP_SMALLCLOSEBUTTON : WP_CLOSEBUTTON; partId = WP_CLOSEBUTTON; if (widget && !widget->isEnabled()) @@ -3120,7 +3120,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo XPThemeData theme(widget, p, QLatin1String("WINDOW"), WP_MDICLOSEBUTTON, CBS_NORMAL); if (option->subControls & SC_MdiCloseButton) { - buttonRect = subControlRect(CC_MdiControls, option, SC_MdiCloseButton, widget); + buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiCloseButton, widget); if (theme.isValid()) { theme.partId = WP_MDICLOSEBUTTON; theme.rect = buttonRect; @@ -3136,7 +3136,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } } if (option->subControls & SC_MdiNormalButton) { - buttonRect = subControlRect(CC_MdiControls, option, SC_MdiNormalButton, widget); + buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiNormalButton, widget); if (theme.isValid()) { theme.partId = WP_MDIRESTOREBUTTON; theme.rect = buttonRect; @@ -3152,7 +3152,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } } if (option->subControls & QStyle::SC_MdiMinButton) { - buttonRect = subControlRect(CC_MdiControls, option, SC_MdiMinButton, widget); + buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiMinButton, widget); if (theme.isValid()) { theme.partId = WP_MDIMINBUTTON; theme.rect = buttonRect; @@ -3439,7 +3439,7 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl int buttonWidth = GetSystemMetrics(SM_CXSIZE) - 4; const int delta = buttonWidth + 2; int controlTop = option->rect.bottom() - buttonHeight - 2; - const int frameWidth = pixelMetric(PM_MdiSubWindowFrameWidth, option, widget); + const int frameWidth = proxy()->pixelMetric(PM_MdiSubWindowFrameWidth, option, widget); const bool sysmenuHint = (tb->titleBarFlags & Qt::WindowSystemMenuHint) != 0; const bool minimizeHint = (tb->titleBarFlags & Qt::WindowMinimizeButtonHint) != 0; const bool maximizeHint = (tb->titleBarFlags & Qt::WindowMaximizeButtonHint) != 0; @@ -3524,7 +3524,7 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl { const int controlTop = 6; const int controlHeight = height - controlTop - 3; - const int iconExtent = pixelMetric(PM_SmallIconSize); + const int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); QSize iconSize = tb->icon.actualSize(QSize(iconExtent, iconExtent)); if (tb->icon.isNull()) iconSize = QSize(controlHeight, controlHeight); @@ -3645,7 +3645,7 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt { //Spinbox adds frame twice sz = QWindowsStyle::sizeFromContents(ct, option, contentsSize, widget); - int border = pixelMetric(PM_SpinBoxFrameWidth, option, widget); + int border = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget); sz -= QSize(2*border, 2*border); } break; diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 2164e1e..d255f80 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -8,7 +8,10 @@ HEADERS += \ styles/qcommonstylepixmaps_p.h \ styles/qcommonstyle.h \ styles/qstylehelper_p.h \ + styles/qproxystyle.h \ + styles/qproxystyle_p.h \ styles/qstylesheetstyle_p.h + SOURCES += \ styles/qstyle.cpp \ styles/qstylefactory.cpp \ @@ -16,6 +19,7 @@ SOURCES += \ styles/qstyleplugin.cpp \ styles/qstylehelper.cpp \ styles/qcommonstyle.cpp \ + styles/qproxystyle.cpp \ styles/qstylesheetstyle.cpp \ styles/qstylesheetstyle_default.cpp |