From 8adad2fe09b173ff876895c27884f49804a20bcc Mon Sep 17 00:00:00 2001 From: Nick Shaforostoff Date: Wed, 13 Apr 2016 00:47:50 +0300 Subject: fix build with various QT_NO_* defines Done-with: Andriy Gerasika Change-Id: I90883a491dbddb005c3d756c339e42285d50e437 Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- src/widgets/styles/qmacstyle_mac.mm | 130 +++++++++++++++++++++++++++++++++--- src/widgets/styles/qstylehelper.cpp | 2 + 2 files changed, 121 insertions(+), 11 deletions(-) (limited to 'src/widgets/styles') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 47a6156662..6aa5845a2c 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -190,12 +190,14 @@ typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *); static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0; static int closeButtonSize = 12; +#ifndef QT_NO_TABBAR static bool isVerticalTabs(const QTabBar::Shape shape) { return (shape == QTabBar::RoundedEast || shape == QTabBar::TriangularEast || shape == QTabBar::RoundedWest || shape == QTabBar::TriangularWest); } +#endif static bool isInMacUnifiedToolbarArea(QWindow *window, int windowY) { @@ -247,6 +249,7 @@ void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected) p->drawLine(min, max, max, min); } +#ifndef QT_NO_TABBAR QRect rotateTabPainter(QPainter *p, QTabBar::Shape shape, QRect tabRect) { if (isVerticalTabs(shape)) { @@ -430,6 +433,7 @@ void drawTabBase(QPainter *p, const QStyleOptionTabBarBase *tbb, const QWidget * p->setPen(borderBottom); p->drawLine(tabRect.x(), height - 1, width, height - 1); } +#endif static int getControlSize(const QStyleOption *option, const QWidget *widget) { @@ -445,13 +449,16 @@ static int getControlSize(const QStyleOption *option, const QWidget *widget) } +#ifndef QT_NO_TREEVIEW static inline bool isTreeView(const QWidget *widget) { return (widget && widget->parentWidget() && (qobject_cast(widget->parentWidget()) )); } +#endif +#ifndef QT_NO_TABBAR static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape) { ThemeTabDirection ttd; @@ -476,6 +483,7 @@ static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape) } return ttd; } +#endif static QString qt_mac_removeMnemonics(const QString &original) { @@ -742,8 +750,10 @@ inline bool qt_mac_is_metal(const QWidget *w) if (w->isWindow() && w->testAttribute(Qt::WA_WState_Created)) { // If not created will fall through to the opaque check and be fine anyway. return qt_macWindowIsTextured(w); } +#ifndef QT_NO_ACCESSIBILITY if (w->d_func()->isOpaque) break; +#endif } return false; } @@ -778,22 +788,34 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg ct = QStyle::CT_RadioButton; else if (qobject_cast(widg)) ct = QStyle::CT_CheckBox; +#ifndef QT_NO_COMBOBOX else if (qobject_cast(widg)) ct = QStyle::CT_ComboBox; +#endif +#ifndef QT_NO_TOOLBUTTON else if (qobject_cast(widg)) ct = QStyle::CT_ToolButton; +#endif else if (qobject_cast(widg)) ct = QStyle::CT_Slider; +#ifndef QT_NO_PROGRESSBAR else if (qobject_cast(widg)) ct = QStyle::CT_ProgressBar; +#endif +#ifndef QT_NO_LINEEDIT else if (qobject_cast(widg)) ct = QStyle::CT_LineEdit; +#endif else if (qobject_cast(widg)) ct = QStyle::CT_HeaderSection; +#ifndef QT_NO_MENUBAR else if (qobject_cast(widg)) ct = QStyle::CT_MenuBar; +#endif +#ifndef QT_NO_SIZEGRIP else if (qobject_cast(widg)) ct = QStyle::CT_SizeGrip; +#endif else return ret; } @@ -903,6 +925,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg if (sz == QAquaSizeSmall) { int width = 0, height = 0; if (szHint == QSize(-1, -1)) { //just 'guess'.. +#ifndef QT_NO_TOOLBUTTON const QToolButton *bt = qobject_cast(widg); // If this conversion fails then the widget was not what it claimed to be. if(bt) { @@ -923,7 +946,9 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg width = qMax(height, text_height); } } - } else { + } else +#endif + { // Let's return the size hint... width = szHint.width(); height = szHint.height(); @@ -987,6 +1012,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg ret.setWidth(w); break; } +#ifndef QT_NO_PROGRESSBAR case QStyle::CT_ProgressBar: { int finalValue = -1; Qt::Orientation orient = Qt::Horizontal; @@ -1005,6 +1031,8 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg ret.setWidth(finalValue); break; } +#endif +#ifndef QT_NO_COMBOBOX case QStyle::CT_LineEdit: if (!widg || !qobject_cast(widg->parentWidget())) { //should I take into account the font dimentions of the lineedit? -Sam @@ -1014,9 +1042,12 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg ret = QSize(-1, 19); } break; +#endif case QStyle::CT_HeaderSection: +#ifndef QT_NO_TREEVIEW if (isTreeView(widg)) ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricListHeaderHeight)); +#endif break; case QStyle::CT_MenuBar: if (sz == QAquaSizeLarge) { @@ -1424,6 +1455,7 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem // an extra check here before using the mini and small buttons. int h = combo->rect.size().height(); if (combo->editable){ +#ifndef QT_NO_DATETIMEEDIT if (qobject_cast(widget)) { // Except when, you know, we get a QDateTimeEdit with calendarPopup // enabled. And then things get weird, basically because it's a @@ -1440,7 +1472,9 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem bdi->kind = kThemeComboBoxSmall; else bdi->kind = kThemeComboBox; - } else { + } else +#endif + { if (h < 21) bdi->kind = kThemeComboBoxMini; else if (h < 26) @@ -2308,7 +2342,12 @@ void QMacStyle::polish(QWidget* w) w->setAttribute(Qt::WA_SetPalette, false); } - if (qobject_cast(w) || qobject_cast(w)) { +#ifndef QT_NO_MENU + if (qobject_cast(w) +#ifndef QT_NO_COMBOBOX + || qobject_cast(w) +#endif + ) { w->setWindowOpacity(0.985); if (!w->testAttribute(Qt::WA_SetPalette)) { QPixmap px(64, 64); @@ -2328,7 +2367,9 @@ void QMacStyle::polish(QWidget* w) w->setAttribute(Qt::WA_SetPalette, false); } } +#endif +#ifndef QT_NO_TABBAR if (QTabBar *tb = qobject_cast(w)) { if (tb->documentMode()) { w->setAttribute(Qt::WA_Hover); @@ -2338,6 +2379,7 @@ void QMacStyle::polish(QWidget* w) w->setPalette(p); } } +#endif QCommonStyle::polish(w); @@ -2356,19 +2398,26 @@ void QMacStyle::polish(QWidget* w) void QMacStyle::unpolish(QWidget* w) { - if ((qobject_cast(w) || qt_mac_is_metal(w)) && !w->testAttribute(Qt::WA_SetPalette)) { + if (( +#ifndef QT_NO_MENU + qobject_cast(w) || +#endif + qt_mac_is_metal(w) + ) && !w->testAttribute(Qt::WA_SetPalette)) { QPalette pal = qApp->palette(w); w->setPalette(pal); w->setAttribute(Qt::WA_SetPalette, false); w->setWindowOpacity(1.0); } +#ifndef QT_NO_COMBOBOX if (QComboBox *combo = qobject_cast(w)) { if (!combo->isEditable()) { if (QWidget *widget = combo->findChild()) widget->setWindowOpacity(1.0); } } +#endif if (QRubberBand *rubber = qobject_cast(w)) { rubber->setWindowOpacity(1.0); @@ -2878,9 +2927,12 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w ret = QEvent::MouseButtonRelease; break; case SH_TabBar_SelectMouseType: +#ifndef QT_NO_TABBAR if (const QStyleOptionTabBarBase *opt2 = qstyleoption_cast(opt)) { ret = opt2->documentMode ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - } else { + } else +#endif + { ret = QEvent::MouseButtonRelease; } break; @@ -2900,18 +2952,22 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w ret = Qt::AlignRight; break; case SH_TabBar_Alignment: { +#ifndef QT_NO_TABWIDGET if (const QTabWidget *tab = qobject_cast(w)) { if (tab->documentMode()) { ret = Qt::AlignLeft; break; } } +#endif +#ifndef QT_NO_TABBAR if (const QTabBar *tab = qobject_cast(w)) { if (tab->documentMode()) { ret = Qt::AlignLeft; break; } } +#endif ret = Qt::AlignCenter; } break; case SH_UnderlineShortcut: @@ -3041,9 +3097,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_FocusFrame_AboveWidget: ret = true; break; +#ifndef QT_NO_WIZARD case SH_WizardStyle: ret = QWizard::MacStyle; break; +#endif case SH_ItemView_ArrowKeysNavigateIntoChildren: ret = false; break; @@ -3061,9 +3119,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w opt->rect.width(), opt->rect.height() - 8); HIThemeMenuDrawInfo mdi; mdi.version = 0; +#ifndef QT_NO_MENU if (w && qobject_cast(w->parentWidget())) mdi.menuType = kThemeMenuTypeHierarchical; else +#endif mdi.menuType = kThemeMenuTypePopUp; QCFType shape; HIThemeGetMenuBackgroundShape(&menuRect, &mdi, &shape); @@ -3075,9 +3135,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_ItemView_PaintAlternatingRowColorsForEmptyArea: ret = true; break; +#ifndef QT_NO_TABBAR case SH_TabBar_CloseButtonPosition: ret = QTabBar::LeftSide; break; +#endif case SH_DockWidget_ButtonsHaveFrame: ret = false; break; @@ -3246,6 +3308,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai p->drawPath(path); p->restore(); break; } +#ifndef QT_NO_TABBAR case PE_FrameTabBarBase: if (const QStyleOptionTabBarBase *tbb = qstyleoption_cast(opt)) { @@ -3281,6 +3344,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai p->restore(); } break; +#endif case PE_PanelTipLabel: p->fillRect(opt->rect, opt->palette.brush(QPalette::ToolTipBase)); break; @@ -3292,9 +3356,11 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai HIThemeGroupBoxDrawInfo gdi; gdi.version = qt_mac_hitheme_version; gdi.state = tds; +#ifndef QT_NO_GROUPBOX if (w && qobject_cast(w->parentWidget())) gdi.kind = kHIThemeGroupBoxKindSecondary; else +#endif gdi.kind = kHIThemeGroupBoxKindPrimary; HIRect hirect = qt_hirectForQRect(opt->rect); HIThemeDrawGroupBox(&hirect, &gdi, cg, kHIThemeOrientationNormal); @@ -3528,6 +3594,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai // 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. if (const QStyleOptionFrame *panel = qstyleoption_cast(opt)) { +#ifndef QT_NO_LINEEDIT if ((opt->state & State_HasFocus) && !qobject_cast(w)) { int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin); int hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin); @@ -3535,9 +3602,11 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai focusFrame.rect = panel->rect.adjusted(-hmargin, -vmargin, hmargin, vmargin); drawControl(CE_FocusFrame, &focusFrame, p, w); } +#endif } break; +#ifndef QT_NO_TABWIDGET case PE_FrameTabWidget: if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast(opt)) { @@ -3552,6 +3621,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai HIThemeDrawTabPane(&hirect, &tpdi, cg, kHIThemeOrientationNormal); } break; +#endif case PE_PanelScrollAreaCorner: { const QBrush brush(opt->palette.brush(QPalette::Base)); p->fillRect(opt->rect, brush); @@ -3695,9 +3765,11 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter HIRect bounds = qt_hirectForQRect(ir); bool noVerticalHeader = true; +#ifndef QT_NO_TABLEVIEW if (w) if (const QTableView *table = qobject_cast(w->parentWidget())) noVerticalHeader = !table->verticalHeader()->isVisible(); +#endif bool drawTopBorder = header->orientation == Qt::Horizontal; bool drawLeftBorder = header->orientation == Qt::Vertical @@ -4131,6 +4203,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w); } break; +#ifndef QT_NO_TABBAR case CE_TabBarTabShape: if (const QStyleOptionTab *tabOpt = qstyleoption_cast(opt)) { @@ -4337,6 +4410,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } } break; +#endif +#ifndef QT_NO_DOCKWIDGET case CE_DockWidgetTitle: if (const QDockWidget *dockWidget = qobject_cast(w)) { bool floating = dockWidget->isFloating(); @@ -4412,6 +4487,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } } break; +#endif case CE_FocusFrame: { const int hMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, w); const int vMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin, opt, w); @@ -4536,9 +4612,11 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // Always be normal or disabled to follow the Mac style. int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize); QSize iconSize(smallIconSize, smallIconSize); +#ifndef QT_NO_COMBOBOX if (const QComboBox *comboBox = qobject_cast(w)) { iconSize = comboBox->iconSize(); } +#endif QPixmap pixmap = mi->icon.pixmap(window, iconSize, mode); int pixw = pixmap.width() / pixmap.devicePixelRatio(); int pixh = pixmap.height() / pixmap.devicePixelRatio(); @@ -4822,6 +4900,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } } break; +#ifndef QT_NO_TOOLBAR case CE_ToolBar: { const QStyleOptionToolBar *toolBar = qstyleoption_cast(opt); @@ -4830,6 +4909,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // the title bar. The following code fills the toolBar area with transparent pixels // to make that gradient visible. if (w) { +#ifndef QT_NO_MAINWINDOW if (QMainWindow * mainWindow = qobject_cast(w->window())) { if (toolBar && toolBar->toolBarArea == Qt::TopToolBarArea && mainWindow->unifiedTitleAndToolBarOnMac()) { @@ -4858,6 +4938,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter break; } } +#endif } // draw background gradient @@ -4888,6 +4969,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } break; +#endif default: QCommonStyle::drawControl(ce, opt, p, w); break; @@ -4979,6 +5061,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, int(outRect.size.height)); break; } +#ifndef QT_NO_TABWIDGET case SE_TabWidgetLeftCorner: if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast(opt)) { @@ -5040,11 +5123,14 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, } } break; +#endif case SE_LineEditContents: rect = QCommonStyle::subElementRect(sr, opt, widget); +#ifndef QT_NO_COMBOBOX if (widget && qobject_cast(widget->parentWidget())) rect.adjust(-1, -2, 0, 0); else +#endif rect.adjust(-1, -1, 0, +1); break; case SE_CheckBoxLayoutItem: @@ -5058,12 +5144,15 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, } break; case SE_ComboBoxLayoutItem: +#ifndef QT_NO_TOOLBAR if (widget && qobject_cast(widget->parentWidget())) { // Do nothing, because QToolbar needs the entire widget rect. // Otherwise it will be clipped. Equivalent to // widget->setAttribute(Qt::WA_LayoutUsesWidgetRect), but without // all the hassle. - } else { + } else +#endif + { rect = opt->rect; if (controlSize == QAquaSizeLarge) { rect.adjust(+3, +2, -3, -4); @@ -5181,6 +5270,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, } rect.setBottom(rect.bottom() - 1); break; +#ifndef QT_NO_TABWIDGET case SE_TabWidgetLayoutItem: if (const QStyleOptionTabWidgetFrame *tabWidgetOpt = qstyleoption_cast(opt)) { @@ -5194,6 +5284,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, rect.setTop(rect.top() + SIZE(6 /* AHIG */, 3 /* guess */, 2 /* AHIG */)); } break; +#endif #ifndef QT_NO_DOCKWIDGET case SE_DockWidgetCloseButton: case SE_DockWidgetFloatButton: @@ -5700,6 +5791,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex } } break; +#ifndef QT_NO_SPINBOX case CC_SpinBox: if (const QStyleOptionSpinBox *sb = qstyleoption_cast(opt)) { QStyleOptionSpinBox newSB = *sb; @@ -5770,6 +5862,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex } } break; +#endif case CC_ComboBox: if (const QStyleOptionComboBox *combo = qstyleoption_cast(opt)){ HIThemeButtonDrawInfo bdi; @@ -6075,10 +6168,12 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex #endif } break; +#ifndef QT_NO_DIAL case CC_Dial: if (const QStyleOptionSlider *dial = qstyleoption_cast(opt)) QStyleHelper::drawDial(dial, p); break; +#endif default: QCommonStyle::drawComplexControl(cc, opt, p, widget); break; @@ -6456,6 +6551,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op } } break; +#ifndef QT_NO_SPINBOX case CC_SpinBox: if (const QStyleOptionSpinBox *spin = qstyleoption_cast(opt)) { QAquaWidgetSize aquaSize = d->aquaSizeConstrain(spin, widget); @@ -6549,6 +6645,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op } } break; +#endif case CC_ToolButton: ret = QCommonStyle::subControlRect(cc, opt, sc, widget); if (sc == SC_ToolButtonMenu @@ -6574,7 +6671,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, bool useAquaGuideline = true; switch (ct) { - +#ifndef QT_NO_SPINBOX case CT_SpinBox: if (const QStyleOptionSpinBox *vopt = qstyleoption_cast(opt)) { // Add button + frame widths @@ -6583,6 +6680,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz += QSize(buttonWidth + 2*fw, 2*fw - 3); } break; +#endif case QStyle::CT_TabWidget: // the size between the pane and the "contentsRect" (+4,+4) // (the "contentsRect" is on the inside of the pane) @@ -6618,7 +6716,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, * overlap is how much the pane should overlap the tab bar */ // then add the size between the stackwidget and the "contentsRect" - +#ifndef QT_NO_TABWIDGET if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast(opt)) { QSize extra(0,0); @@ -6632,8 +6730,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, } sz+= extra; } - +#endif break; +#ifndef QT_NO_TABBAR case QStyle::CT_TabBarTab: if (const QStyleOptionTab *tab = qstyleoption_cast(opt)) { const QAquaWidgetSize AquaSize = d->aquaSizeConstrain(opt, widget); @@ -6701,6 +6800,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, } } break; +#endif case QStyle::CT_PushButton: // By default, we fit the contents inside a normal rounded push button. // Do this by add enough space around the contents so that rounded @@ -6714,7 +6814,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, case QStyle::CT_MenuItem: if (const QStyleOptionMenuItem *mi = qstyleoption_cast(opt)) { int maxpmw = mi->maxIconWidth; +#ifndef QT_NO_COMBOBOX const QComboBox *comboBox = qobject_cast(widget); +#endif int w = sz.width(), h = sz.height(); if (mi->menuItemType == QStyleOptionMenuItem::Separator) { @@ -6725,11 +6827,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, } else { h = mi->fontMetrics.height() + 2; if (!mi->icon.isNull()) { +#ifndef QT_NO_COMBOBOX if (comboBox) { const QSize &iconSize = comboBox->iconSize(); h = qMax(h, iconSize.height() + 4); maxpmw = qMax(maxpmw, iconSize.width()); - } else { + } else +#endif + { int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4); } @@ -6743,6 +6848,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, w += maxpmw + 6; // add space for a check. All items have place for a check too. w += 20; +#ifndef QT_NO_COMBOBOX if (comboBox && comboBox->isVisible()) { QStyleOptionComboBox cmb; cmb.initFrom(comboBox); @@ -6752,7 +6858,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, w = qMax(w, subControlRect(QStyle::CC_ComboBox, &cmb, QStyle::SC_ComboBoxEditField, comboBox).width()); - } else { + } else +#endif + { w += 12; } sz = QSize(w, h); diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index f073f1cccb..583385ee8a 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -391,9 +391,11 @@ void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rec QColor backgroundColor(const QPalette &pal, const QWidget* widget) { +#ifndef QT_NO_SCROLLBAR if (qobject_cast(widget) && widget->parent() && qobject_cast(widget->parent()->parent())) return widget->parentWidget()->parentWidget()->palette().color(QPalette::Base); +#endif return pal.color(QPalette::Base); } -- cgit v1.2.3