summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-04-05 14:22:45 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2016-04-05 14:22:45 +0200
commitf2856875843efce9a00e90dad05bde358ab82197 (patch)
tree93346c38504ce04f0bf02dfe4a21299feb1be8ed /src/widgets/styles
parenta7b04275082d065f392e7f18c54ea9b41507ae40 (diff)
parenta2970719c26c946fd6fea7d902aad6706a4ca6ea (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: examples/corelib/ipc/ipc.pro src/plugins/platforms/xcb/qxcbbackingstore.cpp tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp Change-Id: Ia006e10ff1732fe78f90138c41f05b59b49486cf
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/images/cleartext-32.pngbin0 -> 410 bytes
-rw-r--r--src/widgets/styles/qcommonstyle.cpp46
-rw-r--r--src/widgets/styles/qfusionstyle.cpp8
-rw-r--r--src/widgets/styles/qmacstyle.qdoc10
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm3
-rw-r--r--src/widgets/styles/qstyle.qrc1
6 files changed, 44 insertions, 24 deletions
diff --git a/src/widgets/styles/images/cleartext-32.png b/src/widgets/styles/images/cleartext-32.png
new file mode 100644
index 0000000000..ff5a2b5ec1
--- /dev/null
+++ b/src/widgets/styles/images/cleartext-32.png
Binary files differ
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index c26da68ac9..63024360ae 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -1616,7 +1616,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (!hasArrow) {
proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pm);
} else {
- drawArrow(this, toolbutton, pr, p, widget);
+ drawArrow(proxy(), toolbutton, pr, p, widget);
}
alignment |= Qt::AlignCenter;
} else {
@@ -1626,7 +1626,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (!hasArrow) {
proxy()->drawItemPixmap(p, QStyle::visualRect(opt->direction, rect, pr), Qt::AlignCenter, pm);
} else {
- drawArrow(this, toolbutton, pr, p, widget);
+ drawArrow(proxy(), toolbutton, pr, p, widget);
}
alignment |= Qt::AlignLeft | Qt::AlignVCenter;
}
@@ -1637,7 +1637,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
} else {
rect.translate(shiftX, shiftY);
if (hasArrow) {
- drawArrow(this, toolbutton, rect, p, widget);
+ drawArrow(proxy(), toolbutton, rect, p, widget);
} else {
proxy()->drawItemPixmap(p, rect, Qt::AlignCenter, pm);
}
@@ -5237,6 +5237,30 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm)
return result;
}
+static QIcon clearTextIcon(bool rtl)
+{
+ const QString directionalThemeName = rtl
+ ? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl");
+ if (QIcon::hasThemeIcon(directionalThemeName))
+ return QIcon::fromTheme(directionalThemeName);
+ const QString themeName = QStringLiteral("edit-clear");
+ if (QIcon::hasThemeIcon(themeName))
+ return QIcon::fromTheme(themeName);
+
+ QIcon icon;
+#ifndef QT_NO_IMAGEFORMAT_PNG
+ QPixmap clearText16(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png"));
+ Q_ASSERT(!clearText16.size().isEmpty());
+ icon.addPixmap(clearText16);
+ QPixmap clearText32(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-32.png"));
+ Q_ASSERT(!clearText32.size().isEmpty());
+ icon.addPixmap(clearText32);
+ clearText32.setDevicePixelRatio(2); // The 32x32 pixmap can also be used for 16x16/devicePixelRatio=2
+ icon.addPixmap(clearText32);
+#endif // !QT_NO_IMAGEFORMAT_PNG
+ return icon;
+}
+
/*! \reimp */
QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option,
const QWidget *widget) const
@@ -5409,12 +5433,8 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
}
}
break;
- case SP_LineEditClearButton: {
- QString themeName = rtl ? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl");
- if (!QIcon::hasThemeIcon(themeName))
- themeName = QStringLiteral("edit-clear");
- pixmap = QIcon::fromTheme(themeName).pixmap(16);
- }
+ case SP_LineEditClearButton:
+ pixmap = clearTextIcon(rtl).pixmap(16);
break;
default:
break;
@@ -5544,8 +5564,6 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png"));
case SP_MediaVolumeMuted:
return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"));
- case SP_LineEditClearButton:
- return QPixmap(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png"));
#endif // QT_NO_IMAGEFORMAT_PNG
default:
break;
@@ -5595,6 +5613,8 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
const QWidget *widget) const
{
QIcon icon;
+ const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
+
#ifdef Q_OS_WIN
switch (standardIcon) {
case SP_DriveCDIcon:
@@ -5634,6 +5654,9 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
}
}
break;
+ case SP_LineEditClearButton:
+ icon = clearTextIcon(rtl);
+ break;
default:
break;
}
@@ -5642,7 +5665,6 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
#endif
- const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (standardIcon) {
case SP_DirHomeIcon:
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 3bab2f5dbe..b15b9701d9 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -1538,13 +1538,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
QRect r = option->rect;
painter->fillRect(r, highlight);
painter->setPen(QPen(highlightOutline));
- const QLine lines[4] = {
- QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())),
- QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top())),
- QLine(QPoint(r.left(), r.top()), QPoint(r.left(), r.bottom())),
- QLine(QPoint(r.right() , r.top()), QPoint(r.right(), r.bottom())),
- };
- painter->drawLines(lines, 4);
+ painter->drawRect(QRectF(r).adjusted(0.5, 0.5, -0.5, -0.5));
}
bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable;
bool checked = menuItem->checked;
diff --git a/src/widgets/styles/qmacstyle.qdoc b/src/widgets/styles/qmacstyle.qdoc
index 0800e2d608..5d597b53a4 100644
--- a/src/widgets/styles/qmacstyle.qdoc
+++ b/src/widgets/styles/qmacstyle.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 3d03ed5323..4b60654448 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -4952,6 +4952,9 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
break;
}
case SE_ProgressBarGroove:
+ // Wrong in the secondary dimension, but accurate enough in the main dimension.
+ rect = opt->rect;
+ break;
case SE_ProgressBarLabel:
break;
case SE_ProgressBarContents:
diff --git a/src/widgets/styles/qstyle.qrc b/src/widgets/styles/qstyle.qrc
index c063ec5036..d8c73dd6fa 100644
--- a/src/widgets/styles/qstyle.qrc
+++ b/src/widgets/styles/qstyle.qrc
@@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/qt-project.org/styles/commonstyle">
<file>images/cleartext-16.png</file>
+ <file>images/cleartext-32.png</file>
<file>images/filelink-16.png</file>
<file>images/filelink-32.png</file>
<file>images/filelink-128.png</file>