Remove Windows as a dependency of mac style

There is not need to have this dependency any more
since mac is overriding anything we depend on in Windows
style anyway.

Change-Id: I8fe0e0cc949265170947b492e04e08fdd4cf5027
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Jens Bache-Wiig 2012-10-17 16:11:58 +02:00 committed by The Qt Project
parent 4b1e476da0
commit c6151b75b0
3 changed files with 103 additions and 46 deletions

View File

@ -42,7 +42,7 @@
#ifndef QMACSTYLE_MAC_H #ifndef QMACSTYLE_MAC_H
#define QMACSTYLE_MAC_H #define QMACSTYLE_MAC_H
#include <QtWidgets/qwindowsstyle.h> #include <QtWidgets/qcommonstyle.h>
QT_BEGIN_HEADER QT_BEGIN_HEADER
@ -62,7 +62,7 @@ class QPalette;
class QPushButton; class QPushButton;
class QStyleOptionButton; class QStyleOptionButton;
class QMacStylePrivate; class QMacStylePrivate;
class Q_WIDGETS_EXPORT_STYLE_MAC QMacStyle : public QWindowsStyle class Q_WIDGETS_EXPORT_STYLE_MAC QMacStyle : public QCommonStyle
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -1891,7 +1891,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD
} }
QMacStyle::QMacStyle() QMacStyle::QMacStyle()
: QWindowsStyle(*new QMacStylePrivate) : QCommonStyle(*new QMacStylePrivate)
{ {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
Q_D(QMacStyle); Q_D(QMacStyle);
@ -2054,7 +2054,7 @@ void QMacStyle::polish(QWidget* w)
} }
} }
QWindowsStyle::polish(w); QCommonStyle::polish(w);
if (QRubberBand *rubber = qobject_cast<QRubberBand*>(w)) { if (QRubberBand *rubber = qobject_cast<QRubberBand*>(w)) {
rubber->setWindowOpacity(0.25); rubber->setWindowOpacity(0.25);
@ -2094,7 +2094,7 @@ void QMacStyle::unpolish(QWidget* w)
if (QFocusFrame *frame = qobject_cast<QFocusFrame *>(w)) if (QFocusFrame *frame = qobject_cast<QFocusFrame *>(w))
frame->setAttribute(Qt::WA_NoSystemBackground, true); frame->setAttribute(Qt::WA_NoSystemBackground, true);
QWindowsStyle::unpolish(w); QCommonStyle::unpolish(w);
if (qobject_cast<QScrollBar*>(w)) { if (qobject_cast<QScrollBar*>(w)) {
w->setAttribute(Qt::WA_OpaquePaintEvent, true); w->setAttribute(Qt::WA_OpaquePaintEvent, true);
@ -2205,6 +2205,47 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
case PM_SliderLength: case PM_SliderLength:
ret = 17; ret = 17;
break; break;
// Returns the number of pixels to use for the business part of the
// slider (i.e., the non-tickmark portion). The remaining space is shared
// equally between the tickmark regions.
case PM_SliderControlThickness:
if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width();
int ticks = sl->tickPosition;
int n = 0;
if (ticks & QSlider::TicksAbove)
++n;
if (ticks & QSlider::TicksBelow)
++n;
if (!n) {
ret = space;
break;
}
int thick = 6; // Magic constant to get 5 + 16 + 5
if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks)
thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4;
space -= thick;
if (space > 0)
thick += (space * 2) / (n + 2);
ret = thick;
} else {
ret = 0;
}
break;
case PM_SmallIconSize:
ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_LargeIconSize:
ret = int(QStyleHelper::dpiScaled(32.));
break;
case PM_IconViewIconSize:
ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
break;
case PM_ButtonDefaultIndicator: case PM_ButtonDefaultIndicator:
ret = 0; ret = 0;
break; break;
@ -2452,7 +2493,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
switch (d->aquaSizeConstrain(opt, widget)) { switch (d->aquaSizeConstrain(opt, widget)) {
case QAquaSizeLarge: case QAquaSizeLarge:
case QAquaSizeUnknown: case QAquaSizeUnknown:
ret = QWindowsStyle::pixelMetric(metric, opt, widget); ret = QCommonStyle::pixelMetric(metric, opt, widget);
break; break;
case QAquaSizeSmall: case QAquaSizeSmall:
ret = 20; ret = 20;
@ -2483,7 +2524,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
#endif #endif
break; break;
default: default:
ret = QWindowsStyle::pixelMetric(metric, opt, widget); ret = QCommonStyle::pixelMetric(metric, opt, widget);
break; break;
} }
return ret; return ret;
@ -2491,7 +2532,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
QPalette QMacStyle::standardPalette() const QPalette QMacStyle::standardPalette() const
{ {
QPalette pal = QWindowsStyle::standardPalette(); QPalette pal = QCommonStyle::standardPalette();
pal.setColor(QPalette::Disabled, QPalette::Dark, QColor(191, 191, 191)); pal.setColor(QPalette::Disabled, QPalette::Dark, QColor(191, 191, 191));
pal.setColor(QPalette::Active, QPalette::Dark, QColor(191, 191, 191)); pal.setColor(QPalette::Active, QPalette::Dark, QColor(191, 191, 191));
pal.setColor(QPalette::Inactive, QPalette::Dark, QColor(191, 191, 191)); pal.setColor(QPalette::Inactive, QPalette::Dark, QColor(191, 191, 191));
@ -2503,6 +2544,22 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
{ {
SInt32 ret = 0; SInt32 ret = 0;
switch (sh) { switch (sh) {
case SH_Slider_SnapToValue:
case SH_PrintDialog_RightAlignButtons:
case SH_FontDialog_SelectAssociatedText:
case SH_MenuBar_MouseTracking:
case SH_Menu_MouseTracking:
case SH_ComboBox_ListMouseTracking:
case SH_MainWindow_SpaceBelowMenuBar:
case SH_ItemView_ChangeHighlightOnFocus:
ret = 1;
break;
case SH_ToolBox_SelectedPageTitleBold:
ret = 0;
break;
case SH_DialogButtonBox_ButtonsHaveIcons:
ret = 0;
break;
case SH_Menu_SelectionWrap: case SH_Menu_SelectionWrap:
ret = false; ret = false;
break; break;
@ -2556,7 +2613,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = Qt::AlignTop; ret = Qt::AlignTop;
break; break;
case SH_ScrollView_FrameOnlyAroundContents: case SH_ScrollView_FrameOnlyAroundContents:
ret = QWindowsStyle::styleHint(sh, opt, w, hret); ret = QCommonStyle::styleHint(sh, opt, w, hret);
break; break;
case SH_Menu_FillScreenWithScroll: case SH_Menu_FillScreenWithScroll:
ret = false; ret = false;
@ -2780,7 +2837,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = false; ret = false;
break; break;
default: default:
ret = QWindowsStyle::styleHint(sh, opt, w, hret); ret = QCommonStyle::styleHint(sh, opt, w, hret);
break; break;
} }
return ret; return ret;
@ -2807,7 +2864,7 @@ QPixmap QMacStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixm
default: default:
; ;
} }
return QWindowsStyle::generatedIconPixmap(iconMode, pixmap, opt); return QCommonStyle::generatedIconPixmap(iconMode, pixmap, opt);
} }
@ -2822,7 +2879,7 @@ QPixmap QMacStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOpt
static bool recursionGuard = false; static bool recursionGuard = false;
if (recursionGuard) if (recursionGuard)
return QWindowsStyle::standardPixmap(standardPixmap, opt, widget); return QCommonStyle::standardPixmap(standardPixmap, opt, widget);
recursionGuard = true; recursionGuard = true;
QIcon icon = standardIcon(standardPixmap, opt, widget); QIcon icon = standardIcon(standardPixmap, opt, widget);
@ -2964,7 +3021,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
if (const QStyleOptionFrame *groupBox = qstyleoption_cast<const QStyleOptionFrame *>(opt)) { if (const QStyleOptionFrame *groupBox = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
const QStyleOptionFrameV2 *frame2 = qstyleoption_cast<const QStyleOptionFrameV2 *>(opt); const QStyleOptionFrameV2 *frame2 = qstyleoption_cast<const QStyleOptionFrameV2 *>(opt);
if (frame2 && frame2->features & QStyleOptionFrameV2::Flat) { if (frame2 && frame2->features & QStyleOptionFrameV2::Flat) {
QWindowsStyle::drawPrimitive(pe, groupBox, p, w); QCommonStyle::drawPrimitive(pe, groupBox, p, w);
} else { } else {
HIThemeGroupBoxDrawInfo gdi; HIThemeGroupBoxDrawInfo gdi;
gdi.version = qt_mac_hitheme_version; gdi.version = qt_mac_hitheme_version;
@ -3198,12 +3255,12 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
HIThemeDrawFrame(&hirect, &fdi, cg, kHIThemeOrientationNormal); HIThemeDrawFrame(&hirect, &fdi, cg, kHIThemeOrientationNormal);
} else { } else {
QWindowsStyle::drawPrimitive(pe, opt, p, w); QCommonStyle::drawPrimitive(pe, opt, p, w);
} }
} }
break; break;
case PE_PanelLineEdit: case PE_PanelLineEdit:
QWindowsStyle::drawPrimitive(pe, opt, p, w); QCommonStyle::drawPrimitive(pe, opt, p, w);
// Draw the focus frame for widgets other than QLineEdit (e.g. for line edits in Webkit). // Draw the focus frame for widgets other than QLineEdit (e.g. for line edits in Webkit).
// Focus frame is drawn outside the rectangle passed in the option-rect. // Focus frame is drawn outside the rectangle passed in the option-rect.
if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) { if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
@ -3248,14 +3305,14 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
} break; } break;
case PE_PanelStatusBar: { case PE_PanelStatusBar: {
if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4) { if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4) {
QWindowsStyle::drawPrimitive(pe, opt, p, w); QCommonStyle::drawPrimitive(pe, opt, p, w);
break; break;
} }
// Use the Leopard style only if the status bar is the status bar for a // Use the Leopard style only if the status bar is the status bar for a
// QMainWindow with a unifed toolbar. // QMainWindow with a unifed toolbar.
if (w == 0 || w->parent() == 0 || qobject_cast<QMainWindow *>(w->parent()) == 0 || if (w == 0 || w->parent() == 0 || qobject_cast<QMainWindow *>(w->parent()) == 0 ||
qobject_cast<QMainWindow *>(w->parent())->unifiedTitleAndToolBarOnMac() == false ) { qobject_cast<QMainWindow *>(w->parent())->unifiedTitleAndToolBarOnMac() == false ) {
QWindowsStyle::drawPrimitive(pe, opt, p, w); QCommonStyle::drawPrimitive(pe, opt, p, w);
break; break;
} }
@ -3281,7 +3338,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
} }
default: default:
QWindowsStyle::drawPrimitive(pe, opt, p, w); QCommonStyle::drawPrimitive(pe, opt, p, w);
break; break;
} }
} }
@ -3512,10 +3569,10 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
} }
} }
} else { } else {
QWindowsStyle::drawControl(ce, &myTb, p, w); QCommonStyle::drawControl(ce, &myTb, p, w);
} }
} else { } else {
QWindowsStyle::drawControl(ce, &myTb, p, w); QCommonStyle::drawControl(ce, &myTb, p, w);
} }
} }
break; break;
@ -3528,7 +3585,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
break; break;
if (btn->features & QStyleOptionButton::CommandLinkButton) { if (btn->features & QStyleOptionButton::CommandLinkButton) {
QWindowsStyle::drawControl(ce, opt, p, w); QCommonStyle::drawControl(ce, opt, p, w);
break; break;
} }
@ -3656,7 +3713,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
} }
} }
if (themeId == kThemePushButtonFont) { if (themeId == kThemePushButtonFont) {
QWindowsStyle::drawControl(ce, btn, p, w); QCommonStyle::drawControl(ce, btn, p, w);
} else { } else {
p->save(); p->save();
CGContextSetShouldAntialias(cg, true); CGContextSetShouldAntialias(cg, true);
@ -3684,7 +3741,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
} }
} else { } else {
if (hasIcon && !hasText) { if (hasIcon && !hasText) {
QWindowsStyle::drawControl(ce, btn, p, w); QCommonStyle::drawControl(ce, btn, p, w);
} else { } else {
QRect freeContentRect = btn->rect; QRect freeContentRect = btn->rect;
QRect textRect = itemTextRect( QRect textRect = itemTextRect(
@ -3728,7 +3785,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
QStyleOptionComboBox comboCopy = *cb; QStyleOptionComboBox comboCopy = *cb;
comboCopy.direction = Qt::LeftToRight; comboCopy.direction = Qt::LeftToRight;
QWindowsStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w); QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w);
} }
break; break;
case CE_TabBarTabShape: case CE_TabBarTabShape:
@ -4456,7 +4513,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
} break; } break;
default: default:
QWindowsStyle::drawControl(ce, opt, p, w); QCommonStyle::drawControl(ce, opt, p, w);
break; break;
} }
} }
@ -4503,7 +4560,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
break; break;
case SE_HeaderLabel: case SE_HeaderLabel:
if (qstyleoption_cast<const QStyleOptionHeader *>(opt)) { if (qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
rect = QWindowsStyle::subElementRect(sr, opt, widget); rect = QCommonStyle::subElementRect(sr, opt, widget);
if (widget && widget->height() <= 22){ if (widget && widget->height() <= 22){
// We need to allow the text a bit more space when the header is // We need to allow the text a bit more space when the header is
// small, otherwise it gets clipped: // small, otherwise it gets clipped:
@ -4579,7 +4636,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
} }
break; break;
case SE_TabWidgetTabContents: case SE_TabWidgetTabContents:
rect = QWindowsStyle::subElementRect(sr, opt, widget); rect = QCommonStyle::subElementRect(sr, opt, widget);
if (const QStyleOptionTabWidgetFrame *twf if (const QStyleOptionTabWidgetFrame *twf
= qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
if (twf->lineWidth != 0) { if (twf->lineWidth != 0) {
@ -4600,7 +4657,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
} }
break; break;
case SE_LineEditContents: case SE_LineEditContents:
rect = QWindowsStyle::subElementRect(sr, opt, widget); rect = QCommonStyle::subElementRect(sr, opt, widget);
if(widget->parentWidget() && qobject_cast<const QComboBox*>(widget->parentWidget())) if(widget->parentWidget() && qobject_cast<const QComboBox*>(widget->parentWidget()))
rect.adjust(-1, -2, 0, 0); rect.adjust(-1, -2, 0, 0);
else else
@ -4855,7 +4912,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
} }
#endif #endif
default: default:
rect = QWindowsStyle::subElementRect(sr, opt, widget); rect = QCommonStyle::subElementRect(sr, opt, widget);
break; break;
} }
return rect; return rect;
@ -5347,7 +5404,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
groupBox.subControls = groupBox.subControls & ~SC_GroupBoxLabel; groupBox.subControls = groupBox.subControls & ~SC_GroupBoxLabel;
didModifySubControls = true; didModifySubControls = true;
} }
QWindowsStyle::drawComplexControl(cc, &groupBox, p, widget); QCommonStyle::drawComplexControl(cc, &groupBox, p, widget);
if (didModifySubControls) { if (didModifySubControls) {
p->save(); p->save();
CGContextSetShouldAntialias(cg, true); CGContextSetShouldAntialias(cg, true);
@ -5500,7 +5557,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
QStyleHelper::drawDial(dial, p); QStyleHelper::drawDial(dial, p);
break; break;
default: default:
QWindowsStyle::drawComplexControl(cc, opt, p, widget); QCommonStyle::drawComplexControl(cc, opt, p, widget);
break; break;
} }
} }
@ -5514,7 +5571,7 @@ QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc,
switch (cc) { switch (cc) {
case CC_ComboBox: case CC_ComboBox:
if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
sc = QWindowsStyle::hitTestComplexControl(cc, cmb, pt, widget); sc = QCommonStyle::hitTestComplexControl(cc, cmb, pt, widget);
if (!cmb->editable && sc != QStyle::SC_None) if (!cmb->editable && sc != QStyle::SC_None)
sc = SC_ComboBoxArrow; // A bit of a lie, but what we want sc = SC_ComboBoxArrow; // A bit of a lie, but what we want
} }
@ -5630,7 +5687,7 @@ QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc,
break; break;
*/ */
default: default:
sc = QWindowsStyle::hitTestComplexControl(cc, opt, pt, widget); sc = QCommonStyle::hitTestComplexControl(cc, opt, pt, widget);
break; break;
} }
return sc; return sc;
@ -5852,7 +5909,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
case SC_GroupBoxContents: case SC_GroupBoxContents:
case SC_GroupBoxFrame: { case SC_GroupBoxFrame: {
if (flat) { if (flat) {
ret = QWindowsStyle::subControlRect(cc, groupBox, sc, widget); ret = QCommonStyle::subControlRect(cc, groupBox, sc, widget);
break; break;
} }
QFontMetrics fm = groupBox->fontMetrics; QFontMetrics fm = groupBox->fontMetrics;
@ -5873,7 +5930,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
} }
break; break;
default: default:
ret = QWindowsStyle::subControlRect(cc, groupBox, sc, widget); ret = QCommonStyle::subControlRect(cc, groupBox, sc, widget);
break; break;
} }
} }
@ -5966,19 +6023,19 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
ret = visualRect(spin->direction, spin->rect, ret); ret = visualRect(spin->direction, spin->rect, ret);
break; break;
default: default:
ret = QWindowsStyle::subControlRect(cc, spin, sc, widget); ret = QCommonStyle::subControlRect(cc, spin, sc, widget);
break; break;
} }
} }
break; break;
case CC_ToolButton: case CC_ToolButton:
ret = QWindowsStyle::subControlRect(cc, opt, sc, widget); ret = QCommonStyle::subControlRect(cc, opt, sc, widget);
if (sc == SC_ToolButtonMenu && widget && !qobject_cast<QToolBar*>(widget->parentWidget())) { if (sc == SC_ToolButtonMenu && widget && !qobject_cast<QToolBar*>(widget->parentWidget())) {
ret.adjust(-1, 0, 0, 0); ret.adjust(-1, 0, 0, 0);
} }
break; break;
default: default:
ret = QWindowsStyle::subControlRect(cc, opt, sc, widget); ret = QCommonStyle::subControlRect(cc, opt, sc, widget);
break; break;
} }
return ret; return ret;
@ -5999,7 +6056,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
case QStyle::CT_TabWidget: case QStyle::CT_TabWidget:
// the size between the pane and the "contentsRect" (+4,+4) // the size between the pane and the "contentsRect" (+4,+4)
// (the "contentsRect" is on the inside of the pane) // (the "contentsRect" is on the inside of the pane)
sz = QWindowsStyle::sizeFromContents(ct, opt, csz, widget); sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
/** /**
This is supposed to show the relationship between the tabBar and This is supposed to show the relationship between the tabBar and
the stack widget of a QTabWidget. the stack widget of a QTabWidget.
@ -6197,7 +6254,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
break; } break; }
case CT_HeaderSection:{ case CT_HeaderSection:{
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt); const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt);
sz = QWindowsStyle::sizeFromContents(ct, opt, csz, widget); sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
if (header->text.contains(QLatin1Char('\n'))) if (header->text.contains(QLatin1Char('\n')))
useAquaGuideline = false; useAquaGuideline = false;
break; } break; }
@ -6219,7 +6276,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
break; break;
default: default:
sz = QWindowsStyle::sizeFromContents(ct, opt, csz, widget); sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
} }
if (useAquaGuideline){ if (useAquaGuideline){
@ -6261,7 +6318,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
case CT_PushButton: case CT_PushButton:
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
if (btn->features & QStyleOptionButton::CommandLinkButton) { if (btn->features & QStyleOptionButton::CommandLinkButton) {
return QWindowsStyle::sizeFromContents(ct, opt, sz, widget); return QCommonStyle::sizeFromContents(ct, opt, sz, widget);
} }
} }
@ -6316,7 +6373,7 @@ void QMacStyle::drawItemText(QPainter *p, const QRect &r, int flags, const QPale
{ {
if(flags & Qt::TextShowMnemonic) if(flags & Qt::TextShowMnemonic)
flags |= Qt::TextHideMnemonic; flags |= Qt::TextHideMnemonic;
QWindowsStyle::drawItemText(p, r, flags, pal, enabled, text, textRole); QCommonStyle::drawItemText(p, r, flags, pal, enabled, text, textRole);
} }
bool QMacStyle::event(QEvent *e) bool QMacStyle::event(QEvent *e)
@ -6373,7 +6430,7 @@ QIcon QMacStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *o
{ {
switch (standardIcon) { switch (standardIcon) {
default: default:
return QWindowsStyle::standardIcon(standardIcon, opt, widget); return QCommonStyle::standardIcon(standardIcon, opt, widget);
case SP_ToolBarHorizontalExtensionButton: case SP_ToolBarHorizontalExtensionButton:
case SP_ToolBarVerticalExtensionButton: { case SP_ToolBarVerticalExtensionButton: {
QPixmap pixmap(qt_mac_toolbar_ext); QPixmap pixmap(qt_mac_toolbar_ext);

View File

@ -47,7 +47,7 @@
#undef check #undef check
#include "qmacstyle_mac.h" #include "qmacstyle_mac.h"
#include "qwindowsstyle_p.h" #include "qcommonstyle_p.h"
#include <private/qapplication_p.h> #include <private/qapplication_p.h>
#include <private/qcombobox_p.h> #include <private/qcombobox_p.h>
#include <private/qpainter_p.h> #include <private/qpainter_p.h>
@ -139,7 +139,7 @@ enum QAquaWidgetSize { QAquaSizeLarge = 0, QAquaSizeSmall = 1, QAquaSizeMini = 2
bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option); bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option);
class QMacStylePrivate : public QWindowsStylePrivate class QMacStylePrivate : public QCommonStylePrivate
{ {
Q_DECLARE_PUBLIC(QMacStyle) Q_DECLARE_PUBLIC(QMacStyle)
public: public: