summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-20 08:44:28 +0100
committerLiang Qi <liang.qi@qt.io>2017-03-20 09:00:44 +0100
commitae2695535a2f1abbd4c6596a22dd33319b9388dd (patch)
tree91df41df365a13ea71b1361d909535e5b7a7360a /src/widgets/styles
parent8066ae49433ed7604e710eef7b15d15de171608e (diff)
parentc1a2f97a3b3a8c058b1760b57e5c83bf7815b84a (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/corelib/io/qfilesystemengine_win.cpp src/gui/text/qdistancefield.cpp src/plugins/platforms/xcb/qxcbconnection.h Change-Id: I1be4a6f440ccb7599991159e3cb9de60990e4b1e
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qfusionstyle.cpp15
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm22
-rw-r--r--src/widgets/styles/qmacstyle_mac_p_p.h1
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p_p.h1
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp10
6 files changed, 32 insertions, 19 deletions
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 1267907303..98d45587f0 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -45,7 +45,8 @@
#include <qcombobox.h>
#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
-#else
+#endif
+#if QT_CONFIG(abstractbutton)
#include <qabstractbutton.h>
#endif
#include <qpainter.h>
@@ -55,7 +56,6 @@
#include <qmainwindow.h>
#include <qfont.h>
#include <qgroupbox.h>
-#include <qprocess.h>
#include <qpixmapcache.h>
#include <qscrollbar.h>
#include <qspinbox.h>
@@ -66,7 +66,6 @@
#include <qsplitter.h>
#include <qprogressbar.h>
#include <qwizard.h>
-#include <qlibrary.h>
#include <qdrawutil.h>
#include <private/qstylehelper_p.h>
#include <private/qdrawhelper_p.h>
@@ -3284,7 +3283,10 @@ void QFusionStyle::polish(QApplication *app)
void QFusionStyle::polish(QWidget *widget)
{
QCommonStyle::polish(widget);
- if (qobject_cast<QAbstractButton*>(widget)
+ if (false
+#if QT_CONFIG(abstractbutton)
+ || qobject_cast<QAbstractButton*>(widget)
+#endif
#if QT_CONFIG(combobox)
|| qobject_cast<QComboBox *>(widget)
#endif
@@ -3325,7 +3327,10 @@ void QFusionStyle::polish(QPalette &pal)
void QFusionStyle::unpolish(QWidget *widget)
{
QCommonStyle::unpolish(widget);
- if (qobject_cast<QAbstractButton*>(widget)
+ if (false
+#if QT_CONFIG(abstractbutton)
+ || qobject_cast<QAbstractButton*>(widget)
+#endif
#if QT_CONFIG(combobox)
|| qobject_cast<QComboBox *>(widget)
#endif
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index d9d30efc8b..47193f2a84 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1076,11 +1076,6 @@ void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widg
if (opt->shape == QTabBar::RoundedSouth || opt->shape == QTabBar::TriangularSouth)
verticalShift = -verticalShift;
tr.adjust(hpadding, verticalShift - vpadding, horizontalShift - hpadding, vpadding);
- const bool selected = opt->state & QStyle::State_Selected;
- if (selected) {
- tr.setTop(tr.top() - verticalShift);
- tr.setRight(tr.right() - horizontalShift);
- }
// left widget
if (!opt->leftButtonSize.isEmpty()) {
@@ -2487,7 +2482,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
case QAquaSizeUnknown:
const QStyleOptionTab *tb = qstyleoption_cast<const QStyleOptionTab *>(opt);
if (tb && tb->documentMode)
- ret = 24;
+ ret = 30;
else
ret = QCommonStyle::pixelMetric(metric, opt, widget);
break;
@@ -6584,7 +6579,6 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz = sz.transposed();
int defaultTabHeight;
int extraHSpace = proxy()->pixelMetric(PM_TabBarTabHSpace, tab, widget);
- int extraVSpace = proxy()->pixelMetric(PM_TabBarTabVSpace, tab, widget);
QFontMetrics fm = opt->fontMetrics;
switch (AquaSize) {
case QAquaSizeUnknown:
@@ -6604,13 +6598,13 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
bool setWidth = false;
if (differentFont || !tab->icon.isNull()) {
sz.rheight() = qMax(defaultTabHeight, sz.height());
- sz.rwidth() += extraHSpace;
} else {
QSize textSize = fm.size(Qt::TextShowMnemonic, tab->text);
sz.rheight() = qMax(defaultTabHeight, textSize.height());
- sz.rwidth() = textSize.width() + extraVSpace;
+ sz.rwidth() = textSize.width();
setWidth = true;
}
+ sz.rwidth() += extraHSpace;
if (vertTabs)
sz = sz.transposed();
@@ -6724,7 +6718,15 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
break;
}
case CT_Menu: {
- sz = csz;
+ if (proxy() == this) {
+ sz = csz;
+ } else {
+ QStyleHintReturnMask menuMask;
+ QStyleOption myOption = *opt;
+ myOption.rect.setSize(sz);
+ if (proxy()->styleHint(SH_Menu_Mask, &myOption, widget, &menuMask))
+ sz = menuMask.region.boundingRect().size();
+ }
break; }
case CT_HeaderSection:{
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt);
diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h
index 59f6e893b1..9bbd0995a5 100644
--- a/src/widgets/styles/qmacstyle_mac_p_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p_p.h
@@ -95,7 +95,6 @@
#include <qtableview.h>
#include <qwizard.h>
#include <qdebug.h>
-#include <qlibrary.h>
#include <qdatetimeedit.h>
#include <qmath.h>
#include <qpair.h>
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 7dc1c35333..2b9f042862 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -4269,6 +4269,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
case PE_PanelButtonTool:
case PE_PanelButtonCommand:
+#if QT_CONFIG(abstractbutton)
if (qobject_cast<const QAbstractButton *>(w) && rule.hasBackground() && rule.hasNativeBorder()) {
//the window style will draw the borders
ParentStyle::drawPrimitive(pe, opt, p, w);
@@ -4277,6 +4278,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
}
return;
}
+#endif
if (!rule.hasNativeBorder()) {
rule.drawRule(p, rule.boxRect(opt->rect, QRenderRule::Margin));
return;
diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h
index ec7c2caad3..db358e6f6c 100644
--- a/src/widgets/styles/qwindowsvistastyle_p_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p_p.h
@@ -58,7 +58,6 @@
#include <private/qwindowsxpstyle_p_p.h>
#include <private/qstyleanimation_p.h>
#include <private/qpaintengine_raster_p.h>
-#include <qlibrary.h>
#include <qpaintengine.h>
#include <qwidget.h>
#include <qapplication.h>
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index f3c6069f8a..b50c4b6be4 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -1139,7 +1139,10 @@ void QWindowsXPStyle::polish(QWidget *widget)
if (!QWindowsXPStylePrivate::useXP())
return;
- if (qobject_cast<QAbstractButton*>(widget)
+ if (false
+#if QT_CONFIG(abstractbutton)
+ || qobject_cast<QAbstractButton*>(widget)
+#endif
|| qobject_cast<QToolButton*>(widget)
|| qobject_cast<QTabBar*>(widget)
#ifndef QT_NO_COMBOBOX
@@ -1211,7 +1214,10 @@ void QWindowsXPStyle::unpolish(QWidget *widget)
// already in the map might be old (other style).
d->cleanupHandleMap();
}
- if (qobject_cast<QAbstractButton*>(widget)
+ if (false
+#if QT_CONFIG(abstractbutton)
+ || qobject_cast<QAbstractButton*>(widget)
+#endif
|| qobject_cast<QToolButton*>(widget)
|| qobject_cast<QTabBar*>(widget)
#ifndef QT_NO_COMBOBOX