diff options
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 10 | ||||
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 8 | ||||
-rw-r--r-- | src/widgets/styles/qmacstyle_mac_p.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/qpixmapstyle.cpp | 4 | ||||
-rw-r--r-- | src/widgets/styles/qstylefactory.cpp | 4 | ||||
-rw-r--r-- | src/widgets/styles/qstyleoption.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsxpstyle.cpp | 36 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsxpstyle_p_p.h | 4 |
10 files changed, 40 insertions, 34 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 140f0ad2f3..690c811140 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5246,6 +5246,8 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm) return result; } +static inline QPixmap titleBarMenuCachedPixmapFromXPM() { return cachedPixmapFromXPM(qt_menu_xpm); } + #ifndef QT_NO_IMAGEFORMAT_PNG static inline QString clearText16IconPath() { @@ -5590,7 +5592,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti #ifndef QT_NO_IMAGEFORMAT_XPM switch (sp) { case SP_TitleBarMenuButton: - return cachedPixmapFromXPM(qt_menu_xpm); + return titleBarMenuCachedPixmapFromXPM(); case SP_TitleBarShadeButton: return cachedPixmapFromXPM(qt_shade_xpm); case SP_TitleBarUnshadeButton: @@ -6130,6 +6132,12 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption case SP_MediaVolumeMuted: icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"), QSize(16, 16)); break; + case SP_TitleBarMenuButton: +# ifndef QT_NO_IMAGEFORMAT_XPM + icon.addPixmap(titleBarMenuCachedPixmapFromXPM()); +# endif + icon.addFile(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png")); + break; #endif // QT_NO_IMAGEFORMAT_PNG default: icon.addPixmap(proxy()->standardPixmap(standardIcon, option, widget)); diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 06c3101643..3473ec7fb0 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1080,8 +1080,8 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio painter->setPen(innerLine); painter->drawRoundedRect(option->rect.adjusted(1, 1, -2, -2), 1, 1); painter->restore(); - return; } + break; case CE_SizeGrip: painter->save(); { diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 6fbc7c9eea..2d1de790c4 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -950,6 +950,8 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg #if defined(QMAC_QAQUASTYLE_SIZE_CONSTRAIN) || defined(DEBUG_SIZE_CONSTRAINT) static QAquaWidgetSize qt_aqua_guess_size(const QWidget *widg, QSize large, QSize small, QSize mini) { + Q_UNUSED(widg); + if (large == QSize(-1, -1)) { if (small != QSize(-1, -1)) return QAquaSizeSmall; @@ -965,7 +967,7 @@ static QAquaWidgetSize qt_aqua_guess_size(const QWidget *widg, QSize large, QSiz } #ifndef QT_NO_MAINWINDOW - if (qobject_cast<QDockWidget *>(widg->window()) || qEnvironmentVariableIsSet("QWIDGET_ALL_SMALL")) { + if (qEnvironmentVariableIsSet("QWIDGET_ALL_SMALL")) { //if (small.width() != -1 || small.height() != -1) return QAquaSizeSmall; } else if (qEnvironmentVariableIsSet("QWIDGET_ALL_MINI")) { @@ -4214,10 +4216,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter bool verticalTabs = ttd == kThemeTabWest || ttd == kThemeTabEast; bool selected = (myTab.state & QStyle::State_Selected); - if (selected && !myTab.documentMode - && (!usingYosemiteOrLater || myTab.state & State_Active)) - myTab.palette.setColor(QPalette::WindowText, Qt::white); - // Check to see if we use have the same as the system font // (QComboMenuItem is internal and should never be seen by the // outside world, unless they read the source, in which case, it's diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h index fdc22794b4..459784c538 100644 --- a/src/widgets/styles/qmacstyle_mac_p.h +++ b/src/widgets/styles/qmacstyle_mac_p.h @@ -134,7 +134,7 @@ private: friend bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option); }; -#endif // Q_DEAD_CODE_FROM_QT4_MAC +#endif QT_END_NAMESPACE diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp index ee5fd704dc..b51860045d 100644 --- a/src/widgets/styles/qpixmapstyle.cpp +++ b/src/widgets/styles/qpixmapstyle.cpp @@ -108,7 +108,7 @@ QPixmapStyle::~QPixmapStyle() void QPixmapStyle::polish(QApplication *application) { QCommonStyle::polish(application); -#if defined(Q_DEAD_CODE_FROM_QT4_WIN) +#if 0 // Used to be included in Qt4 for Q_WS_WIN QApplication::setEffectEnabled(Qt::UI_AnimateCombo, false); #endif } @@ -170,7 +170,7 @@ void QPixmapStyle::polish(QWidget *widget) frame->setContentsMargins(pix.margins.left(), desc.margins.top(), pix.margins.right(), desc.margins.bottom()); frame->setAttribute(Qt::WA_TranslucentBackground); -#ifdef Q_DEAD_CODE_FROM_QT4_WIN +#if 0 // Used to be included in Qt4 for Q_WS_WIN // FramelessWindowHint is needed on windows to make // WA_TranslucentBackground work properly frame->setWindowFlags(widget->windowFlags() | Qt::FramelessWindowHint); diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index bb849c148f..09cccff4e8 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -131,7 +131,7 @@ QStyle *QStyleFactory::create(const QString& key) #ifndef QT_NO_STYLE_MAC if (style.startsWith(QLatin1String("macintosh"))) { ret = new QMacStyle; -# ifdef Q_DEAD_CODE_FROM_QT4_MAC +# if 0 // Used to be included in Qt4 for Q_WS_MAC if (style == QLatin1String("macintosh")) style += QLatin1String(" (aqua)"); # endif @@ -184,7 +184,7 @@ QStringList QStyleFactory::keys() #endif #ifndef QT_NO_STYLE_MAC QString mstyle = QLatin1String("Macintosh"); -# ifdef Q_DEAD_CODE_FROM_QT4_MAC +# if 0 // Used to be included in Qt4 for Q_WS_MAC mstyle += QLatin1String(" (aqua)"); # endif if (!list.contains(mstyle)) diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 71cf2fb267..83739655af 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -199,7 +199,7 @@ void QStyleOption::init(const QWidget *widget) state |= QStyle::State_Active; if (widget->isWindow()) state |= QStyle::State_Window; -#ifdef Q_DEAD_CODE_FROM_QT4_MAC +#if 0 // Used to be included in Qt4 for Q_WS_MAC extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget)) state &= ~QStyle::State_Enabled; diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index b214dae154..8e77ae0e44 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -5045,7 +5045,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op sz = csz + QSize(vertical ? 0 : spaceForIcon, vertical ? spaceForIcon : 0); return subRule.boxSize(subRule.adjustSize(sz)); } -#ifdef Q_DEAD_CODE_FROM_QT4_MAC +#if 0 // Used to be included in Qt4 for Q_WS_MAC if (baseStyle()->inherits("QMacStyle")) { //adjust the size after the call to the style because the mac style ignore the size arguments anyway. //this might cause the (max-){width,height} property to include the native style border while they should not. diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 9d764d2a41..4ce359a7c4 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -699,7 +699,7 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) bool translucentToplevel = false; const QPaintDevice *paintDevice = painter->device(); - const qreal aditionalDevicePixelRatio = themeData.widget ? themeData.widget->devicePixelRatio() : 1; + const qreal aditionalDevicePixelRatio = themeData.widget ? themeData.widget->devicePixelRatioF() : qreal(1); if (paintDevice->devType() == QInternal::Widget) { const QWidget *window = static_cast<const QWidget *>(paintDevice)->window(); translucentToplevel = window->testAttribute(Qt::WA_TranslucentBackground); @@ -727,28 +727,28 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) const HDC dc = canDrawDirectly ? hdcForWidgetBackingStore(themeData.widget) : HDC(0); const bool result = dc - ? drawBackgroundDirectly(dc, themeData, qRound(aditionalDevicePixelRatio)) - : drawBackgroundThruNativeBuffer(themeData, qRound(aditionalDevicePixelRatio)); + ? drawBackgroundDirectly(dc, themeData, aditionalDevicePixelRatio) + : drawBackgroundThruNativeBuffer(themeData, aditionalDevicePixelRatio); painter->restore(); return result; } -static inline QRect scaleRect(const QRect &r, int factor) +static inline QRectF scaleRect(const QRectF &r, qreal factor) { return r.isValid() && factor > 1 - ? QRect(r.topLeft() * factor, r.size() * factor) + ? QRectF(r.topLeft() * factor, r.size() * factor) : r; } -static QRegion scaleRegion(const QRegion ®ion, int factor) +static QRegion scaleRegion(const QRegion ®ion, qreal factor) { - if (region.isEmpty() || factor == 1) + if (region.isEmpty() || qFuzzyCompare(factor, qreal(1))) return region; if (region.rectCount() == 1) - return QRegion(scaleRect(region.boundingRect(), factor)); + return QRegion(scaleRect(QRectF(region.boundingRect()), factor).toRect()); QRegion result; foreach (const QRect &rect, region.rects()) - result += QRect(rect.topLeft() * factor, rect.size() * factor); + result += QRectF(QPointF(rect.topLeft()) * factor, QSizeF(rect.size() * factor)).toRect(); return result; } @@ -757,13 +757,12 @@ static QRegion scaleRegion(const QRegion ®ion, int factor) Do not use this if you need to perform other transformations on the resulting data. */ -bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeData, int additionalDevicePixelRatio) +bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeData, qreal additionalDevicePixelRatio) { QPainter *painter = themeData.painter; - QPoint redirectionDelta(int(painter->deviceMatrix().dx()), - int(painter->deviceMatrix().dy())); - QRect area = scaleRect(themeData.rect, additionalDevicePixelRatio).translated(redirectionDelta); + const QPointF redirectionDelta(painter->deviceMatrix().dx(), painter->deviceMatrix().dy()); + const QRect area = scaleRect(QRectF(themeData.rect), additionalDevicePixelRatio).translated(redirectionDelta).toRect(); QRegion sysRgn = painter->paintEngine()->systemClip(); if (sysRgn.isEmpty()) @@ -771,7 +770,7 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeDa else sysRgn &= area; if (painter->hasClipping()) - sysRgn &= scaleRegion(painter->clipRegion(), additionalDevicePixelRatio).translated(redirectionDelta); + sysRgn &= scaleRegion(painter->clipRegion(), additionalDevicePixelRatio).translated(redirectionDelta.toPoint()); HRGN hrgn = qt_hrgn_from_qregion(sysRgn); SelectClipRgn(dc, hrgn); @@ -806,15 +805,16 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeDa engine). */ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData, - int additionalDevicePixelRatio) + qreal additionalDevicePixelRatio) { QPainter *painter = themeData.painter; - QRect rect = scaleRect(themeData.rect, additionalDevicePixelRatio); + QRectF rectF = scaleRect(QRectF(themeData.rect), additionalDevicePixelRatio); if ((themeData.rotate + 90) % 180 == 0) { // Catch 90,270,etc.. degree flips. - rect = QRect(0, 0, rect.height(), rect.width()); + rectF = QRectF(0, 0, rectF.height(), rectF.width()); } - rect.moveTo(0,0); + rectF.moveTo(0, 0); + QRect rect = rectF.toRect(); int partId = themeData.partId; int stateId = themeData.stateId; int w = rect.width(); diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index 7cbccdaf67..d6702c8803 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -240,8 +240,8 @@ public: void setTransparency(QWidget *widget, XPThemeData &themeData); bool drawBackground(XPThemeData &themeData); - bool drawBackgroundThruNativeBuffer(XPThemeData &themeData, int aditionalDevicePixelRatio); - bool drawBackgroundDirectly(HDC dc, XPThemeData &themeData, int aditionalDevicePixelRatio); + bool drawBackgroundThruNativeBuffer(XPThemeData &themeData, qreal aditionalDevicePixelRatio); + bool drawBackgroundDirectly(HDC dc, XPThemeData &themeData, qreal aditionalDevicePixelRatio); bool hasAlphaChannel(const QRect &rect); bool fixAlphaChannel(const QRect &rect); |