diff options
Diffstat (limited to 'src/plugins/styles')
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac.mm | 104 | ||||
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac_p_p.h | 119 | ||||
-rw-r--r-- | src/plugins/styles/windowsvista/qwindowsxpstyle.cpp | 17 | ||||
-rw-r--r-- | src/plugins/styles/windowsvista/windowsvista.pro | 2 |
4 files changed, 100 insertions, 142 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 01eaa24e80..05c397a6f1 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -50,92 +50,30 @@ #define QMAC_QAQUASTYLE_SIZE_CONSTRAIN //#define DEBUG_SIZE_CONSTRAINT -#include <private/qcore_mac_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> -#include <qgroupbox.h> -#include <qhash.h> -#include <qheaderview.h> -#if QT_CONFIG(lineedit) -#include <qlineedit.h> -#endif -#if QT_CONFIG(mainwindow) -#include <qmainwindow.h> -#endif +#include <QtCore/qoperatingsystemversion.h> +#include <QtCore/qvariant.h> +#include <QtCore/qvarlengtharray.h> + +#include <QtCore/private/qcore_mac_p.h> + +#include <QtGui/private/qcoregraphics_p.h> +#include <QtGui/qpa/qplatformfontdatabase.h> +#include <QtGui/qpa/qplatformtheme.h> + +#include <QtWidgets/private/qstyleanimation_p.h> + #if QT_CONFIG(mdiarea) -#include <qmdisubwindow.h> -#endif -#if QT_CONFIG(menubar) -#include <qmenubar.h> -#endif -#include <qpaintdevice.h> -#include <qpainter.h> -#include <qpixmapcache.h> -#include <qpointer.h> -#if QT_CONFIG(progressbar) -#include <qprogressbar.h> -#endif -#if QT_CONFIG(pushbutton) -#include <qpushbutton.h> -#endif -#include <qradiobutton.h> -#if QT_CONFIG(rubberband) -#include <qrubberband.h> +#include <QtWidgets/qmdisubwindow.h> #endif #if QT_CONFIG(scrollbar) -#include <qscrollbar.h> -#endif -#if QT_CONFIG(sizegrip) -#include <qsizegrip.h> +#include <QtWidgets/qscrollbar.h> #endif -#include <qstyleoption.h> -#include <qtoolbar.h> -#if QT_CONFIG(toolbutton) -#include <qtoolbutton.h> -#endif -#if QT_CONFIG(treeview) -#include <qtreeview.h> -#endif -#if QT_CONFIG(tableview) -#include <qtableview.h> +#if QT_CONFIG(tabbar) +#include <QtWidgets/private/qtabbar_p.h> #endif -#include <qoperatingsystemversion.h> #if QT_CONFIG(wizard) -#include <qwizard.h> -#endif -#include <qdebug.h> -#if QT_CONFIG(datetimeedit) -#include <qdatetimeedit.h> -#endif -#include <qmath.h> -#include <QtWidgets/qgraphicsproxywidget.h> -#if QT_CONFIG(graphicsview) -#include <QtWidgets/qgraphicsview.h> +#include <QtWidgets/qwizard.h> #endif -#include <QtCore/qvariant.h> -#include <QtCore/qvarlengtharray.h> -#include <private/qstylehelper_p.h> -#include <private/qstyleanimation_p.h> -#include <qpa/qplatformfontdatabase.h> -#include <qpa/qplatformtheme.h> -#include <QtGui/private/qcoregraphics_p.h> QT_USE_NAMESPACE @@ -886,8 +824,10 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg else if (qobject_cast<const QLineEdit *>(widg)) ct = QStyle::CT_LineEdit; #endif +#if QT_CONFIG(itemviews) else if (qobject_cast<const QHeaderView *>(widg)) ct = QStyle::CT_HeaderSection; +#endif #if QT_CONFIG(menubar) else if (qobject_cast<const QMenuBar *>(widg)) ct = QStyle::CT_MenuBar; @@ -2861,9 +2801,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w ret = [NSScroller preferredScrollerStyle] == NSScrollerStyleOverlay; } break; +#if QT_CONFIG(itemviews) case SH_ItemView_ScrollMode: ret = QAbstractItemView::ScrollPerPixel; break; +#endif case SH_TitleBar_ShowToolTipsOnButtons: // min/max/close buttons on windows don't show tool tips ret = false; @@ -4563,6 +4505,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, const int controlSize = getControlSize(opt, widget); switch (sr) { +#if QT_CONFIG(itemviews) case SE_ItemViewItemText: if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) { int fw = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, widget); @@ -4572,6 +4515,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, rect.adjust(-fw, 0, 0, 0); } break; +#endif case SE_ToolBoxTabContents: rect = QCommonStyle::subElementRect(sr, opt, widget); break; @@ -6399,12 +6343,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = sz.expandedTo(QSize(sz.width(), minimumSize)); } break; +#if QT_CONFIG(itemviews) case CT_ItemViewItem: if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) { sz = QCommonStyle::sizeFromContents(ct, vopt, csz, widget); sz.setHeight(sz.height() + 2); } break; +#endif default: sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h index 6b3f525adc..d6af18f01f 100644 --- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h +++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h @@ -41,98 +41,105 @@ #ifndef QMACSTYLE_MAC_P_P_H #define QMACSTYLE_MAC_P_P_H -#include <QtWidgets/private/qtwidgetsglobal_p.h> -#include <QtWidgets/private/qcommonstyle_p.h> #include "qmacstyle_mac_p.h" -#include <private/qapplication_p.h> + +#include <QtCore/qdebug.h> +#include <QtCore/qhash.h> +#include <QtCore/qmap.h> +#include <QtCore/qmath.h> +#include <QtCore/qpair.h> +#include <QtCore/qpointer.h> +#include <QtCore/qtextstream.h> +#include <QtCore/qvector.h> + +#include <QtGui/private/qpainter_p.h> + +#include <QtGui/qbitmap.h> +#include <QtGui/qevent.h> +#include <QtGui/qpaintdevice.h> +#include <QtGui/qpainter.h> +#include <QtGui/qpixmapcache.h> + +#include <QtWidgets/private/qapplication_p.h> +#include <QtWidgets/private/qcommonstyle_p.h> +#include <QtWidgets/private/qstylehelper_p.h> + +#include <QtWidgets/qapplication.h> +#include <QtWidgets/qfocusframe.h> +#include <QtWidgets/qformlayout.h> +#include <QtWidgets/qlayout.h> +#include <QtWidgets/qstyleoption.h> +#include <QtWidgets/qtextedit.h> + +#if QT_CONFIG(checkbox) +#include <QtWidgets/qcheckbox.h> +#endif #if QT_CONFIG(combobox) -#include <private/qcombobox_p.h> +#include <QtWidgets/private/qcombobox_p.h> +#include <QtWidgets/qcombobox.h> #endif -#include <private/qpainter_p.h> -#include <private/qstylehelper_p.h> -#include <qapplication.h> -#include <qbitmap.h> -#if QT_CONFIG(checkbox) -#include <qcheckbox.h> +#if QT_CONFIG(datetimeedit) +#include <QtWidgets/qdatetimeedit.h> #endif -#include <qcombobox.h> #if QT_CONFIG(dialogbuttonbox) -#include <qdialogbuttonbox.h> +#include <QtWidgets/qdialogbuttonbox.h> #endif #if QT_CONFIG(dockwidget) -#include <qdockwidget.h> +#include <QtWidgets/qdockwidget.h> +#endif +#if QT_CONFIG(graphicsview) +#include <QtWidgets/qgraphicsproxywidget.h> +#include <QtWidgets/qgraphicsview.h> #endif -#include <qevent.h> -#include <qfocusframe.h> -#include <qformlayout.h> #if QT_CONFIG(groupbox) -#include <qgroupbox.h> +#include <QtWidgets/qgroupbox.h> +#endif +#if QT_CONFIG(itemviews) +#include <QtWidgets/qheaderview.h> #endif -#include <qhash.h> -#include <qheaderview.h> -#include <qlayout.h> #if QT_CONFIG(lineedit) -#include <qlineedit.h> +#include <QtWidgets/qlineedit.h> #endif #if QT_CONFIG(listview) -#include <qlistview.h> +#include <QtWidgets/qlistview.h> #endif #if QT_CONFIG(mainwindow) -#include <qmainwindow.h> +#include <QtWidgets/qmainwindow.h> #endif -#include <qmap.h> #if QT_CONFIG(menubar) -#include <qmenubar.h> +#include <QtWidgets/qmenubar.h> #endif -#include <qpaintdevice.h> -#include <qpainter.h> -#include <qpixmapcache.h> -#include <qpointer.h> #if QT_CONFIG(progressbar) -#include <qprogressbar.h> +#include <QtWidgets/qprogressbar.h> #endif #if QT_CONFIG(pushbutton) -#include <qpushbutton.h> +#include <QtWidgets/qpushbutton.h> #endif -#include <qradiobutton.h> +#include <QtWidgets/qradiobutton.h> #if QT_CONFIG(rubberband) -#include <qrubberband.h> +#include <QtWidgets/qrubberband.h> #endif #if QT_CONFIG(sizegrip) -#include <qsizegrip.h> +#include <QtWidgets/qsizegrip.h> #endif #if QT_CONFIG(spinbox) -#include <qspinbox.h> +#include <QtWidgets/qspinbox.h> #endif #if QT_CONFIG(splitter) -#include <qsplitter.h> +#include <QtWidgets/qsplitter.h> +#endif +#if QT_CONFIG(tableview) +#include <QtWidgets/qtableview.h> #endif -#include <qstyleoption.h> -#include <qtextedit.h> -#include <qtextstream.h> #if QT_CONFIG(toolbar) -#include <qtoolbar.h> +#include <QtWidgets/qtoolbar.h> #endif #if QT_CONFIG(toolbutton) -#include <qtoolbutton.h> +#include <QtWidgets/qtoolbutton.h> #endif #if QT_CONFIG(treeview) -#include <qtreeview.h> -#endif -#if QT_CONFIG(tableview) -#include <qtableview.h> +#include <QtWidgets/qtreeview.h> #endif -#include <qdebug.h> -#if QT_CONFIG(datetimeedit) -#include <qdatetimeedit.h> -#endif -#include <qmath.h> -#include <qpair.h> -#include <qvector.h> -#include <QtWidgets/qgraphicsproxywidget.h> -#include <QtWidgets/qgraphicsview.h> - - // // W A R N I N G diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index 90026e5bf0..a331b2ee87 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -1486,11 +1486,13 @@ case PE_Frame: // Inner white border p->setPen(QPen(option->palette.base().color(), 0)); - p->drawRect(QRectF(option->rect).adjusted(QStyleHelper::dpiScaled(0.5), QStyleHelper::dpiScaled(0.5), - QStyleHelper::dpiScaled(-1), QStyleHelper::dpiScaled(-1))); + const auto topLevelAdjustment = QStyleHelper::dpiScaled(0.5); + const auto bottomRightAdjustment = QStyleHelper::dpiScaled(-1); + p->drawRect(QRectF(option->rect).adjusted(topLevelAdjustment, topLevelAdjustment, + bottomRightAdjustment, bottomRightAdjustment)); // Outer dark border p->setPen(QPen(bordercolor, 0)); - p->drawRect(QRectF(option->rect).adjusted(0, 0, QStyleHelper::dpiScaled(-0.5), QStyleHelper::dpiScaled(-0.5))); + p->drawRect(QRectF(option->rect).adjusted(0, 0, -topLevelAdjustment, -topLevelAdjustment)); p->setPen(oldPen); return; } else if (fillType == BT_NONE) { @@ -3534,9 +3536,12 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl qRound(QStyleHelper::dpiScaled(16)), he - qRound(QStyleHelper::dpiScaled(2))); break; - case SC_ComboBoxEditField: - rect = QRect(x + qRound(QStyleHelper::dpiScaled(2)), y + qRound(QStyleHelper::dpiScaled(2)), - wi - qRound(QStyleHelper::dpiScaled(3 + 16)), he - qRound(QStyleHelper::dpiScaled(4))); + case SC_ComboBoxEditField: { + const int frame = qRound(QStyleHelper::dpiScaled(2)); + rect = QRect(x + frame, y + frame, + wi - qRound(QStyleHelper::dpiScaled(3 + 16)), + he - qRound(QStyleHelper::dpiScaled(4))); + } break; case SC_ComboBoxListBoxPopup: diff --git a/src/plugins/styles/windowsvista/windowsvista.pro b/src/plugins/styles/windowsvista/windowsvista.pro index f82bcfc91b..c08db7f533 100644 --- a/src/plugins/styles/windowsvista/windowsvista.pro +++ b/src/plugins/styles/windowsvista/windowsvista.pro @@ -10,7 +10,7 @@ SOURCES += qwindowsvistastyle.cpp HEADERS += qwindowsxpstyle_p.h qwindowsxpstyle_p_p.h SOURCES += qwindowsxpstyle.cpp -LIBS_PRIVATE += -lgdi32 -luser32 +QMAKE_USE_PRIVATE += user32 gdi32 # DEFINES/LIBS needed for qwizard_win.cpp and the styles include(../../../widgets/kernel/win.pri) |