summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-09 16:00:53 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-08-09 16:00:53 +0000
commit2579fe7bfdf5b215fccacc641b986102664ccffa (patch)
tree4ad293f8c8e2d6ede34abed48d5e95e327e15762 /src
parent39def876a641e0fff42298c61bbe3d3fafaf47af (diff)
parent22e96c4d342de3bfe4fc27f4cd7233edcfe737cc (diff)
Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qurl.cpp4
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp6
-rw-r--r--src/corelib/itemmodels/qstringlistmodel.cpp4
-rw-r--r--src/corelib/kernel/qvariant.cpp2
-rw-r--r--src/corelib/tools/qcommandlineoption.cpp4
-rw-r--r--src/corelib/tools/qstring.cpp2
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp21
-rw-r--r--src/gui/doc/images/qcolor-saturation.pngbin2150 -> 1116 bytes
-rw-r--r--src/gui/doc/images/qcolor-saturation.svg78
-rw-r--r--src/gui/doc/images/qcolor-value.pngbin1241 -> 909 bytes
-rw-r--r--src/gui/doc/images/qcolor-value.svg78
-rw-r--r--src/gui/image/qpixmap_blitter_p.h2
-rw-r--r--src/gui/kernel/qkeysequence.cpp4
-rw-r--r--src/gui/painting/qblittable_p.h2
-rw-r--r--src/gui/painting/qcolor_p.cpp36
-rw-r--r--src/gui/painting/qdatabuffer_p.h2
-rw-r--r--src/gui/painting/qdrawhelper.cpp8
-rw-r--r--src/gui/painting/qgrayraster.c4
-rw-r--r--src/gui/painting/qpaintengine_blitter_p.h2
-rw-r--r--src/gui/painting/qrasterizer.cpp6
-rw-r--r--src/gui/text/qfontengine_ft.cpp6
-rw-r--r--src/gui/text/qtextengine.cpp9
-rw-r--r--src/network/socket/qlocalsocket_tcp.cpp2
-rw-r--r--src/network/ssl/qsslsocket_mac_p.h4
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp32
-rw-r--r--src/plugins/platforms/android/qandroidplatformfontdatabase.cpp3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp18
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp34
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h4
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp16
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.h1
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp203
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp2
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp8
-rw-r--r--src/widgets/itemviews/qabstractitemview.h5
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.cpp18
-rw-r--r--src/widgets/itemviews/qheaderview.cpp1
-rw-r--r--src/widgets/itemviews/qtreeview.h3
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp1
-rw-r--r--src/widgets/kernel/qwidget.h1
41 files changed, 418 insertions, 224 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 71a0228eeb..9cf1be58d8 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3169,8 +3169,8 @@ QUrl QUrl::resolved(const QUrl &relative) const
if (!relative.d) return *this;
QUrl t;
- // be non strict and allow scheme in relative url
- if (!relative.d->scheme.isEmpty() && relative.d->scheme != d->scheme) {
+ // Compatibility hack (mostly for qtdeclarative) : treat "file:relative.txt" as relative even though QUrl::isRelative() says false
+ if (!relative.d->scheme.isEmpty() && (!relative.isLocalFile() || QDir::isAbsolutePath(relative.d->path))) {
t = relative;
t.detach();
} else {
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index 2b684b855b..b0ddfa879d 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -1328,6 +1328,7 @@ void QSortFilterProxyModelPrivate::_q_sourceReset()
void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
{
Q_Q(QSortFilterProxyModel);
+ Q_UNUSED(hint); // We can't forward Hint because we might filter additional rows or columns
saved_persistent_indexes.clear();
QList<QPersistentModelIndex> parents;
@@ -1346,7 +1347,7 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<Q
if (!sourceParents.isEmpty() && parents.isEmpty())
return;
- emit q->layoutAboutToBeChanged(parents, hint);
+ emit q->layoutAboutToBeChanged(parents);
if (persistent.indexes.isEmpty())
return;
@@ -1356,6 +1357,7 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<Q
void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
{
Q_Q(QSortFilterProxyModel);
+ Q_UNUSED(hint); // We can't forward Hint because we might filter additional rows or columns
// Optimize: We only actually have to clear the mapping related to the contents of
// sourceParents, not everything.
@@ -1385,7 +1387,7 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersisten
if (!sourceParents.isEmpty() && parents.isEmpty())
return;
- emit q->layoutChanged(parents, hint);
+ emit q->layoutChanged(parents);
}
void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeInserted(
diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp
index f70c318ff7..407419edb2 100644
--- a/src/corelib/itemmodels/qstringlistmodel.cpp
+++ b/src/corelib/itemmodels/qstringlistmodel.cpp
@@ -307,9 +307,9 @@ QStringList QStringListModel::stringList() const
*/
void QStringListModel::setStringList(const QStringList &strings)
{
- emit beginResetModel();
+ beginResetModel();
lst = strings;
- emit endResetModel();
+ endResetModel();
}
/*!
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index f1d38db96c..7d3f4a6e44 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -3560,6 +3560,8 @@ int QVariant::compare(const QVariant &v) const
return v1.toTime() < v2.toTime() ? -1 : 1;
case QVariant::DateTime:
return v1.toDateTime() < v2.toDateTime() ? -1 : 1;
+ case QVariant::StringList:
+ return v1.toStringList() < v2.toStringList() ? -1 : 1;
}
int r = v1.toString().compare(v2.toString(), Qt::CaseInsensitive);
if (r == 0) {
diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp
index 7482315909..c2b86014ba 100644
--- a/src/corelib/tools/qcommandlineoption.cpp
+++ b/src/corelib/tools/qcommandlineoption.cpp
@@ -147,7 +147,7 @@ QCommandLineOption::QCommandLineOption(const QStringList &names)
The description is set to \a description. It is customary to add a "."
at the end of the description.
- In addition, the \a valueName can be set if the option expects a value.
+ In addition, the \a valueName needs to be set if the option expects a value.
The default value for the option is set to \a defaultValue.
In Qt versions before 5.4, this constructor was \c explicit. In Qt 5.4
@@ -183,7 +183,7 @@ QCommandLineOption::QCommandLineOption(const QString &name, const QString &descr
The description is set to \a description. It is customary to add a "."
at the end of the description.
- In addition, the \a valueName can be set if the option expects a value.
+ In addition, the \a valueName needs to be set if the option expects a value.
The default value for the option is set to \a defaultValue.
In Qt versions before 5.4, this constructor was \c explicit. In Qt 5.4
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 7c4280d36b..6b054126dd 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -9478,7 +9478,7 @@ QString &QString::append(const QStringRef &str)
{
if (str.string() == this) {
str.appendTo(this);
- } else if (str.string()) {
+ } else if (!str.isNull()) {
int oldSize = size();
resize(oldSize + str.size());
memcpy(data() + oldSize, str.unicode(), str.size() * sizeof(QChar));
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index 6e717f2233..96d04df0e2 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -909,13 +909,12 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const
if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < forMSecsSinceEpoch
&& !m_posixRule.isEmpty() && forMSecsSinceEpoch >= 0) {
const int year = QDateTime::fromMSecsSinceEpoch(forMSecsSinceEpoch, Qt::UTC).date().year();
- const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0;
- QVector<QTimeZonePrivate::Data> posixTrans = calculatePosixTransitions(m_posixRule, year - 1,
- year + 1, lastMSecs);
+ QVector<QTimeZonePrivate::Data> posixTrans =
+ calculatePosixTransitions(m_posixRule, year - 1, year + 1,
+ m_tranTimes.last().atMSecsSinceEpoch);
for (int i = posixTrans.size() - 1; i >= 0; --i) {
if (posixTrans.at(i).atMSecsSinceEpoch <= forMSecsSinceEpoch) {
- QTimeZonePrivate::Data data;
- data = posixTrans.at(i);
+ QTimeZonePrivate::Data data = posixTrans.at(i);
data.atMSecsSinceEpoch = forMSecsSinceEpoch;
return data;
}
@@ -953,9 +952,9 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSince
if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < afterMSecsSinceEpoch
&& !m_posixRule.isEmpty() && afterMSecsSinceEpoch >= 0) {
const int year = QDateTime::fromMSecsSinceEpoch(afterMSecsSinceEpoch, Qt::UTC).date().year();
- const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0;
- QVector<QTimeZonePrivate::Data> posixTrans = calculatePosixTransitions(m_posixRule, year - 1,
- year + 1, lastMSecs);
+ QVector<QTimeZonePrivate::Data> posixTrans =
+ calculatePosixTransitions(m_posixRule, year - 1, year + 1,
+ m_tranTimes.last().atMSecsSinceEpoch);
for (int i = 0; i < posixTrans.size(); ++i) {
if (posixTrans.at(i).atMSecsSinceEpoch > afterMSecsSinceEpoch)
return posixTrans.at(i);
@@ -979,9 +978,9 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::previousTransition(qint64 beforeMSecs
if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < beforeMSecsSinceEpoch
&& !m_posixRule.isEmpty() && beforeMSecsSinceEpoch > 0) {
const int year = QDateTime::fromMSecsSinceEpoch(beforeMSecsSinceEpoch, Qt::UTC).date().year();
- const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0;
- QVector<QTimeZonePrivate::Data> posixTrans = calculatePosixTransitions(m_posixRule, year - 1,
- year + 1, lastMSecs);
+ QVector<QTimeZonePrivate::Data> posixTrans =
+ calculatePosixTransitions(m_posixRule, year - 1, year + 1,
+ m_tranTimes.last().atMSecsSinceEpoch);
for (int i = posixTrans.size() - 1; i >= 0; --i) {
if (posixTrans.at(i).atMSecsSinceEpoch < beforeMSecsSinceEpoch)
return posixTrans.at(i);
diff --git a/src/gui/doc/images/qcolor-saturation.png b/src/gui/doc/images/qcolor-saturation.png
index f28776aff5..9c104f7389 100644
--- a/src/gui/doc/images/qcolor-saturation.png
+++ b/src/gui/doc/images/qcolor-saturation.png
Binary files differ
diff --git a/src/gui/doc/images/qcolor-saturation.svg b/src/gui/doc/images/qcolor-saturation.svg
new file mode 100644
index 0000000000..608c2555e8
--- /dev/null
+++ b/src/gui/doc/images/qcolor-saturation.svg
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.1"
+ id="svg2"
+ viewBox="0 0 186.82259 45.046909"
+ height="12.713239mm"
+ width="52.725487mm">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3346">
+ <stop
+ id="stop3348"
+ offset="0"
+ style="stop-color:#808080;stop-opacity:1" />
+ <stop
+ id="stop3350"
+ offset="1"
+ style="stop-color:#0000ff;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ gradientTransform="translate(109.31384,222.16879)"
+ gradientUnits="userSpaceOnUse"
+ y2="16.118341"
+ x2="200.35715"
+ y1="16.118341"
+ x1="3.7246187"
+ id="linearGradient3352"
+ xlink:href="#linearGradient3346" />
+ </defs>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ transform="translate(-109.31384,-222.16879)"
+ id="layer1">
+ <rect
+ y="225.7121"
+ x="112.85714"
+ height="25.221529"
+ width="179.73599"
+ id="rect3336"
+ style="opacity:1;fill:url(#linearGradient3352);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <text
+ id="text3338"
+ y="263.53079"
+ x="113.03048"
+ style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ xml:space="preserve"><tspan
+ y="263.53079"
+ x="113.03048"
+ id="tspan3340">0</tspan></text>
+ <text
+ id="text3342"
+ y="263.53079"
+ x="271.76645"
+ style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ xml:space="preserve"><tspan
+ y="263.53079"
+ x="271.76645"
+ id="tspan3344">255</tspan></text>
+ </g>
+</svg>
diff --git a/src/gui/doc/images/qcolor-value.png b/src/gui/doc/images/qcolor-value.png
index 0e069123a9..add9b7f83d 100644
--- a/src/gui/doc/images/qcolor-value.png
+++ b/src/gui/doc/images/qcolor-value.png
Binary files differ
diff --git a/src/gui/doc/images/qcolor-value.svg b/src/gui/doc/images/qcolor-value.svg
new file mode 100644
index 0000000000..51c2de0338
--- /dev/null
+++ b/src/gui/doc/images/qcolor-value.svg
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ width="52.725487mm"
+ height="12.713239mm"
+ viewBox="0 0 186.82259 45.046909"
+ id="svg2"
+ version="1.1">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3346">
+ <stop
+ style="stop-color:#000000;stop-opacity:1"
+ offset="0"
+ id="stop3348" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="1"
+ id="stop3350" />
+ </linearGradient>
+ <linearGradient
+ xlink:href="#linearGradient3346"
+ id="linearGradient3352"
+ x1="3.7246187"
+ y1="16.118341"
+ x2="183.57143"
+ y2="15.761199"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(109.31384,222.16879)" />
+ </defs>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ transform="translate(-109.31384,-222.16879)">
+ <rect
+ style="opacity:1;fill:url(#linearGradient3352);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3336"
+ width="179.73599"
+ height="25.221529"
+ x="112.85714"
+ y="225.7121" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="113.03048"
+ y="263.53079"
+ id="text3338"><tspan
+ id="tspan3340"
+ x="113.03048"
+ y="263.53079">0</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="271.76645"
+ y="263.53079"
+ id="text3342"><tspan
+ id="tspan3344"
+ x="271.76645"
+ y="263.53079">255</tspan></text>
+ </g>
+</svg>
diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h
index 546e2fef79..9889cfb8ec 100644
--- a/src/gui/image/qpixmap_blitter_p.h
+++ b/src/gui/image/qpixmap_blitter_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QBlittablePlatformPixmap : public QPlatformPixmap
{
-// Q_DECLARE_PRIVATE(QBlittablePlatformPixmap);
+// Q_DECLARE_PRIVATE(QBlittablePlatformPixmap)
public:
QBlittablePlatformPixmap();
~QBlittablePlatformPixmap();
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index e7b1f9e073..51857602d7 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -225,9 +225,9 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
code point of the character; for example, 'A' gives the same key sequence
as Qt::Key_A.
- \b{Note:} On OS X, references to "Ctrl", Qt::CTRL, Qt::Control
+ \note On OS X, references to "Ctrl", Qt::CTRL, Qt::Key_Control
and Qt::ControlModifier correspond to the \uicontrol Command keys on the
- Macintosh keyboard, and references to "Meta", Qt::META, Qt::Meta and
+ Macintosh keyboard, and references to "Meta", Qt::META, Qt::Key_Meta and
Qt::MetaModifier correspond to the \uicontrol Control keys. Developers on
OS X can use the same shortcut descriptions across all platforms,
and their applications will automatically work as expected on OS X.
diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h
index d5e2e22799..24440c3c61 100644
--- a/src/gui/painting/qblittable_p.h
+++ b/src/gui/painting/qblittable_p.h
@@ -64,7 +64,7 @@ class QBlittablePrivate;
class Q_GUI_EXPORT QBlittable
{
- Q_DECLARE_PRIVATE(QBlittable);
+ Q_DECLARE_PRIVATE(QBlittable)
public:
enum Capability {
diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp
index 84874bb75f..773e4096ee 100644
--- a/src/gui/painting/qcolor_p.cpp
+++ b/src/gui/painting/qcolor_p.cpp
@@ -40,31 +40,37 @@
#include "qglobal.h"
#include "qrgb.h"
#include "qstringlist.h"
+#include "private/qtools_p.h"
#include <algorithm>
QT_BEGIN_NAMESPACE
-static inline int h2i(char hex)
-{
- if (hex >= '0' && hex <= '9')
- return hex - '0';
- if (hex >= 'a' && hex <= 'f')
- return hex - 'a' + 10;
- if (hex >= 'A' && hex <= 'F')
- return hex - 'A' + 10;
- return -1;
-}
-
+/*!
+ \internal
+ If s[0..1] is a valid hex number, returns its integer value,
+ otherwise returns -1.
+ */
static inline int hex2int(const char *s)
{
- return (h2i(s[0]) << 4) | h2i(s[1]);
+ const int hi = QtMiscUtils::fromHex(s[0]);
+ if (hi < 0)
+ return -1;
+ const int lo = QtMiscUtils::fromHex(s[1]);
+ if (lo < 0)
+ return -1;
+ return (hi << 4) | lo;
}
+/*!
+ \internal
+ If s is a valid hex digit, returns its integer value,
+ multiplied by 0x11, otherwise returns -1.
+ */
static inline int hex2int(char s)
{
- int h = h2i(s);
- return (h << 4) | h;
+ const int h = QtMiscUtils::fromHex(s);
+ return h < 0 ? h : (h << 4) | h;
}
bool qt_get_hex_rgb(const char *name, QRgb *rgb)
@@ -130,7 +136,7 @@ bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb)
#define rgb(r,g,b) (0xff000000 | (r << 16) | (g << 8) | b)
static const struct RGBData {
- const char *name;
+ const char name[21];
uint value;
} rgbTbl[] = {
{ "aliceblue", rgb(240, 248, 255) },
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index 631584989a..77b5be0c4c 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
template <typename Type> class QDataBuffer
{
- Q_DISABLE_COPY(QDataBuffer);
+ Q_DISABLE_COPY(QDataBuffer)
public:
QDataBuffer(int res)
{
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index f0d0ac0283..4812cee9bb 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -2897,10 +2897,16 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
sbuf2[i * 2 + 1] = ((const uint*)s2)[x2];
fx += fdx;
}
+ int fastLen;
+ if (fdx > 0)
+ fastLen = qMin(len, int((image_x2 - (fx >> 16)) / data->m11));
+ else
+ fastLen = qMin(len, int((image_x1 - (fx >> 16)) / data->m11));
+ fastLen -= 3;
const __m128i v_fdx = _mm_set1_epi32(fdx*4);
__m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx);
- for (; i < len-3; i+=4) {
+ for (; i < fastLen; i += 4) {
int offset = _mm_extract_epi16(v_fx, 1);
sbuf1[i * 2 + 0] = ((const uint*)s1)[offset];
sbuf1[i * 2 + 1] = ((const uint*)s1)[offset + 1];
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 2b850cfb2a..db3453898f 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -208,13 +208,13 @@
#define ONE_PIXEL ( 1L << PIXEL_BITS )
#define PIXEL_MASK ( -1L << PIXEL_BITS )
#define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) )
-#define SUBPIXELS( x ) ( (TPos)(x) << PIXEL_BITS )
+#define SUBPIXELS( x ) ( (TPos)(x) * ( 1 << PIXEL_BITS ) )
#define FLOOR( x ) ( (x) & -ONE_PIXEL )
#define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL )
#define ROUND( x ) ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL )
#if PIXEL_BITS >= 6
-#define UPSCALE( x ) ( (x) << ( PIXEL_BITS - 6 ) )
+#define UPSCALE( x ) ( (x) * ( 1 << ( PIXEL_BITS - 6 ) ) )
#define DOWNSCALE( x ) ( (x) >> ( PIXEL_BITS - 6 ) )
#else
#define UPSCALE( x ) ( (x) >> ( 6 - PIXEL_BITS ) )
diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h
index 0aa2901b88..40f5347b26 100644
--- a/src/gui/painting/qpaintengine_blitter_p.h
+++ b/src/gui/painting/qpaintengine_blitter_p.h
@@ -63,7 +63,7 @@ class QBlittable;
class Q_GUI_EXPORT QBlitterPaintEngine : public QRasterPaintEngine
{
- Q_DECLARE_PRIVATE(QBlitterPaintEngine);
+ Q_DECLARE_PRIVATE(QBlitterPaintEngine)
public:
QBlitterPaintEngine(QBlittablePlatformPixmap *p);
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index eca1cb590c..52501880e4 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
typedef int Q16Dot16;
#define Q16Dot16ToFloat(i) ((i)/65536.)
#define FloatToQ16Dot16(i) (int)((i) * 65536.)
-#define IntToQ16Dot16(i) ((i) << 16)
+#define IntToQ16Dot16(i) ((i) * (1 << 16))
#define Q16Dot16ToInt(i) ((i) >> 16)
#define Q16Dot16Factor 65536
@@ -612,7 +612,7 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b)
int iBottom = qMin(m_bottom, int((b.y - 32 - rounding) >> 6));
if (iTop <= iBottom) {
- Q16Dot16 aFP = Q16Dot16Factor/2 + (a.x << 10) - rounding;
+ Q16Dot16 aFP = Q16Dot16Factor/2 + (a.x * (1 << 10)) - rounding;
if (b.x == a.x) {
Line line = { qBound(m_leftFP, aFP, m_rightFP), 0, iTop, iBottom, winding };
@@ -624,7 +624,7 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b)
Q16Dot16 xFP = aFP + Q16Dot16Multiply(slopeFP,
IntToQ16Dot16(iTop)
- + Q16Dot16Factor/2 - (a.y << 10));
+ + Q16Dot16Factor/2 - (a.y * (1 << 10)));
if (clip(xFP, iTop, iBottom, slopeFP, m_leftFP, winding))
return;
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 51b1418bc3..75e30b9552 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1827,7 +1827,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe
static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEngine::GlyphFormat glyphFormat)
{
- if (glyph == Q_NULLPTR)
+ if (glyph == Q_NULLPTR || glyph->height == 0 || glyph->width == 0)
return QImage();
QImage::Format format = QImage::Format_Invalid;
@@ -1875,11 +1875,15 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe
currentlyLockedAlphaMap = alphaMapFromGlyphData(glyph, neededFormat);
+ const bool glyphHasGeometry = glyph != Q_NULLPTR && glyph->height != 0 && glyph->width != 0;
if (!cacheEnabled && glyph != &emptyGlyph) {
currentlyLockedAlphaMap = currentlyLockedAlphaMap.copy();
delete glyph;
}
+ if (!glyphHasGeometry)
+ return Q_NULLPTR;
+
if (currentlyLockedAlphaMap.isNull())
return QFontEngine::lockedAlphaMapForGlyph(glyphIndex, subPixelPosition, neededFormat, t, offset);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index d11f8c34b1..cad30b0c77 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1567,12 +1567,13 @@ void QTextEngine::validate() const
layoutData = new LayoutData();
if (block.docHandle()) {
layoutData->string = block.text();
- if (block.next().isValid()) {
- if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
- layoutData->string += QChar(0xb6);
- } else if (option.flags() & QTextOption::ShowDocumentTerminator) {
+ const bool nextBlockValid = block.next().isValid();
+ if (!nextBlockValid && option.flags() & QTextOption::ShowDocumentTerminator) {
layoutData->string += QChar(0xA7);
+ } else if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) {
+ layoutData->string += QLatin1Char(nextBlockValid ? 0xb6 : 0x20);
}
+
} else {
layoutData->string = text;
}
diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp
index 4348b819d9..379cdd096d 100644
--- a/src/network/socket/qlocalsocket_tcp.cpp
+++ b/src/network/socket/qlocalsocket_tcp.cpp
@@ -245,8 +245,8 @@ void QLocalSocket::connectToServer(OpenMode openMode)
QLatin1String("QLocalSocket::connectToServer"));
return;
}
- d->tcpSocket->connectToHost(QHostAddress::LocalHost, port, openMode);
QIODevice::open(openMode);
+ d->tcpSocket->connectToHost(QHostAddress::LocalHost, port, openMode);
}
bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
diff --git a/src/network/ssl/qsslsocket_mac_p.h b/src/network/ssl/qsslsocket_mac_p.h
index 5210fb7f30..9e1d18981e 100644
--- a/src/network/ssl/qsslsocket_mac_p.h
+++ b/src/network/ssl/qsslsocket_mac_p.h
@@ -75,7 +75,7 @@ public:
private:
SSLContextRef context;
- Q_DISABLE_COPY(QSecureTransportContext);
+ Q_DISABLE_COPY(QSecureTransportContext)
};
class QSslSocketBackendPrivate : public QSslSocketPrivate
@@ -122,7 +122,7 @@ private:
QSecureTransportContext context;
- Q_DISABLE_COPY(QSslSocketBackendPrivate);
+ Q_DISABLE_COPY(QSslSocketBackendPrivate)
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 652a9f4add..02b7e1bd63 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -365,6 +365,7 @@ static const char *getFcFamilyForStyleHint(const QFont::StyleHint style)
static void populateFromPattern(FcPattern *pattern)
{
QString familyName;
+ QString familyNameLang;
FcChar8 *value = 0;
int weight_value;
int slant_value;
@@ -382,6 +383,9 @@ static void populateFromPattern(FcPattern *pattern)
familyName = QString::fromUtf8((const char *)value);
+ if (FcPatternGetString(pattern, FC_FAMILYLANG, 0, &value) == FcResultMatch)
+ familyNameLang = QString::fromUtf8((const char *)value);
+
slant_value = FC_SLANT_ROMAN;
weight_value = FC_WEIGHT_REGULAR;
spacing_value = FC_PROPORTIONAL;
@@ -471,8 +475,30 @@ static void populateFromPattern(FcPattern *pattern)
QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile);
// qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size;
- for (int k = 1; FcPatternGetString(pattern, FC_FAMILY, k, &value) == FcResultMatch; ++k)
- QPlatformFontDatabase::registerAliasToFontFamily(familyName, QString::fromUtf8((const char *)value));
+ for (int k = 1; FcPatternGetString(pattern, FC_FAMILY, k, &value) == FcResultMatch; ++k) {
+ const QString altFamilyName = QString::fromUtf8((const char *)value);
+ // Extra family names can be aliases or subfamilies.
+ // If it is a subfamily, register it as a separate font, so only members of the subfamily are
+ // matched when the subfamily is requested.
+ QString altStyleName;
+ if (FcPatternGetString(pattern, FC_STYLE, k, &value) == FcResultMatch)
+ altStyleName = QString::fromUtf8((const char *)value);
+ else
+ altStyleName = styleName;
+
+ QString altFamilyNameLang;
+ if (FcPatternGetString(pattern, FC_FAMILYLANG, k, &value) == FcResultMatch)
+ altFamilyNameLang = QString::fromUtf8((const char *)value);
+ else
+ altFamilyNameLang = familyNameLang;
+
+ if (familyNameLang == altFamilyNameLang && altStyleName != styleName) {
+ FontFile *altFontFile = new FontFile(*fontFile);
+ QPlatformFontDatabase::registerFont(altFamilyName, altStyleName, QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,altFontFile);
+ } else {
+ QPlatformFontDatabase::registerAliasToFontFamily(familyName, altFamilyName);
+ }
+ }
}
@@ -488,7 +514,7 @@ void QFontconfigDatabase::populateFontDatabase()
FC_FAMILY, FC_STYLE, FC_WEIGHT, FC_SLANT,
FC_SPACING, FC_FILE, FC_INDEX,
FC_LANG, FC_CHARSET, FC_FOUNDRY, FC_SCALABLE, FC_PIXEL_SIZE,
- FC_WIDTH,
+ FC_WIDTH, FC_FAMILYLANG,
#if FC_VERSION >= 20297
FC_CAPABILITY,
#endif
diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
index 0667a9073f..a14271c8f5 100644
--- a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
+++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
@@ -60,7 +60,8 @@ void QAndroidPlatformFontDatabase::populateFontDatabase()
QStringList nameFilters;
nameFilters << QLatin1String("*.ttf")
- << QLatin1String("*.otf");
+ << QLatin1String("*.otf")
+ << QLatin1String("*.ttc");
const auto entries = dir.entryInfoList(nameFilters, QDir::Files);
for (const QFileInfo &fi : entries) {
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp
index 363fce2214..4e811a1dfe 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp
@@ -93,9 +93,23 @@ void QEglFSBrcmIntegration::platformInit()
bcm_host_init();
}
+static int getDisplayId()
+{
+ // As defined in vc_dispmanx_types.h
+ // DISPMANX_ID_MAIN_LCD 0
+ // DISPMANX_ID_AUX_LCD 1
+ // DISPMANX_ID_HDMI 2
+ // DISPMANX_ID_SDTV 3
+ // DISPMANX_ID_FORCE_LCD 4
+ // DISPMANX_ID_FORCE_TV 5
+ // DISPMANX_ID_FORCE_OTHER 6 /* non-default display */
+ static const int dispmanxId = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DISPMANX_ID");
+ return (dispmanxId >= 0 && dispmanxId <= 6) ? dispmanxId : 0;
+}
+
EGLNativeDisplayType QEglFSBrcmIntegration::platformDisplay() const
{
- dispman_display = vc_dispmanx_display_open(0/* LCD */);
+ dispman_display = vc_dispmanx_display_open(getDisplayId());
return EGL_DEFAULT_DISPLAY;
}
@@ -107,7 +121,7 @@ void QEglFSBrcmIntegration::platformDestroy()
QSize QEglFSBrcmIntegration::screenSize() const
{
uint32_t width, height;
- graphics_get_display_size(0 /* LCD */, &width, &height);
+ graphics_get_display_size(getDisplayId(), &width, &height);
return QSize(width, height);
}
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 5e75cbf37e..65f2cd14f6 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -40,6 +40,7 @@
#include "qwindowsfontdatabase.h"
#include "qwindowsfontdatabase_ft.h" // for default font
#include "qwindowscontext.h"
+#include "qwindowsintegration.h"
#include "qwindowsfontengine.h"
#include "qwindowsfontenginedirectwrite.h"
#include <QtCore/qt_windows.h>
@@ -108,6 +109,18 @@ static void createDirectWriteFactory(IDWriteFactory **factory)
*factory = static_cast<IDWriteFactory *>(result);
}
+
+static inline bool useDirectWrite(QFont::HintingPreference hintingPreference, bool isColorFont = false)
+{
+ const unsigned options = QWindowsIntegration::instance()->options();
+ if (Q_UNLIKELY(options & QWindowsIntegration::DontUseDirectWriteFonts))
+ return false;
+ if (isColorFont)
+ return (options & QWindowsIntegration::DontUseColorFonts) == 0;
+ return hintingPreference == QFont::PreferNoHinting
+ || hintingPreference == QFont::PreferVerticalHinting
+ || (QHighDpiScaling::isActive() && hintingPreference == QFont::PreferDefaultHinting);
+}
#endif // !QT_NO_DIRECTWRITE
// Helper classes for creating font engines directly from font data
@@ -1199,11 +1212,7 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal
QFontEngine *fontEngine = 0;
#if !defined(QT_NO_DIRECTWRITE)
- bool useDirectWrite = (hintingPreference == QFont::PreferNoHinting)
- || (hintingPreference == QFont::PreferVerticalHinting)
- || (QHighDpiScaling::isActive() && hintingPreference == QFont::PreferDefaultHinting);
-
- if (!useDirectWrite)
+ if (!useDirectWrite(hintingPreference))
#endif
{
GUID guid;
@@ -1838,15 +1847,16 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request,
if (SUCCEEDED(directWriteFontFace->QueryInterface(__uuidof(IDWriteFontFace2),
reinterpret_cast<void **>(&directWriteFontFace2)))) {
if (directWriteFontFace2->IsColorFont())
- isColorFont = true;
+ isColorFont = directWriteFontFace2->GetPaletteEntryCount() > 0;
}
#endif
-
- bool useDirectWrite = (request.hintingPreference == QFont::PreferNoHinting)
- || (request.hintingPreference == QFont::PreferVerticalHinting)
- || (QHighDpiScaling::isActive() && request.hintingPreference == QFont::PreferDefaultHinting)
- || isColorFont;
- if (useDirectWrite) {
+ const QFont::HintingPreference hintingPreference =
+ static_cast<QFont::HintingPreference>(request.hintingPreference);
+ const bool useDw = useDirectWrite(hintingPreference, isColorFont);
+ qCDebug(lcQpaFonts) << __FUNCTION__ << request.family << request.pointSize
+ << "pt" << "hintingPreference=" << hintingPreference << "color=" << isColorFont
+ << dpi << "dpi" << "useDirectWrite=" << useDw;
+ if (useDw) {
QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace,
request.pixelSize,
data);
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 90aa3fef16..b9a63c7a89 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -192,6 +192,10 @@ static inline unsigned parseOptions(const QStringList &paramList,
}
} else if (param == QLatin1String("gl=gdi")) {
options |= QWindowsIntegration::DisableArb;
+ } else if (param == QLatin1String("nodirectwrite")) {
+ options |= QWindowsIntegration::DontUseDirectWriteFonts;
+ } else if (param == QLatin1String("nocolorfonts")) {
+ options |= QWindowsIntegration::DontUseColorFonts;
} else if (param == QLatin1String("nomousefromtouch")) {
options |= QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch;
} else if (parseIntOption(param, QLatin1String("verbose"), 0, INT_MAX, &QWindowsContext::verbose)
@@ -304,7 +308,7 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons
if (window->type() == Qt::ForeignWindow) {
const HWND hwnd = reinterpret_cast<HWND>(window->winId());
if (!IsWindow(hwnd)) {
- qWarning("Windows QPA: Invalid foreign window ID %p.");
+ qWarning("Windows QPA: Invalid foreign window ID %p.", hwnd);
return nullptr;
}
QWindowsForeignWindow *result = new QWindowsForeignWindow(window, hwnd);
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index 437253cedc..4258f908e7 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -60,7 +60,9 @@ public:
DisableArb = 0x4,
NoNativeDialogs = 0x8,
XpNativeDialogs = 0x10,
- DontPassOsMouseEventsSynthesizedFromTouch = 0x20 // Do not pass OS-generated mouse events from touch.
+ DontPassOsMouseEventsSynthesizedFromTouch = 0x20, // Do not pass OS-generated mouse events from touch.
+ DontUseDirectWriteFonts = 0x40,
+ DontUseColorFonts = 0x80
};
explicit QWindowsIntegration(const QStringList &paramList);
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 8d6e83298e..79b5bbae41 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -43,6 +43,7 @@
#include "qwindowswindow.h"
#include "qwindowsinputcontext.h"
+#include <QtGui/QGuiApplication>
#include <QtGui/QWindow>
#include <qpa/qwindowsysteminterface.h>
#include <private/qguiapplication_p.h>
@@ -1048,6 +1049,21 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
if (PeekMessage(&wm_char, 0, charType, charType, PM_REMOVE)) {
// Found a ?_CHAR
uch = QChar(ushort(wm_char.wParam));
+ if (uch.isHighSurrogate()) {
+ m_lastHighSurrogate = uch;
+ return true;
+ } else if (uch.isLowSurrogate() && !m_lastHighSurrogate.isNull()) {
+ if (QObject *focusObject = QGuiApplication::focusObject()) {
+ const QChar chars[2] = {m_lastHighSurrogate, uch};
+ QInputMethodEvent event;
+ event.setCommitString(QString(chars, 2));
+ QCoreApplication::sendEvent(focusObject, &event);
+ }
+ m_lastHighSurrogate = QChar();
+ return true;
+ } else {
+ m_lastHighSurrogate = QChar();
+ }
if (msgType == WM_SYSKEYDOWN && uch.isLetter() && (msg.lParam & KF_ALTDOWN))
uch = uch.toLower(); // (See doc of WM_SYSCHAR) Alt-letter
if (!code && !uch.row())
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.h b/src/plugins/platforms/windows/qwindowskeymapper.h
index 069f78197e..2657644780 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.h
+++ b/src/plugins/platforms/windows/qwindowskeymapper.h
@@ -103,6 +103,7 @@ private:
void deleteLayouts();
QWindow *m_keyGrabber;
+ QChar m_lastHighSurrogate;
static const size_t NumKeyboardLayoutItems = 256;
KeyboardLayoutItem keyLayout[NumKeyboardLayoutItems];
};
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
index 8fc54794bc..e58f194b72 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -27,6 +27,8 @@
****************************************************************************/
#include <qbytearray.h>
+#include <qcommandlineparser.h>
+#include <qcoreapplication.h>
#include <qdebug.h>
#include <qfile.h>
#include <qfileinfo.h>
@@ -59,30 +61,6 @@ static QString commandLine;
static QStringList includes;
static QStringList wantedInterfaces;
-static const char help[] =
- "Usage: " PROGRAMNAME " [options...] [xml-or-xml-file] [interfaces...]\n"
- "Produces the C++ code to implement the interfaces defined in the input file.\n"
- "\n"
- "Options:\n"
- " -a <filename> Write the adaptor code to <filename>\n"
- " -c <classname> Use <classname> as the class name for the generated classes\n"
- " -h Show this information\n"
- " -i <filename> Add #include to the output\n"
- " -l <classname> When generating an adaptor, use <classname> as the parent class\n"
- " -m Generate #include \"filename.moc\" statements in the .cpp files\n"
- " -N Don't use namespaces\n"
- " -p <filename> Write the proxy code to <filename>\n"
- " -v Be verbose.\n"
- " -V Show the program version and quit.\n"
- "\n"
- "If the file name given to the options -a and -p does not end in .cpp or .h, the\n"
- "program will automatically append the suffixes and produce both files.\n"
- "You can also use a colon (:) to separate the header name from the source file\n"
- "name, as in '-a filename_p.h:filename.cpp'.\n"
- "\n"
- "If you pass a dash (-) as the argument to either -p or -a, the output is written\n"
- "to the standard output\n";
-
static const char includeList[] =
"#include <QtCore/QByteArray>\n"
"#include <QtCore/QList>\n"
@@ -101,105 +79,6 @@ static const char forwardDeclarations[] =
"class QVariant;\n"
"QT_END_NAMESPACE\n";
-static void showHelp()
-{
- printf("%s", help);
- exit(0);
-}
-
-static void showVersion()
-{
- printf("%s version %s\n", PROGRAMNAME, PROGRAMVERSION);
- printf("D-Bus binding tool for Qt\n");
- exit(0);
-}
-
-static QString nextArg(QStringList &args, int i, char opt)
-{
- QString arg = args.value(i);
- if (arg.isEmpty()) {
- printf("-%c needs at least one argument\n", opt);
- exit(1);
- }
- return args.takeAt(i);
-}
-
-static void parseCmdLine(QStringList args)
-{
- args.takeFirst();
-
- commandLine = QLatin1String(PROGRAMNAME " ");
- commandLine += args.join(QLatin1Char(' '));
-
- int i = 0;
- while (i < args.count()) {
-
- if (!args.at(i).startsWith(QLatin1Char('-'))) {
- ++i;
- continue;
- }
- QString arg = args.takeAt(i);
-
- char c = '\0';
- if (arg.length() == 2)
- c = arg.at(1).toLatin1();
- else if (arg == QLatin1String("--help"))
- c = 'h';
-
- switch (c) {
- case 'a':
- adaptorFile = nextArg(args, i, 'a');
- break;
-
- case 'c':
- globalClassName = nextArg(args, i, 'c');
- break;
-
- case 'v':
- verbose = true;
- break;
-
- case 'i':
- includes << nextArg(args, i, 'i');
- break;
-
- case 'l':
- parentClassName = nextArg(args, i, 'l');
- break;
-
- case 'm':
- includeMocs = true;
- break;
-
- case 'N':
- skipNamespaces = true;
- break;
-
- case '?':
- case 'h':
- showHelp();
- break;
-
- case 'V':
- showVersion();
- break;
-
- case 'p':
- proxyFile = nextArg(args, i, 'p');
- break;
-
- default:
- printf("unknown option: '%s'\n", qPrintable(arg));
- exit(1);
- }
- }
-
- if (!args.isEmpty())
- inputFile = args.takeFirst();
-
- wantedInterfaces << args;
-}
-
static QDBusIntrospection::Interfaces readInput()
{
QFile input(inputFile);
@@ -1139,13 +1018,79 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
int main(int argc, char **argv)
{
- QStringList arguments;
- arguments.reserve(argc);
- for (int i = 0; i < argc; ++i) {
- arguments.append(QString::fromLocal8Bit(argv[i]));
- }
+ QCoreApplication app(argc, argv);
+ QCoreApplication::setApplicationName(QStringLiteral(PROGRAMNAME));
+ QCoreApplication::setApplicationVersion(QStringLiteral(PROGRAMVERSION));
+
+ QCommandLineParser parser;
+ parser.setApplicationDescription(QLatin1String(
+ "Produces the C++ code to implement the interfaces defined in the input file.\n\n"
+ "If the file name given to the options -a and -p does not end in .cpp or .h, the\n"
+ "program will automatically append the suffixes and produce both files.\n"
+ "You can also use a colon (:) to separate the header name from the source file\n"
+ "name, as in '-a filename_p.h:filename.cpp'.\n\n"
+ "If you pass a dash (-) as the argument to either -p or -a, the output is written\n"
+ "to the standard output."));
+
+ parser.addHelpOption();
+ parser.addVersionOption();
+ parser.addPositionalArgument(QStringLiteral("xml-or-xml-file"), QStringLiteral("XML file to use."));
+ parser.addPositionalArgument(QStringLiteral("interfaces"), QStringLiteral("List of interfaces to use."),
+ QStringLiteral("[interfaces ...]"));
+
+ QCommandLineOption adapterCodeOption(QStringList() << QStringLiteral("a") << QStringLiteral("adaptor"),
+ QStringLiteral("Write the adaptor code to <filename>"), QStringLiteral("filename"));
+ parser.addOption(adapterCodeOption);
+
+ QCommandLineOption classNameOption(QStringList() << QStringLiteral("c") << QStringLiteral("classname"),
+ QStringLiteral("Use <classname> as the class name for the generated classes"), QStringLiteral("classname"));
+ parser.addOption(classNameOption);
+
+ QCommandLineOption addIncludeOption(QStringList() << QStringLiteral("i") << QStringLiteral("include"),
+ QStringLiteral("Add #include to the output"), QStringLiteral("filename"));
+ parser.addOption(addIncludeOption);
+
+ QCommandLineOption adapterParentOption(QStringLiteral("l"),
+ QStringLiteral("When generating an adaptor, use <classname> as the parent class"), QStringLiteral("classname"));
+ parser.addOption(adapterParentOption);
+
+ QCommandLineOption mocIncludeOption(QStringList() << QStringLiteral("m") << QStringLiteral("moc"),
+ QStringLiteral("Generate #include \"filename.moc\" statements in the .cpp files"));
+ parser.addOption(mocIncludeOption);
+
+ QCommandLineOption noNamespaceOption(QStringList() << QStringLiteral("N") << QStringLiteral("no-namespaces"),
+ QStringLiteral("Don't use namespaces"));
+ parser.addOption(noNamespaceOption);
+
+ QCommandLineOption proxyCodeOption(QStringList() << QStringLiteral("p") << QStringLiteral("proxy"),
+ QStringLiteral("Write the proxy code to <filename>"), QStringLiteral("filename"));
+ parser.addOption(proxyCodeOption);
+
+ QCommandLineOption verboseOption(QStringList() << QStringLiteral("V") << QStringLiteral("verbose"),
+ QStringLiteral("Be verbose."));
+ parser.addOption(verboseOption);
+
+ parser.process(app);
+
+ adaptorFile = parser.value(adapterCodeOption);
+ globalClassName = parser.value(classNameOption);
+ includes = parser.values(addIncludeOption);
+ parentClassName = parser.value(adapterParentOption);
+ includeMocs = parser.isSet(mocIncludeOption);
+ skipNamespaces = parser.isSet(noNamespaceOption);
+ proxyFile = parser.value(proxyCodeOption);
+ verbose = parser.isSet(verboseOption);
+
+ wantedInterfaces = parser.positionalArguments();
+ if (!wantedInterfaces.isEmpty()) {
+ inputFile = wantedInterfaces.takeFirst();
- parseCmdLine(arguments);
+ QFileInfo inputInfo(inputFile);
+ if (!inputInfo.exists() || !inputInfo.isFile() || !inputInfo.isReadable()) {
+ qCritical("Error: Input %s is not a file or cannot be accessed\n", qPrintable(inputFile));
+ return 1;
+ }
+ }
QDBusIntrospection::Interfaces interfaces = readInput();
cleanInterfaces(interfaces);
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 689704884f..73aeb24cc0 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -667,7 +667,7 @@ void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button
If the \l{QMessageBox::StandardButtons} {standard buttons} are not
flexible enough for your message box, you can use the addButton()
- overload that takes a text and a ButtonRoleto to add custom
+ overload that takes a text and a ButtonRole to add custom
buttons. The ButtonRole is used by QMessageBox to determine the
ordering of the buttons on screen (which varies according to the
platform). You can test the value of clickedButton() after calling
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 221511f38d..42b35ac644 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -788,8 +788,10 @@ void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel)
QModelIndex oldCurrentIndex;
if (d->selectionModel) {
- oldSelection = d->selectionModel->selection();
- oldCurrentIndex = d->selectionModel->currentIndex();
+ if (d->selectionModel->model() == selectionModel->model()) {
+ oldSelection = d->selectionModel->selection();
+ oldCurrentIndex = d->selectionModel->currentIndex();
+ }
disconnect(d->selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
@@ -3871,7 +3873,7 @@ void QAbstractItemView::doAutoScroll()
int horizontalValue = horizontalScroll->value();
QPoint pos = d->viewport->mapFromGlobal(QCursor::pos());
- QRect area = static_cast<QAbstractItemView*>(d->viewport)->d_func()->clipRect(); // access QWidget private by bending C++ rules
+ QRect area = QWidgetPrivate::get(d->viewport)->clipRect();
// do the scrolling if we are in the scroll margins
if (pos.y() - area.top() < margin)
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index b080f84e90..d6c5d58934 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -46,6 +46,9 @@
#include <QtCore/qitemselectionmodel.h>
#include <QtWidgets/qabstractitemdelegate.h>
+class tst_QAbstractItemView;
+class tst_QTreeView;
+
QT_BEGIN_NAMESPACE
@@ -368,6 +371,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_scrollerStateChanged())
#endif
+ friend class ::tst_QAbstractItemView;
+ friend class ::tst_QTreeView;
friend class QTreeViewPrivate; // needed to compile with MSVC
friend class QListModeViewBase;
friend class QListViewPrivate;
diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp
index 4bf7406f92..b213a0859c 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.cpp
+++ b/src/widgets/itemviews/qdatawidgetmapper.cpp
@@ -205,20 +205,6 @@ void QDataWidgetMapperPrivate::_q_commitData(QWidget *w)
commit(widgetMap.at(idx));
}
-class QFocusHelper: public QWidget
-{
-public:
- bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE
- {
- return QWidget::focusNextPrevChild(next);
- }
-
- static inline void focusNextPrevChild(QWidget *w, bool next)
- {
- static_cast<QFocusHelper *>(w)->focusNextPrevChild(next);
- }
-};
-
void QDataWidgetMapperPrivate::_q_closeEditor(QWidget *w, QAbstractItemDelegate::EndEditHint hint)
{
int idx = findWidget(w);
@@ -230,10 +216,10 @@ void QDataWidgetMapperPrivate::_q_closeEditor(QWidget *w, QAbstractItemDelegate:
populate(widgetMap[idx]);
break; }
case QAbstractItemDelegate::EditNextItem:
- QFocusHelper::focusNextPrevChild(w, true);
+ w->focusNextChild();
break;
case QAbstractItemDelegate::EditPreviousItem:
- QFocusHelper::focusNextPrevChild(w, false);
+ w->focusPreviousChild();
break;
case QAbstractItemDelegate::SubmitModelCache:
case QAbstractItemDelegate::NoHint:
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 7b393463a6..1a0b417034 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -3465,6 +3465,7 @@ void QHeaderViewPrivate::clear()
sectionSelected.clear();
hiddenSectionSize.clear();
sectionItems.clear();
+ lastSectionLogicalIdx = -1;
invalidateCachedSizeHint();
}
}
diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index b3a88db005..3c7cbddfbb 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractitemview.h>
+class tst_QTreeView;
+
QT_BEGIN_NAMESPACE
@@ -220,6 +222,7 @@ protected:
void currentChanged(const QModelIndex &current, const QModelIndex &previous) Q_DECL_OVERRIDE;
private:
+ friend class ::tst_QTreeView;
friend class QAccessibleTable;
friend class QAccessibleTree;
friend class QAccessibleTableCell;
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 74ca7d2827..31d60c06d7 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -146,6 +146,7 @@ QTreeModel::QTreeModel(QTreeModelPrivate &dd, QTreeWidget *parent)
QTreeModel::~QTreeModel()
{
clear();
+ headerItem->view = Q_NULLPTR;
delete headerItem;
rootItem->view = 0;
delete rootItem;
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 2a71710143..bca89fe2c5 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -676,6 +676,7 @@ protected:
void destroy(bool destroyWindow = true,
bool destroySubWindows = true);
+ friend class QDataWidgetMapperPrivate; // for access to focusNextPrevChild
virtual bool focusNextPrevChild(bool next);
inline bool focusNextChild() { return focusNextPrevChild(true); }
inline bool focusPreviousChild() { return focusNextPrevChild(false); }