diff options
Diffstat (limited to 'src/plugins/styles')
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac.mm | 74 | ||||
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac_p_p.h | 8 | ||||
-rw-r--r-- | src/plugins/styles/windowsvista/qwindowsvistastyle.cpp | 12 | ||||
-rw-r--r-- | src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h | 6 | ||||
-rw-r--r-- | src/plugins/styles/windowsvista/qwindowsxpstyle.cpp | 22 |
5 files changed, 73 insertions, 49 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 6266728c84..a6ece7632a 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -52,16 +52,22 @@ //#define DEBUG_SIZE_CONSTRAINT #include <private/qcore_mac_p.h> -#include <private/qcombobox_p.h> +#if QT_CONFIG(tabbar) #include <private/qtabbar_p.h> +#endif #include <private/qpainter_p.h> #include <qapplication.h> #include <qbitmap.h> +#if QT_CONFIG(combobox) +#include <private/qcombobox_p.h> #include <qcombobox.h> +#endif #if QT_CONFIG(dialogbuttonbox) #include <qdialogbuttonbox.h> #endif +#if QT_CONFIG(dockwidget) #include <qdockwidget.h> +#endif #include <qevent.h> #include <qfocusframe.h> #include <qformlayout.h> @@ -287,7 +293,7 @@ static const QColor tabBarCloseButtonCrossSelected(115, 115, 115); static const int closeButtonSize = 14; static const qreal closeButtonCornerRadius = 2.0; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) static bool isVerticalTabs(const QTabBar::Shape shape) { return (shape == QTabBar::RoundedEast || shape == QTabBar::TriangularEast @@ -363,7 +369,7 @@ static void drawTabCloseButton(QPainter *p, bool hover, bool selected, bool pres p->drawLine(margin, height - margin, width - margin, margin); } -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) QRect rotateTabPainter(QPainter *p, QTabBar::Shape shape, QRect tabRect) { if (isVerticalTabs(shape)) { @@ -502,7 +508,7 @@ static inline bool isTreeView(const QWidget *widget) } #endif -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape) { ThemeTabDirection ttd; @@ -771,7 +777,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg else if (qobject_cast<const QCheckBox *>(widg)) ct = QStyle::CT_CheckBox; #endif -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) else if (qobject_cast<const QComboBox *>(widg)) ct = QStyle::CT_ComboBox; #endif @@ -1017,7 +1023,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<QComboBox *>(widg->parentWidget())) { //should I take into account the font dimentions of the lineedit? -Sam @@ -1145,17 +1151,17 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRect &targetRect, int h NSBezierPath *focusRingPath; if (radius > 0) { const CGFloat roundedRectInset = -1.5; - focusRingPath = [NSBezierPath bezierPathWithRoundedRect:CGRectInset(focusRingRect, roundedRectInset, roundedRectInset) + focusRingPath = [NSBezierPath bezierPathWithRoundedRect:NSRectFromCGRect(CGRectInset(focusRingRect, roundedRectInset, roundedRectInset)) xRadius:radius yRadius:radius]; } else { const CGFloat outerClipInset = -focusRingWidth / 2; - NSBezierPath *focusRingClipPath = [NSBezierPath bezierPathWithRect:CGRectInset(focusRingRect, outerClipInset, outerClipInset)]; + NSBezierPath *focusRingClipPath = [NSBezierPath bezierPathWithRect:NSRectFromCGRect(CGRectInset(focusRingRect, outerClipInset, outerClipInset))]; const CGFloat innerClipInset = 1; - NSBezierPath *focusRingInnerClipPath = [NSBezierPath bezierPathWithRect:CGRectInset(focusRingRect, innerClipInset, innerClipInset)]; + NSBezierPath *focusRingInnerClipPath = [NSBezierPath bezierPathWithRect:NSRectFromCGRect(CGRectInset(focusRingRect, innerClipInset, innerClipInset))]; [focusRingClipPath appendBezierPath:focusRingInnerClipPath.bezierPathByReversingPath]; [focusRingClipPath setClip]; - focusRingPath = [NSBezierPath bezierPathWithRect:focusRingRect]; + focusRingPath = [NSBezierPath bezierPathWithRect:NSRectFromCGRect(focusRingRect)]; focusRingPath.lineJoinStyle = NSRoundLineJoinStyle; } @@ -1200,7 +1206,7 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRect &targetRect, int h QRect(focusRingPixmap.width() - shCornerSize, svCornerSize, shCornerSize, focusRingPixmap.width() - 2 * svCornerSize)); } -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const { Q_ASSERT(textRect); @@ -1263,7 +1269,7 @@ void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widg *textRect = tr; } -#endif //QT_NO_TABBAR +#endif // QT_CONFIG(tabbar) QStyleHelper::WidgetSizePolicy QMacStylePrivate::effectiveAquaSizeConstrain(const QStyleOption *option, const QWidget *widg, @@ -2357,7 +2363,7 @@ void QMacStyle::polish(QWidget* w) { #ifndef QT_NO_MENU if (qobject_cast<QMenu*>(w) -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) || qobject_cast<QComboBoxPrivateContainer *>(w) #endif ) { @@ -2382,7 +2388,7 @@ void QMacStyle::polish(QWidget* w) } #endif -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) if (QTabBar *tb = qobject_cast<QTabBar*>(w)) { if (tb->documentMode()) { w->setAttribute(Qt::WA_Hover); @@ -2424,7 +2430,7 @@ void QMacStyle::unpolish(QWidget* w) w->setWindowOpacity(1.0); } -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) if (QComboBox *combo = qobject_cast<QComboBox *>(w)) { if (!combo->isEditable()) { if (QWidget *widget = combo->findChild<QComboBoxPrivateContainer *>()) @@ -2433,7 +2439,7 @@ void QMacStyle::unpolish(QWidget* w) } #endif -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) if (qobject_cast<QTabBar*>(w)) { if (!w->testAttribute(Qt::WA_SetFont)) w->setFont(qApp->font(w)); @@ -2941,7 +2947,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w ret = QEvent::MouseButtonRelease; break; case SH_TabBar_SelectMouseType: -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) if (const QStyleOptionTabBarBase *opt2 = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) { ret = opt2->documentMode ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; } else @@ -2966,7 +2972,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w ret = Qt::AlignRight; break; case SH_TabBar_Alignment: { -#ifndef QT_NO_TABWIDGET +#if QT_CONFIG(tabwidget) if (const QTabWidget *tab = qobject_cast<const QTabWidget*>(w)) { if (tab->documentMode()) { ret = Qt::AlignLeft; @@ -2974,7 +2980,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w } } #endif -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) if (const QTabBar *tab = qobject_cast<const QTabBar*>(w)) { if (tab->documentMode()) { ret = Qt::AlignLeft; @@ -3151,7 +3157,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_ItemView_PaintAlternatingRowColorsForEmptyArea: ret = true; break; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case SH_TabBar_CloseButtonPosition: ret = QTabBar::LeftSide; break; @@ -3282,7 +3288,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai p->drawPath(path); p->restore(); break; } -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case PE_FrameTabBarBase: if (const QStyleOptionTabBarBase *tbb = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) { @@ -3598,7 +3604,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai } break; -#ifndef QT_NO_TABWIDGET +#if QT_CONFIG(tabwidget) case PE_FrameTabWidget: if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { @@ -4112,7 +4118,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w); } break; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case CE_TabBarTabShape: if (const QStyleOptionTab *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(opt)) { if (tabOpt->documentMode) { @@ -4261,7 +4267,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } break; #endif -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) case CE_DockWidgetTitle: if (const QDockWidget *dockWidget = qobject_cast<const QDockWidget *>(w)) { bool floating = dockWidget->isFloating(); @@ -4440,7 +4446,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<const QComboBox *>(w)) { iconSize = comboBox->iconSize(); } @@ -4816,7 +4822,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, int(outRect.size.height)); break; } -#ifndef QT_NO_TABWIDGET +#if QT_CONFIG(tabwidget) case SE_TabWidgetLeftCorner: if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { @@ -4949,7 +4955,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<const QComboBox*>(widget->parentWidget())) rect.adjust(-1, -2, 0, 0); else @@ -5093,7 +5099,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, } rect.setBottom(rect.bottom() - 1); break; -#ifndef QT_NO_TABWIDGET +#if QT_CONFIG(tabwidget) case SE_TabWidgetLayoutItem: if (const QStyleOptionTabWidgetFrame *tabWidgetOpt = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { @@ -5108,7 +5114,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, } break; #endif -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) case SE_DockWidgetCloseButton: case SE_DockWidgetFloatButton: case SE_DockWidgetTitleBarText: @@ -6411,7 +6417,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 QT_CONFIG(tabwidget) if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { QSize extra(0,0); @@ -6427,7 +6433,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, } #endif break; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) case QStyle::CT_TabBarTab: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { const QStyleHelper::WidgetSizePolicy AquaSize = d->aquaSizeConstrain(opt, widget); @@ -6510,7 +6516,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, case QStyle::CT_MenuItem: if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { int maxpmw = mi->maxIconWidth; -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) const QComboBox *comboBox = qobject_cast<const QComboBox *>(widget); #endif int w = sz.width(), @@ -6521,7 +6527,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); @@ -6542,7 +6548,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/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h index 2dff9afacb..8574a52a87 100644 --- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h +++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h @@ -48,7 +48,9 @@ #include <QtWidgets/private/qcommonstyle_p.h> #include "qmacstyle_mac_p.h" #include <private/qapplication_p.h> +#if QT_CONFIG(combobox) #include <private/qcombobox_p.h> +#endif #include <private/qpainter_p.h> #include <private/qstylehelper_p.h> #include <qapplication.h> @@ -60,7 +62,9 @@ #if QT_CONFIG(dialogbuttonbox) #include <qdialogbuttonbox.h> #endif +#if QT_CONFIG(dockwidget) #include <qdockwidget.h> +#endif #include <qevent.h> #include <qfocusframe.h> #include <qformlayout.h> @@ -69,7 +73,9 @@ #include <qheaderview.h> #include <qlayout.h> #include <qlineedit.h> +#if QT_CONFIG(listview) #include <qlistview.h> +#endif #include <qmainwindow.h> #include <qmap.h> #include <qmenubar.h> @@ -249,7 +255,7 @@ public: void drawFocusRing(QPainter *p, const QRect &targetRect, int hMargin, int vMargin, qreal radius = 0) const; -#ifndef QT_NO_TABBAR +#if QT_CONFIG(tabbar) void tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const; #endif diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp index ebd3934c90..60a5c25b1f 100644 --- a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp @@ -1436,7 +1436,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption } } break; -#ifndef QT_NO_ITEMVIEWS +#if QT_CONFIG(itemviews) case CE_ItemViewItem: { const QStyleOptionViewItem *vopt; @@ -1471,12 +1471,12 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption } break; } -#endif // QT_NO_ITEMVIEWS -#ifndef QT_NO_COMBOBOX +#endif // QT_CONFIG(itemviews) +#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; @@ -2119,7 +2119,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<const QStyleOptionComboBox *>(option)) { int x = cb->rect.x(), @@ -2152,7 +2152,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<const QStyleOptionTitleBar *>(option)) { if (!buttonVisible(subControl, tb)) diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h b/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h index c8e9edeb3b..14af2c6bbc 100644 --- a/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h +++ b/src/plugins/styles/windowsvista/qwindowsvistastyle_p_p.h @@ -70,11 +70,17 @@ #include <qtoolbutton.h> #include <qspinbox.h> #include <qtoolbar.h> +#if QT_CONFIG(combobox) #include <qcombobox.h> +#endif #include <qscrollbar.h> #include <qprogressbar.h> +#if QT_CONFIG(dockwidget) #include <qdockwidget.h> +#endif +#if QT_CONFIG(listview) #include <qlistview.h> +#endif #if QT_CONFIG(treeview) #include <qtreeview.h> #endif diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index e670794cd3..a3a665f22b 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -56,12 +56,18 @@ #include <qdesktopwidget.h> #include <qtoolbutton.h> +#if QT_CONFIG(tabbar) #include <qtabbar.h> +#endif +#if QT_CONFIG(combobox) #include <qcombobox.h> +#endif #include <qscrollbar.h> #include <qheaderview.h> #include <qspinbox.h> +#if QT_CONFIG(listview) #include <qlistview.h> +#endif #include <qstackedwidget.h> #if QT_CONFIG(pushbutton) #include <qpushbutton.h> @@ -1151,9 +1157,9 @@ void QWindowsXPStyle::polish(QWidget *widget) #endif || qobject_cast<QToolButton*>(widget) || qobject_cast<QTabBar*>(widget) -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) || qobject_cast<QComboBox*>(widget) -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) || qobject_cast<QScrollBar*>(widget) || qobject_cast<QSlider*>(widget) || qobject_cast<QHeaderView*>(widget) @@ -1226,9 +1232,9 @@ void QWindowsXPStyle::unpolish(QWidget *widget) #endif || qobject_cast<QToolButton*>(widget) || qobject_cast<QTabBar*>(widget) -#ifndef QT_NO_COMBOBOX +#if QT_CONFIG(combobox) || qobject_cast<QComboBox*>(widget) -#endif // QT_NO_COMBOBOX +#endif // QT_CONFIG(combobox) || qobject_cast<QScrollBar*>(widget) || qobject_cast<QSlider*>(widget) || qobject_cast<QHeaderView*>(widget) @@ -2292,7 +2298,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op drawItemText(p, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole); } return; -#ifndef QT_NO_DOCKWIDGET +#if QT_CONFIG(dockwidget) case CE_DockWidgetTitle: if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) { @@ -2417,7 +2423,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op return; } break; -#endif // QT_NO_DOCKWIDGET +#endif // QT_CONFIG(dockwidget) #if QT_CONFIG(rubberband) case CE_RubberBand: if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) { @@ -2554,7 +2560,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<const QStyleOptionComboBox *>(option)) { @@ -2605,7 +2611,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<const QStyleOptionSlider *>(option)) { |