diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-08-02 22:49:38 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-08-02 22:52:32 +0200 |
commit | ee07b912a1768ea0b103544f9eeac41f3cf50cf6 (patch) | |
tree | 15bfa7e4a9c098511c1fc89e2b2c240520b85e2d /src/widgets/styles | |
parent | 4bfff6a98b59b32605d881a463ad3edc221a7dc8 (diff) | |
parent | a96656a8fb6a3c1fc7765659efff28f807fd0deb (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/plugins/platforms/xcb/qxcbconnection.h
src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
src/plugins/styles/mac/qmacstyle_mac.mm
src/widgets/widgets/qdockarealayout.cpp
src/widgets/widgets/qmainwindow.cpp
src/widgets/widgets/qmainwindowlayout.cpp
src/widgets/widgets/qmainwindowlayout_p.h
tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
tests/auto/other/macnativeevents/BLACKLIST
tests/auto/widgets/widgets/qmenu/BLACKLIST
Change-Id: Ic8e724b80a65e7b1af25511b0e674d209265e567
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 96 | ||||
-rw-r--r-- | src/widgets/styles/qcommonstyle_p.h | 8 | ||||
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qpixmapstyle.cpp | 8 | ||||
-rw-r--r-- | src/widgets/styles/qstyleoption.cpp | 16 | ||||
-rw-r--r-- | src/widgets/styles/qstyleoption.h | 22 | ||||
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 92 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 33 |
8 files changed, 155 insertions, 122 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index ceff1a50a3..c15703ca58 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -41,13 +41,17 @@ #include "qcommonstyle_p.h" #include <qfile.h> +#if QT_CONFIG(itemviews) #include <qabstractitemview.h> +#endif #include <qapplication.h> #include <private/qguiapplication_p.h> #include <qpa/qplatformtheme.h> #include <qbitmap.h> #include <qcache.h> +#if QT_CONFIG(dockwidget) #include <qdockwidget.h> +#endif #include <qdrawutil.h> #if QT_CONFIG(dialogbuttonbox) #include <qdialogbuttonbox.h> @@ -65,8 +69,12 @@ #include <qpainterpath.h> #include <qslider.h> #include <qstyleoption.h> +#if QT_CONFIG(tabbar) #include <qtabbar.h> +#endif +#if QT_CONFIG(tabwidget) #include <qtabwidget.h> +#endif #include <qtoolbar.h> #include <qtoolbutton.h> #if QT_CONFIG(rubberband) @@ -91,7 +99,7 @@ #include <limits.h> -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) # include "private/qtextengine_p.h" #endif @@ -362,7 +370,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q p->setPen(oldPen); } break; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case PE_FrameTabBarBase: if (const QStyleOptionTabBarBase *tbb = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) { @@ -425,7 +433,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q } #else Q_UNUSED(d); -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) case PE_FrameTabWidget: case PE_FrameWindow: qDrawWinPanel(p, opt->rect, opt->palette, false, 0); @@ -450,7 +458,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q } break; #endif // QT_NO_GROUPBOX -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) case PE_FrameDockWidget: if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) { int lw = frame->lineWidth; @@ -460,7 +468,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q qDrawShadePanel(p, frame->rect, frame->palette, false, lw); } break; -#endif // QT_NO_DOCKWIDGET +#endif // QT_CONFIG(dockwidget) #ifndef QT_NO_TOOLBAR case PE_IndicatorToolBarHandle: p->save(); @@ -569,7 +577,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q p->setBrush(oldBrush); break; } -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case PE_IndicatorTabTear: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { bool rtl = tab->direction == Qt::RightToLeft; @@ -603,7 +611,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q p->drawPath(path); } break; -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) #ifndef QT_NO_LINEEDIT case PE_PanelLineEdit: if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) { @@ -675,7 +683,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q else p->drawRect(rect); break; } -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) case PE_PanelItemViewRow: if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) { QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled)) @@ -713,7 +721,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q } } break; -#endif //QT_NO_ITEMVIEWS +#endif // QT_CONFIG(itemviews) case PE_PanelScrollAreaCorner: { const QBrush brush(opt->palette.brush(QPalette::Window)); p->fillRect(opt->rect, brush); @@ -824,7 +832,7 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut } #endif // QT_NO_TOOLBUTTON -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth) { @@ -1095,10 +1103,10 @@ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItem *opt, QRect *textRect = display; } } -#endif // QT_NO_ITEMVIEWS +#endif // QT_CONFIG(itemviews) -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) /*! \internal Compute the textRect and the pixmapRect from the opt rect @@ -1165,7 +1173,7 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *w *textRect = tr; } -#endif //QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) #ifndef QT_NO_ANIMATION /*! \internal */ @@ -1712,7 +1720,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, } break; #endif // QT_NO_TOOLBOX -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case CE_TabBarTab: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { proxy()->drawControl(CE_TabBarTabShape, tab, p, widget); @@ -1932,7 +1940,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, } } break; -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) #ifndef QT_NO_SIZEGRIP case CE_SizeGrip: { p->save(); @@ -2036,7 +2044,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, } break; } #endif // QT_CONFIG(rubberband) -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) case CE_DockWidgetTitle: if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) { QRect r = dwOpt->rect.adjusted(0, 0, -1, -1); @@ -2068,7 +2076,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, } } break; -#endif // QT_NO_DOCKWIDGET +#endif // QT_CONFIG(dockwidget) case CE_Header: if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) { QRegion clipRegion = p->clipRegion(); @@ -2096,7 +2104,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<const QStyleOptionComboBox *>(opt)) { QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); @@ -2128,7 +2136,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<const QStyleOptionToolBar *>(opt)) { @@ -2168,7 +2176,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, } break; -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) case CE_ItemViewItem: if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) { p->save(); @@ -2248,7 +2256,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, } break; -#endif // QT_NO_ITEMVIEWS +#endif // QT_CONFIG(itemviews) #ifndef QT_NO_FRAME case CE_ShapedFrame: if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) { @@ -2505,7 +2513,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<const QStyleOptionComboBox *>(opt)) { int margin = cb->frame ? 3 : 0; @@ -2514,7 +2522,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; @@ -2564,7 +2572,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, r = subElementRect(SE_CheckBoxFocusRect, opt, widget); r |= subElementRect(SE_CheckBoxIndicator, opt, widget); break; -#ifndef QT_NO_TABWIDGET +#if QT_CONFIG(tabwidget) case SE_TabWidgetTabBar: if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { @@ -2806,8 +2814,8 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, } break; -#endif // QT_NO_TABWIDGET -#ifndef QT_NO_TABBAR +#endif // QT_CONFIG(tabwidget) +#if QT_CONFIG(tabbar) case SE_TabBarTearIndicator: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { switch (tab->shape) { @@ -2919,7 +2927,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, r = f->rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); } break; -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) case SE_DockWidgetCloseButton: case SE_DockWidgetFloatButton: case SE_DockWidgetTitleBarText: @@ -3020,7 +3028,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, break; } #endif -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) case SE_ItemViewItemCheckIndicator: if (!qstyleoption_cast<const QStyleOptionViewItem *>(opt)) { r = subElementRect(SE_CheckBoxIndicator, opt, widget); @@ -3047,7 +3055,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, r = d->displayRect; } break; -#endif //QT_NO_ITEMVIEWS +#endif // QT_CONFIG(itemviews) #ifndef QT_NO_TOOLBAR case SE_ToolBarHandle: if (const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) { @@ -3439,7 +3447,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl 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 +#if QT_CONFIG(dockwidget) || qobject_cast<const QDockWidget *>(widget) #endif ) @@ -3892,7 +3900,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<const QStyleOptionComboBox *>(opt)) { QRect r; @@ -3907,7 +3915,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<const QStyleOptionGroupBox *>(opt)) { @@ -4140,7 +4148,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<const QStyleOptionComboBox *>(opt)) { int x = cb->rect.x(), @@ -4172,7 +4180,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<const QStyleOptionTitleBar *>(opt)) { const int controlMargin = 2; @@ -4412,7 +4420,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) { if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool) { ret = qMax(widget ? widget->fontMetrics().height() : opt->fontMetrics.height(), 16); -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) } else if (qobject_cast<const QDockWidget*>(widget)) { ret = qMax(widget->fontMetrics().height(), int(QStyleHelper::dpiScaled(13))); #endif @@ -4524,7 +4532,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid } break; #endif // QT_NO_SLIDER -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) case PM_DockWidgetSeparatorExtent: ret = int(QStyleHelper::dpiScaled(6.)); break; @@ -4538,7 +4546,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid case PM_DockWidgetFrameWidth: ret = 1; break; -#endif // QT_NO_DOCKWIDGET +#endif // QT_CONFIG(dockwidget) case PM_SpinBoxSliderHeight: case PM_MenuBarPanelWidth: @@ -4575,7 +4583,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid break; #endif // QT_NO_TOOLBAR -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case PM_TabBarTabOverlap: ret = 3; break; @@ -4839,7 +4847,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<const QStyleOptionComboBox *>(opt)) { int fw = cmb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0; @@ -4849,7 +4857,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<const QStyleOptionHeader *>(opt)) { bool nullIcon = hdr->icon.isNull(); @@ -4897,7 +4905,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = QSize(1 + 3 * (buttonSize + 1), buttonSize); } break; -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) case CT_ItemViewItem: if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) { QRect decorationRect, displayRect, checkRect; @@ -4909,7 +4917,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, break; #else Q_UNUSED(d); -#endif // QT_NO_ITEMVIEWS +#endif // QT_CONFIG(itemviews) #ifndef QT_NO_SPINBOX case CT_SpinBox: if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { @@ -5177,7 +5185,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_FocusFrame_AboveWidget: ret = false; break; -#ifndef QT_NO_TABWIDGET +#if QT_CONFIG(tabwidget) case SH_TabWidget_DefaultTabPosition: ret = QTabWidget::North; break; @@ -5219,7 +5227,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_ItemView_DrawDelegateFrame: ret = 0; break; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case SH_TabBar_CloseButtonPosition: ret = QTabBar::RightSide; break; diff --git a/src/widgets/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h index ebfc06139c..93db75ac2d 100644 --- a/src/widgets/styles/qcommonstyle_p.h +++ b/src/widgets/styles/qcommonstyle_p.h @@ -68,7 +68,7 @@ class Q_WIDGETS_EXPORT QCommonStylePrivate : public QStylePrivate Q_DECLARE_PUBLIC(QCommonStyle) public: inline QCommonStylePrivate() : -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) cachedOption(0), #endif animationFps(30) @@ -79,12 +79,12 @@ public: #ifndef QT_NO_ANIMATION qDeleteAll(animations); #endif -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) delete cachedOption; #endif } -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) void viewItemDrawText(QPainter *p, const QStyleOptionViewItem *option, const QRect &rect) const; void viewItemLayout(const QStyleOptionViewItem *opt, QRect *checkRect, QRect *pixmapRect, QRect *textRect, bool sizehint) const; @@ -110,7 +110,7 @@ public: } #endif mutable QIcon tabBarcloseButtonIcon; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) void tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect, QRect *pixmapRect) const; #endif diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 1e584f47b8..c1b240a381 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 <qcombobox.h> +#endif #if QT_CONFIG(pushbutton) #include <qpushbutton.h> #endif diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp index 88482d28c9..63308a5e36 100644 --- a/src/widgets/styles/qpixmapstyle.cpp +++ b/src/widgets/styles/qpixmapstyle.cpp @@ -52,10 +52,16 @@ #include <QProgressBar> #include <QSlider> #include <QEvent> +#if QT_CONFIG(combobox) #include <QComboBox> +#endif +#if QT_CONFIG(itemviews) #include <QAbstractItemView> -#include <QListView> #include <QStyledItemDelegate> +#endif +#if QT_CONFIG(listview) +#include <QListView> +#endif #include <QAbstractScrollArea> #include <QScrollBar> diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 51fecd0d13..a346ee18c4 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -1227,7 +1227,7 @@ QStyleOptionToolBar::QStyleOptionToolBar(int version) #endif -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) /*! \class QStyleOptionTab \brief The QStyleOptionTab class is used to describe the @@ -1475,7 +1475,7 @@ QStyleOptionTab::QStyleOptionTab(int version) The default value is QSize(-1, -1), i.e. an invalid size; */ -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) /*! \class QStyleOptionProgressBar @@ -2996,7 +2996,7 @@ QStyleOptionTitleBar::QStyleOptionTitleBar(int version) \sa Qt::WindowFlags */ -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) /*! \class QStyleOptionViewItem \brief The QStyleOptionViewItem class is used to describe the @@ -3263,7 +3263,7 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version) therefore both at the beginning and the end. */ -#endif // QT_NO_ITEMVIEWS +#endif // QT_CONFIG(itemviews) /*! \fn T qstyleoption_cast<T>(const QStyleOption *option) \relates QStyleOption @@ -3286,7 +3286,7 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version) Returns a T or 0 depending on the type of the given \a option. */ -#ifndef QT_NO_TABWIDGET +#if QT_CONFIG(tabwidget) /*! \class QStyleOptionTabWidgetFrame \brief The QStyleOptionTabWidgetFrame class is used to describe the @@ -3430,9 +3430,9 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version) and the height set to 0. */ -#endif // QT_NO_TABWIDGET +#endif // QT_CONFIG(tabwidget) -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) /*! \class QStyleOptionTabBarBase @@ -3552,7 +3552,7 @@ QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version) The default value is false; */ -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) #ifndef QT_NO_SIZEGRIP /*! diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h index a3ed35c762..af97479ef0 100644 --- a/src/widgets/styles/qstyleoption.h +++ b/src/widgets/styles/qstyleoption.h @@ -47,13 +47,17 @@ #include <QtGui/qmatrix.h> #include <QtWidgets/qslider.h> #include <QtWidgets/qstyle.h> +#if QT_CONFIG(tabbar) #include <QtWidgets/qtabbar.h> +#endif +#if QT_CONFIG(tabwidget) #include <QtWidgets/qtabwidget.h> +#endif #if QT_CONFIG(rubberband) #include <QtWidgets/qrubberband.h> #endif #include <QtWidgets/qframe.h> -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) # include <QtCore/qabstractitemmodel.h> #endif @@ -143,7 +147,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionFrame::FrameFeatures) typedef Q_DECL_DEPRECATED QStyleOptionFrame QStyleOptionFrameV2; typedef Q_DECL_DEPRECATED QStyleOptionFrame QStyleOptionFrameV3; -#ifndef QT_NO_TABWIDGET +#if QT_CONFIG(tabwidget) class Q_WIDGETS_EXPORT QStyleOptionTabWidgetFrame : public QStyleOption { public: @@ -168,10 +172,10 @@ protected: }; typedef Q_DECL_DEPRECATED QStyleOptionTabWidgetFrame QStyleOptionTabWidgetFrameV2; -#endif // QT_NO_TABWIDGET +#endif // QT_CONFIG(tabwidget) -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) class Q_WIDGETS_EXPORT QStyleOptionTabBarBase : public QStyleOption { public: @@ -191,7 +195,7 @@ protected: }; typedef Q_DECL_DEPRECATED QStyleOptionTabBarBase QStyleOptionTabBarBaseV2; -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) class Q_WIDGETS_EXPORT QStyleOptionHeader : public QStyleOption { @@ -245,7 +249,7 @@ protected: Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionButton::ButtonFeatures) -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) class Q_WIDGETS_EXPORT QStyleOptionTab : public QStyleOption { public: @@ -284,7 +288,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionTab::CornerWidgets) typedef Q_DECL_DEPRECATED QStyleOptionTab QStyleOptionTabV2; typedef Q_DECL_DEPRECATED QStyleOptionTab QStyleOptionTabV3; -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) #ifndef QT_NO_TOOLBAR @@ -388,7 +392,7 @@ protected: typedef Q_DECL_DEPRECATED QStyleOptionDockWidget QStyleOptionDockWidgetV2; -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) class Q_WIDGETS_EXPORT QStyleOptionViewItem : public QStyleOption { @@ -443,7 +447,7 @@ typedef Q_DECL_DEPRECATED QStyleOptionViewItem QStyleOptionViewItemV2; typedef Q_DECL_DEPRECATED QStyleOptionViewItem QStyleOptionViewItemV3; typedef Q_DECL_DEPRECATED QStyleOptionViewItem QStyleOptionViewItemV4; -#endif // QT_NO_ITEMVIEWS +#endif // QT_CONFIG(itemviews) class Q_WIDGETS_EXPORT QStyleOptionToolBox : public QStyleOption { diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 4fe697a32f..b42876d72e 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -51,7 +51,9 @@ #include <qstyleoption.h> #include <qlineedit.h> #include <private/qwindowsstyle_p.h> +#if QT_CONFIG(combobox) #include <qcombobox.h> +#endif #include "private/qcssparser_p.h" #include "private/qmath_p.h" #include <qabstractscrollarea.h> @@ -69,13 +71,19 @@ #include <qcheckbox.h> #endif #include <qstatusbar.h> +#if QT_CONFIG(itemviews) #include <qheaderview.h> +#endif #include <private/qwindowsstyle_p_p.h> #include <private/qstyleanimation_p.h> +#if QT_CONFIG(tabbar) #include <qtabbar.h> +#endif #include <QMetaProperty> #include <qmainwindow.h> +#if QT_CONFIG(dockwidget) #include <qdockwidget.h> +#endif #include <qmdisubwindow.h> #if QT_CONFIG(dialog) #include <qdialog.h> @@ -1641,7 +1649,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<const QComboBox *>(w)) return base->pixelMetric(QStyle::PM_ComboBoxFrameWidth, 0, w); #endif @@ -1719,7 +1727,7 @@ static quint64 pseudoClass(QStyle::State state) static void qt_check_if_internal_object(const QObject **obj, int *element) { -#ifdef QT_NO_DOCKWIDGET +#if !QT_CONFIG(dockwidget) Q_UNUSED(obj); Q_UNUSED(element); #else @@ -1885,7 +1893,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption extraClass |= PseudoClass_NextSelected; else if (hdr->selectedPosition == QStyleOptionHeader::PreviousIsSelected) extraClass |= PseudoClass_PreviousSelected; -#ifndef QT_NO_TABWIDGET +#if QT_CONFIG(tabwidget) } else if (const QStyleOptionTabWidgetFrame *tab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { switch (tab->shape) { case QTabBar::RoundedNorth: @@ -1908,7 +1916,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption break; } #endif -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) } else if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { if (tab->position == QStyleOptionTab::OnlyOneTab) extraClass |= PseudoClass_OnlyOne; @@ -1944,7 +1952,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption default: break; } -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) } else if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { if (btn->features & QStyleOptionButton::Flat) extraClass |= PseudoClass_Flat; @@ -1994,7 +2002,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption extraClass |= PseudoClass_PreviousSelected; } #endif // QT_NO_TOOLBOX -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) else if (const QStyleOptionDockWidget *dw = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) { if (dw->verticalTitleBar) extraClass |= PseudoClass_Vertical; @@ -2007,8 +2015,8 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption if (dw->movable) extraClass |= PseudoClass_Movable; } -#endif // QT_NO_DOCKWIDGET -#ifndef QT_NO_ITEMVIEWS +#endif // QT_CONFIG(dockwidget) +#if QT_CONFIG(itemviews) else if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) { if (vopt->features & QStyleOptionViewItem::Alternate) extraClass |= PseudoClass_Alternate; @@ -2340,7 +2348,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<QComboBox *>(w)) { if (cmb->isEditable()) return cmb->lineEdit(); @@ -2374,7 +2382,7 @@ static QWidget *containerWidget(const QWidget *w) #ifndef QT_NO_LINEEDIT if (qobject_cast<const QLineEdit *>(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<const QComboBox *>(w->parentWidget())) return w->parentWidget(); #endif @@ -2413,7 +2421,7 @@ static bool unstylable(const QWidget *w) // detect QComboBoxPrivateContainer else if (qobject_cast<const QFrame *>(w)) { if (0 -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) || qobject_cast<const QComboBox *>(w->parentWidget()) #endif ) @@ -2421,7 +2429,7 @@ static bool unstylable(const QWidget *w) } #endif -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) if (w->metaObject() == &QWidget::staticMetaObject && qobject_cast<const QTabBar*>(w->parentWidget())) return true; // The moving tab of a QTabBar @@ -2438,7 +2446,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<const QComboBox *>(w)) { if (combo->isEditable()) pc |= (combo->isEditable() ? PseudoClass_Editable : PseudoClass_ReadOnly); @@ -2805,10 +2813,10 @@ void QStyleSheetStyle::polish(QWidget *w) QRenderRule rule = renderRule(w, PseudoElement_None, PseudoClass_Any); if (rule.hasDrawable() || rule.hasBox()) { if (w->metaObject() == &QWidget::staticMetaObject -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) || qobject_cast<QHeaderView *>(w) #endif -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) || qobject_cast<QTabBar *>(w) #endif #ifndef QT_NO_FRAME @@ -2912,7 +2920,7 @@ void QStyleSheetStyle::unpolish(QApplication *app) styleSheetCaches->styleSheetCache.remove(qApp); } -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) inline static bool verticalTabs(QTabBar::Shape shape) { return shape == QTabBar::RoundedWest @@ -2920,7 +2928,7 @@ inline static bool verticalTabs(QTabBar::Shape shape) || shape == QTabBar::TriangularWest || shape == QTabBar::TriangularEast; } -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w) const @@ -3771,7 +3779,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; @@ -3807,7 +3815,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) @@ -4069,7 +4077,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q fallback = true; break; -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) case CE_ItemViewItem: if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) { QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem); @@ -4086,9 +4094,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q return; } break; -#endif // QT_NO_ITEMVIEWS +#endif // QT_CONFIG(itemviews) -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case CE_TabBarTab: if (hasStyleRule(w, PseudoElement_TabBarTab)) { QWindowsStyle::drawControl(ce, opt, p, w); @@ -4123,7 +4131,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q return; } break; -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) case CE_ColumnViewGrip: if (rule.hasDrawable()) { @@ -4477,7 +4485,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op rule.drawBorder(p, opt->rect); return; -#ifndef QT_NO_TABWIDGET +#if QT_CONFIG(tabwidget) case PE_FrameTabWidget: if (const QStyleOptionTabWidgetFrame *frm = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { QRenderRule subRule = renderRule(w, opt, PseudoElement_TabWidgetPane); @@ -4492,7 +4500,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op return; } break; -#endif // QT_NO_TABWIDGET +#endif // QT_CONFIG(tabwidget) case PE_IndicatorProgressChunk: pseudoElement = PseudoElement_ProgressBarChunk; @@ -4530,7 +4538,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op case PE_IndicatorSpinPlus: pseudoElement = PseudoElement_SpinBoxUpArrow; break; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case PE_IndicatorTabClose: if (w) w = w->parentWidget(); //match on the QTabBar instead of the CloseButton @@ -4790,7 +4798,7 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const } break; -#ifndef QT_NO_TABWIDGET +#if QT_CONFIG(tabwidget) case PM_TabBarTabHSpace: case PM_TabBarTabVSpace: subRule = renderRule(w, opt, PseudoElement_TabBarTab); @@ -4823,7 +4831,7 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const } break; } -#endif // QT_NO_TABWIDGET +#endif // QT_CONFIG(tabwidget) case PM_SliderThickness: // horizontal slider's height (sizeHint) case PM_SliderLength: // minimum length of slider @@ -5051,7 +5059,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op return rule.boxSize(sz); break; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case CT_TabBarTab: { QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab); if (subRule.hasBox() || !subRule.hasNativeBorder()) { @@ -5075,7 +5083,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op sz = subRule.adjustSize(csz); break; } -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) case CT_MdiControls: if (const QStyleOptionComplex *ccOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) { @@ -5107,7 +5115,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op } break; -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) case CT_ItemViewItem: { QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem); sz = baseStyle()->sizeFromContents(ct, opt, csz, w); @@ -5116,7 +5124,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op sz = subRule.boxSize(sz); return sz; } -#endif // QT_NO_ITEMVIEWS +#endif // QT_CONFIG(itemviews) default: break; @@ -5275,16 +5283,16 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi case SH_ScrollBar_RollBetweenButtons: s = QLatin1String("scrollbar-roll-between-buttons"); break; case SH_ScrollBar_ScrollWhenPointerLeavesControl: s = QLatin1String("scrollbar-scroll-when-pointer-leaves-control"); break; case SH_TabBar_Alignment: -#ifndef QT_NO_TABWIDGET +#if QT_CONFIG(tabwidget) if (qobject_cast<const QTabWidget *>(w)) { rule = renderRule(w, opt, PseudoElement_TabWidgetTabBar); if (rule.hasPosition()) return rule.position()->position; } -#endif // QT_NO_TABWIDGET +#endif // QT_CONFIG(tabwidget) s = QLatin1String("alignment"); break; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case SH_TabBar_CloseButtonPosition: rule = renderRule(w, opt, PseudoElement_TabBarTabCloseButton); if (rule.hasPosition()) { @@ -5299,7 +5307,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<const QComboBox *>(w)) { QAbstractItemView *view = w->findChild<QAbstractItemView *>(); if (view) { @@ -5309,7 +5317,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; @@ -5692,7 +5700,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c RECURSION_GUARD(return baseStyle()->subElementRect(se, opt, w)) QRenderRule rule = renderRule(w, opt); -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) int pe = PseudoElement_None; #endif @@ -5758,7 +5766,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c case SE_CheckBoxClickRect: // relies on indicator and contents return ParentStyle::subElementRect(se, opt, w); -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) case SE_ViewItemCheckIndicator: if (!qstyleoption_cast<const QStyleOptionViewItem *>(opt)) { return subElementRect(SE_CheckBoxIndicator, opt, w); @@ -5787,7 +5795,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c } } break; -#endif // QT_NO_ITEMVIEWS +#endif // QT_CONFIG(itemviews) case SE_HeaderArrow: { QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewUpArrow); @@ -5820,7 +5828,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c } break; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case SE_TabWidgetLeftCorner: pe = PseudoElement_TabWidgetLeftCorner; // intentionally falls through @@ -5887,7 +5895,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c } break; } -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) case SE_DockWidgetCloseButton: case SE_DockWidgetFloatButton: { diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index f805e29db1..63f7cd43ef 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -55,7 +55,9 @@ #include "qrubberband.h" #endif #include "qstyleoption.h" +#if QT_CONFIG(tabbar) #include "qtabbar.h" +#endif #include "qwidget.h" #include "qdebug.h" #include "qmainwindow.h" @@ -65,7 +67,9 @@ #if QT_CONFIG(wizard) #include "qwizard.h" #endif +#if QT_CONFIG(listview) #include "qlistview.h" +#endif #include <private/qmath_p.h> #include <qmath.h> #include <QtGui/qscreen.h> @@ -332,7 +336,7 @@ int QWindowsStylePrivate::fixedPixelMetric(QStyle::PixelMetric pm) break; case QStyle::PM_DockWidgetSeparatorExtent: return 4; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case QStyle::PM_TabBarTabShiftHorizontal: return 0; case QStyle::PM_TabBarTabShiftVertical: @@ -548,7 +552,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid break; case SH_ItemView_ShowDecorationSelected: -#ifndef QT_NO_LISTVIEW +#if QT_CONFIG(listview) if (qobject_cast<const QListView*>(widget)) ret = 1; #endif @@ -715,7 +719,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, case PE_FrameButtonTool: case PE_PanelButtonTool: { QPen oldPen = p->pen(); -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) if (w && w->inherits("QDockWidgetTitleButton")) { if (const QWidget *dw = w->parentWidget()) if (dw->isWindow()){ @@ -725,7 +729,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, return; } } -#endif // QT_NO_DOCKWIDGET +#endif // QT_CONFIG(dockwidget) QBrush fill; bool stippled; bool panel = (pe == PE_PanelButtonTool); @@ -1020,7 +1024,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, popupPal.setColor(QPalette::Midlight, opt->palette.light().color()); qDrawWinPanel(p, opt->rect, popupPal, opt->state & State_Sunken); break; } -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) case PE_IndicatorDockWidgetResizeHandle: break; case PE_FrameDockWidget: @@ -1028,7 +1032,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, proxy()->drawPrimitive(QStyle::PE_FrameWindow, opt, p, w); } break; -#endif // QT_NO_DOCKWIDGET +#endif // QT_CONFIG(dockwidget) case PE_FrameStatusBarItem: qDrawShadePanel(p, opt->rect, opt->palette, true, 1, 0); @@ -1281,7 +1285,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai } break; #endif // QT_NO_MENUBAR -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case CE_TabBarTabShape: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { bool rtlHorTabs = (tab->direction == Qt::RightToLeft @@ -1484,7 +1488,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai } } break; -#endif // QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) case CE_ToolBoxTabShape: qDrawShadePanel(p, opt->rect, opt->palette, opt->state & (State_Sunken | State_On), 1, @@ -1617,6 +1621,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai default: break; } + Q_FALLTHROUGH(); // It continues in the end of the next case case Qt::TopToolBarArea : switch(toolbar->positionWithinLine){ case QStyleOptionToolBar::Beginning: @@ -1782,7 +1787,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai } break; -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) case CE_DockWidgetTitle: if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) { @@ -1856,8 +1861,8 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->restore(); } return; -#endif // QT_NO_DOCKWIDGET -#ifndef QT_NO_COMBOBOX +#endif // QT_CONFIG(dockwidget) +#if QT_CONFIG(combobox) case CE_ComboBoxLabel: if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { if (cb->state & State_HasFocus) { @@ -1870,7 +1875,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); } @@ -2148,7 +2153,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<const QStyleOptionComboBox *>(opt)) { QBrush editBrush = cmb->palette.brush(QPalette::Base); @@ -2221,7 +2226,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<const QStyleOptionSpinBox *>(opt)) { |