From 163863f77d891f56573e4dae316d16cfc2fefc8f Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sat, 22 Jul 2017 15:16:51 +0200 Subject: [PATCH] Convert features.combobox to QT_[REQUIRE_]CONFIG Change-Id: I2f415de8556289a6461a645d559be17089c43c99 Reviewed-by: Oswald Buddenhagen --- src/sql/models/qsqlrelationaldelegate.h | 2 ++ src/widgets/accessible/complexwidgets.cpp | 6 +++-- src/widgets/accessible/complexwidgets_p.h | 4 ++-- .../accessible/qaccessiblewidgetfactory.cpp | 2 +- src/widgets/itemviews/qitemeditorfactory.cpp | 18 +++++++++------ src/widgets/styles/qcommonstyle.cpp | 20 ++++++++--------- src/widgets/styles/qfusionstyle.cpp | 2 ++ src/widgets/styles/qmacstyle_mac.mm | 22 ++++++++++--------- src/widgets/styles/qmacstyle_mac_p_p.h | 2 ++ src/widgets/styles/qpixmapstyle.cpp | 2 ++ src/widgets/styles/qstylesheetstyle.cpp | 20 +++++++++-------- src/widgets/styles/qwindowsstyle.cpp | 8 +++---- src/widgets/styles/qwindowsvistastyle.cpp | 8 +++---- src/widgets/styles/qwindowsvistastyle_p_p.h | 2 ++ src/widgets/styles/qwindowsxpstyle.cpp | 14 +++++++----- src/widgets/widgets/qcombobox.cpp | 3 --- src/widgets/widgets/qcombobox.h | 6 ++--- src/widgets/widgets/qcombobox_p.h | 5 ++--- src/widgets/widgets/qdatetimeedit_p.h | 1 - src/widgets/widgets/qtoolbar.cpp | 2 ++ src/widgets/widgets/widgets.pri | 11 +++++++--- 21 files changed, 91 insertions(+), 69 deletions(-) diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h index 42c0cc27b1..53f43a4acb 100644 --- a/src/sql/models/qsqlrelationaldelegate.h +++ b/src/sql/models/qsqlrelationaldelegate.h @@ -48,7 +48,9 @@ #if QT_CONFIG(listview) #include #endif +#if QT_CONFIG(combobox) #include +#endif #include #include diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 42775d7324..29e11556aa 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -44,7 +44,9 @@ #include #include #include +#if QT_CONFIG(combobox) #include +#endif #include #include #include @@ -260,7 +262,7 @@ QString QAccessibleTabBar::text(QAccessible::Text t) const #endif // QT_NO_TABBAR -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) /*! \class QAccessibleComboBox \brief The QAccessibleComboBox class implements the QAccessibleInterface for editable and read-only combo boxes. @@ -378,7 +380,7 @@ QStringList QAccessibleComboBox::keyBindingsForAction(const QString &/*actionNam return QStringList(); } -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) #ifndef QT_NO_SCROLLAREA // ======================= QAccessibleAbstractScrollArea ======================= diff --git a/src/widgets/accessible/complexwidgets_p.h b/src/widgets/accessible/complexwidgets_p.h index d43b06f4a4..b4b4e89a1a 100644 --- a/src/widgets/accessible/complexwidgets_p.h +++ b/src/widgets/accessible/complexwidgets_p.h @@ -124,7 +124,7 @@ protected: }; #endif // QT_NO_TABBAR -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) class QAccessibleComboBox : public QAccessibleWidget { public: @@ -146,7 +146,7 @@ public: protected: QComboBox *comboBox() const; }; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) #endif // QT_NO_ACCESSIBILITY diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index 20104eea68..371158c73c 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -79,7 +79,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje else iface = new QAccessibleLineEdit(widget); #endif -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) } else if (classname == QLatin1String("QComboBox")) { iface = new QAccessibleComboBox(widget); #endif diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp index a31689e0b5..dcfe4065a6 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -43,7 +43,9 @@ #ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(combobox) #include +#endif #if QT_CONFIG(datetimeedit) #include #endif @@ -52,6 +54,8 @@ #endif #include #include +#include +#include #include #include #include @@ -62,7 +66,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) class QBooleanComboBox : public QComboBox { @@ -75,7 +79,7 @@ public: bool value() const; }; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) #ifndef QT_NO_SPINBOX @@ -234,7 +238,7 @@ public: QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) const { switch (userType) { -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case QVariant::Bool: { QBooleanComboBox *cb = new QBooleanComboBox(parent); cb->setFrame(false); @@ -300,7 +304,7 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const { switch (userType) { -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case QVariant::Bool: return "currentIndex"; #endif @@ -595,7 +599,7 @@ void QExpandingLineEdit::resizeToContents() #endif // QT_NO_LINEEDIT -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) QBooleanComboBox::QBooleanComboBox(QWidget *parent) : QComboBox(parent) @@ -614,11 +618,11 @@ bool QBooleanComboBox::value() const return (currentIndex() == 1); } -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) QT_END_NAMESPACE -#if !defined(QT_NO_LINEEDIT) || !defined(QT_NO_COMBOBOX) +#if !defined(QT_NO_LINEEDIT) || QT_CONFIG(combobox) #include "qitemeditorfactory.moc" #endif diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 973e89b3ef..b1b84501c5 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -2096,7 +2096,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, case CE_HeaderEmptyArea: p->fillRect(opt->rect, opt->palette.background()); break; -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case CE_ComboBoxLabel: if (const QStyleOptionComboBox *cb = qstyleoption_cast(opt)) { QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); @@ -2128,7 +2128,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, p->restore(); } break; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) #ifndef QT_NO_TOOLBAR case CE_ToolBar: if (const QStyleOptionToolBar *toolBar = qstyleoption_cast(opt)) { @@ -2505,7 +2505,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, } break; #endif // QT_NO_PROGRESSBAR -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case SE_ComboBoxFocusRect: if (const QStyleOptionComboBox *cb = qstyleoption_cast(opt)) { int margin = cb->frame ? 3 : 0; @@ -2514,7 +2514,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, r = visualRect(opt->direction, opt->rect, r); } break; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) #ifndef QT_NO_TOOLBOX case SE_ToolBoxTabContents: r = opt->rect; @@ -3892,7 +3892,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const } } break; -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case CC_ComboBox: if (const QStyleOptionComboBox *cb = qstyleoption_cast(opt)) { QRect r; @@ -3907,7 +3907,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const } } break; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) #ifndef QT_NO_GROUPBOX case CC_GroupBox: if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast(opt)) { @@ -4140,7 +4140,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex } break; #endif // QT_NO_TOOLBUTTON -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case CC_ComboBox: if (const QStyleOptionComboBox *cb = qstyleoption_cast(opt)) { int x = cb->rect.x(), @@ -4172,7 +4172,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex ret = visualRect(cb->direction, cb->rect, ret); } break; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) case CC_TitleBar: if (const QStyleOptionTitleBar *tb = qstyleoption_cast(opt)) { const int controlMargin = 2; @@ -4839,7 +4839,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = QSize(sz.width() + 6, sz.height() + 5); break; #endif // QT_NO_TOOLBUTTON -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case CT_ComboBox: if (const QStyleOptionComboBox *cmb = qstyleoption_cast(opt)) { int fw = cmb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0; @@ -4849,7 +4849,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = QSize(sz.width() + fw + other, sz.height() + fw); } break; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) case CT_HeaderSection: if (const QStyleOptionHeader *hdr = qstyleoption_cast(opt)) { bool nullIcon = hdr->icon.isNull(); diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index b6e61e7cc9..792d958d8b 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -42,7 +42,9 @@ #if QT_CONFIG(style_fusion) || defined(QT_PLUGIN) #include "qcommonstyle_p.h" +#if QT_CONFIG(combobox) #include +#endif #if QT_CONFIG(pushbutton) #include #endif diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 6e8796970f..dbba51b00d 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -51,12 +51,14 @@ //#define DEBUG_SIZE_CONSTRAINT #include -#include #include #include #include #include +#if QT_CONFIG(combobox) +#include #include +#endif #if QT_CONFIG(dialogbuttonbox) #include #endif @@ -643,7 +645,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg else if (qobject_cast(widg)) ct = QStyle::CT_CheckBox; #endif -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) else if (qobject_cast(widg)) ct = QStyle::CT_ComboBox; #endif @@ -889,7 +891,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg break; } #endif -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case QStyle::CT_LineEdit: if (!widg || !qobject_cast(widg->parentWidget())) { //should I take into account the font dimentions of the lineedit? -Sam @@ -2264,7 +2266,7 @@ void QMacStyle::polish(QWidget* w) #ifndef QT_NO_MENU if (qobject_cast(w) -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) || qobject_cast(w) #endif ) { @@ -2332,7 +2334,7 @@ void QMacStyle::unpolish(QWidget* w) w->setWindowOpacity(1.0); } -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) if (QComboBox *combo = qobject_cast(w)) { if (!combo->isEditable()) { if (QWidget *widget = combo->findChild()) @@ -4484,7 +4486,7 @@ 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 QT_CONFIG(combobox) if (const QComboBox *comboBox = qobject_cast(w)) { iconSize = comboBox->iconSize(); } @@ -5065,7 +5067,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, #endif case SE_LineEditContents: rect = QCommonStyle::subElementRect(sr, opt, widget); -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) if (widget && qobject_cast(widget->parentWidget())) rect.adjust(-1, -2, 0, 0); else @@ -6742,7 +6744,7 @@ 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 +#if QT_CONFIG(combobox) const QComboBox *comboBox = qobject_cast(widget); #endif int w = sz.width(), @@ -6755,7 +6757,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, } else { h = mi->fontMetrics.height() + 2; if (!mi->icon.isNull()) { -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) if (comboBox) { const QSize &iconSize = comboBox->iconSize(); h = qMax(h, iconSize.height() + 4); @@ -6776,7 +6778,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 QT_CONFIG(combobox) if (comboBox && comboBox->isVisible()) { QStyleOptionComboBox cmb; cmb.initFrom(comboBox); diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index 4a3ff1b8bf..17e60e3bef 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -48,7 +48,9 @@ #include "qmacstyle_mac_p.h" #include "qcommonstyle_p.h" #include +#if QT_CONFIG(combobox) #include +#endif #include #include #include diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp index 20c9040a53..795fe34975 100644 --- a/src/widgets/styles/qpixmapstyle.cpp +++ b/src/widgets/styles/qpixmapstyle.cpp @@ -52,7 +52,9 @@ #include #include #include +#if QT_CONFIG(combobox) #include +#endif #include #if QT_CONFIG(listview) #include diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 5d977d75c0..e23a1f60b5 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -51,7 +51,9 @@ #include #include #include +#if QT_CONFIG(combobox) #include +#endif #include "private/qcssparser_p.h" #include "private/qmath_p.h" #include @@ -1639,7 +1641,7 @@ int QStyleSheetStyle::nativeFrameWidth(const QWidget *w) return base->pixelMetric(QStyle::PM_SpinBoxFrameWidth, 0, w); #endif -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) if (qobject_cast(w)) return base->pixelMetric(QStyle::PM_ComboBoxFrameWidth, 0, w); #endif @@ -2338,7 +2340,7 @@ QRect QStyleSheetStyle::positionRect(const QWidget *w, const QRenderRule& rule1, */ static QWidget *embeddedWidget(QWidget *w) { -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) if (QComboBox *cmb = qobject_cast(w)) { if (cmb->isEditable()) return cmb->lineEdit(); @@ -2372,7 +2374,7 @@ static QWidget *containerWidget(const QWidget *w) #ifndef QT_NO_LINEEDIT if (qobject_cast(w)) { //if the QLineEdit is an embeddedWidget, we need the rule of the real widget -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) if (qobject_cast(w->parentWidget())) return w->parentWidget(); #endif @@ -2411,7 +2413,7 @@ static bool unstylable(const QWidget *w) // detect QComboBoxPrivateContainer else if (qobject_cast(w)) { if (0 -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) || qobject_cast(w->parentWidget()) #endif ) @@ -2436,7 +2438,7 @@ static quint64 extendedPseudoClass(const QWidget *w) pc |= ((slider->orientation() == Qt::Vertical) ? PseudoClass_Vertical : PseudoClass_Horizontal); } else #endif -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) if (const QComboBox *combo = qobject_cast(w)) { if (combo->isEditable()) pc |= (combo->isEditable() ? PseudoClass_Editable : PseudoClass_ReadOnly); @@ -3769,7 +3771,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q } return; -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case CE_ComboBoxLabel: if (!rule.hasBox()) break; @@ -3805,7 +3807,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q return; } break; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) case CE_Header: if (hasStyleRule(w, PseudoElement_HeaderViewUpArrow) @@ -5297,7 +5299,7 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi case SH_TabBar_ElideMode: s = QLatin1String("tabbar-elide-mode"); break; case SH_TabBar_PreferNoArrows: s = QLatin1String("tabbar-prefer-no-arrows"); break; case SH_ComboBox_PopupFrameStyle: -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) if (qobject_cast(w)) { QAbstractItemView *view = w->findChild(); if (view) { @@ -5307,7 +5309,7 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi return QFrame::NoFrame; } } -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) break; case SH_DialogButtonBox_ButtonsHaveIcons: s = QLatin1String("dialogbuttonbox-buttons-have-icons"); break; case SH_Workspace_FillSpaceOnMaximize: s = QLatin1String("mdi-fill-space-on-maximize"); break; diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index d0ede56010..7b6da75089 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -1859,7 +1859,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai } return; #endif // QT_NO_DOCKWIDGET -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case CE_ComboBoxLabel: if (const QStyleOptionComboBox *cb = qstyleoption_cast(opt)) { if (cb->state & State_HasFocus) { @@ -1872,7 +1872,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai } QCommonStyle::drawControl(ce, opt, p, widget); break; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) default: QCommonStyle::drawControl(ce, opt, p, widget); } @@ -2150,7 +2150,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp } break; #endif // QT_NO_SCROLLBAR -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case CC_ComboBox: if (const QStyleOptionComboBox *cmb = qstyleoption_cast(opt)) { QBrush editBrush = cmb->palette.brush(QPalette::Base); @@ -2223,7 +2223,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp } } break; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) #ifndef QT_NO_SPINBOX case CC_SpinBox: if (const QStyleOptionSpinBox *sb = qstyleoption_cast(opt)) { diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index ae1b83957c..e400820256 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -1474,11 +1474,11 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption break; } #endif // QT_NO_ITEMVIEWS -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case CE_ComboBoxLabel: QCommonStyle::drawControl(element, option, painter, widget); break; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) default: QWindowsXPStyle::drawControl(element, option, painter, widget); break; @@ -2121,7 +2121,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt QRect rect = QWindowsXPStyle::subControlRect(control, option, subControl, widget); switch (control) { -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case CC_ComboBox: if (const QStyleOptionComboBox *cb = qstyleoption_cast(option)) { int x = cb->rect.x(), @@ -2154,7 +2154,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt return rect; } break; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) case CC_TitleBar: if (const QStyleOptionTitleBar *tb = qstyleoption_cast(option)) { if (!buttonVisible(subControl, tb)) diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h index 5c342df5a6..22ca1d3534 100644 --- a/src/widgets/styles/qwindowsvistastyle_p_p.h +++ b/src/widgets/styles/qwindowsvistastyle_p_p.h @@ -72,7 +72,9 @@ #include #include #include +#if QT_CONFIG(combobox) #include +#endif #include #include #include diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index e1c32d4ed6..418c4d256e 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -59,7 +59,9 @@ #include #include #include +#if QT_CONFIG(combobox) #include +#endif #include #include #include @@ -1147,9 +1149,9 @@ void QWindowsXPStyle::polish(QWidget *widget) #endif || qobject_cast(widget) || qobject_cast(widget) -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) || qobject_cast(widget) -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) || qobject_cast(widget) || qobject_cast(widget) || qobject_cast(widget) @@ -1222,9 +1224,9 @@ void QWindowsXPStyle::unpolish(QWidget *widget) #endif || qobject_cast(widget) || qobject_cast(widget) -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) || qobject_cast(widget) -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) || qobject_cast(widget) || qobject_cast(widget) || qobject_cast(widget) @@ -2550,7 +2552,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } break; #endif // QT_NO_SPINBOX -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) case CC_ComboBox: if (const QStyleOptionComboBox *cmb = qstyleoption_cast(option)) { @@ -2601,7 +2603,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo } } break; -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) case CC_ScrollBar: if (const QStyleOptionSlider *scrollbar = qstyleoption_cast(option)) { diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 6a8167b5e5..506986f4ba 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -39,7 +39,6 @@ #include "qcombobox.h" -#ifndef QT_NO_COMBOBOX #include #include #include @@ -3486,5 +3485,3 @@ QT_END_NAMESPACE #include "moc_qcombobox.cpp" #include "moc_qcombobox_p.cpp" - -#endif // QT_NO_COMBOBOX diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index 8f99594a76..a6aac6f8aa 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -46,9 +46,9 @@ #include #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(combobox); -#ifndef QT_NO_COMBOBOX +QT_BEGIN_NAMESPACE class QAbstractItemView; class QLineEdit; @@ -277,8 +277,6 @@ inline void QComboBox::insertItem(int aindex, const QString &atext, const QVariant &auserData) { insertItem(aindex, QIcon(), atext, auserData); } -#endif // QT_NO_COMBOBOX - QT_END_NAMESPACE #endif // QCOMBOBOX_H diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index 6c36359f81..ab4dd0281f 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -54,7 +54,6 @@ #include #include "QtWidgets/qcombobox.h" -#ifndef QT_NO_COMBOBOX #include "QtWidgets/qabstractslider.h" #include "QtWidgets/qapplication.h" #include "QtWidgets/qitemdelegate.h" @@ -74,6 +73,8 @@ #include +QT_REQUIRE_CONFIG(combobox); + QT_BEGIN_NAMESPACE class QAction; @@ -423,6 +424,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_COMBOBOX - #endif // QCOMBOBOX_P_H diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h index bc70780de9..5ac5a9db6a 100644 --- a/src/widgets/widgets/qdatetimeedit_p.h +++ b/src/widgets/widgets/qdatetimeedit_p.h @@ -52,7 +52,6 @@ // #include -#include "QtWidgets/qcombobox.h" #include "QtWidgets/qcalendarwidget.h" #include "QtWidgets/qspinbox.h" #include "QtWidgets/qtoolbutton.h" diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index bdb17f10d3..893506f16f 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -42,7 +42,9 @@ #ifndef QT_NO_TOOLBAR #include +#if QT_CONFIG(combobox) #include +#endif #include #include #include diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index ee510bd120..7a39f3fb3e 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -5,8 +5,6 @@ HEADERS += \ widgets/qbuttongroup_p.h \ widgets/qabstractspinbox.h \ widgets/qabstractspinbox_p.h \ - widgets/qcombobox.h \ - widgets/qcombobox_p.h \ widgets/qdial.h \ widgets/qdockwidget.h \ widgets/qdockwidget_p.h \ @@ -66,7 +64,6 @@ HEADERS += \ SOURCES += \ widgets/qbuttongroup.cpp \ widgets/qabstractspinbox.cpp \ - widgets/qcombobox.cpp \ widgets/qdial.cpp \ widgets/qdockwidget.cpp \ widgets/qdockarealayout.cpp \ @@ -140,6 +137,14 @@ qtConfig(checkbox) { widgets/qcheckbox.cpp } +qtConfig(combobox) { + HEADERS += \ + widgets/qcombobox.h \ + widgets/qcombobox_p.h + + SOURCES += widgets/qcombobox.cpp +} + qtConfig(commandlinkbutton) { HEADERS += \ widgets/qcommandlinkbutton.h