summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-11-20 01:00:50 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-11-20 01:00:51 +0100
commit1315133233785f8d0b6b3e9c0967e131b9b322f9 (patch)
tree30686773241f619ebab1d4de88053f49ac6b01d4
parentb10e1209e1c3655ee6e57185bb5375408ce02e56 (diff)
parent315c2c468e504b83d616e2068bd4f7688ff58cf7 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
-rw-r--r--qmake/Makefile.win322
-rw-r--r--src/gui/kernel/qevent.cpp1
-rw-r--r--src/sql/kernel/qsqlquery.cpp3
-rw-r--r--src/widgets/doc/snippets/simplemodel-use/main.cpp7
-rw-r--r--src/widgets/doc/src/model-view-programming.qdoc13
-rw-r--r--src/xml/dom/qdom.cpp19
-rw-r--r--tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp2
-rw-r--r--tests/auto/xml/dom/qdom/tst_qdom.cpp69
8 files changed, 96 insertions, 20 deletions
diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32
index 74fb80e337..ab49113fc7 100644
--- a/qmake/Makefile.win32
+++ b/qmake/Makefile.win32
@@ -13,7 +13,7 @@ QMKSRC = $(SOURCE_PATH)\qmake
!if "$(QMAKESPEC)" == "win32-icc"
CXX = icl
LINKER = xilink
-CFLAGS_EXTRA = /Zc:forScope /Qstd=c++11 /O3
+CFLAGS_EXTRA = /Zc:forScope /Qstd=c++11
!elseif "$(QMAKESPEC)" == "win32-clang-msvc"
CXX = clang-cl
LINKER = lld-link
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 2b28052dd5..f555f4dc05 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -846,6 +846,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
/*!
Constructs a wheel event object.
+ \since 5.12
The \a pos provides the location of the mouse cursor
within the window. The position in global coordinates is specified
by \a globalPos.
diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp
index e7c444f5b9..34a3ba3755 100644
--- a/src/sql/kernel/qsqlquery.cpp
+++ b/src/sql/kernel/qsqlquery.cpp
@@ -182,6 +182,9 @@ QSqlQueryPrivate::~QSqlQueryPrivate()
You can retrieve the values of all the fields in a single variable
(a map) using boundValues().
+ \note Not all SQL operations support binding values. Refer to your database
+ system's documentation to check their availability.
+
\section1 Approaches to Binding Values
Below we present the same example using each of the four
diff --git a/src/widgets/doc/snippets/simplemodel-use/main.cpp b/src/widgets/doc/snippets/simplemodel-use/main.cpp
index 3e106c8eea..940669e101 100644
--- a/src/widgets/doc/snippets/simplemodel-use/main.cpp
+++ b/src/widgets/doc/snippets/simplemodel-use/main.cpp
@@ -79,8 +79,11 @@ int main(int argc, char *argv[])
//! [0]
QFileSystemModel *model = new QFileSystemModel;
- QModelIndex parentIndex = model->index(QDir::currentPath());
- int numRows = model->rowCount(parentIndex);
+ connect(model, &QFileSystemModel::directoryLoaded, [model](const QString &directory) {
+ QModelIndex parentIndex = model->index(directory);
+ int numRows = model->rowCount(parentIndex);
+ });
+ model->setRootPath(QDir::currentPath);
//! [0]
//! [1]
diff --git a/src/widgets/doc/src/model-view-programming.qdoc b/src/widgets/doc/src/model-view-programming.qdoc
index 236582ef3f..ede1ebf932 100644
--- a/src/widgets/doc/src/model-view-programming.qdoc
+++ b/src/widgets/doc/src/model-view-programming.qdoc
@@ -465,14 +465,19 @@
Although this does not show a normal way of using a model, it demonstrates
the conventions used by models when dealing with model indexes.
+ QFileSystemModel loading is asynchronous to minimize system resource use.
+ We have to take that into account when dealing with this model.
+
We construct a file system model in the following way:
\snippet simplemodel-use/main.cpp 0
- In this case, we set up a default QFileSystemModel, obtain a parent index
- using a specific implementation of \l{QFileSystemModel::}{index()}
- provided by that model, and we count the number of rows in the model using
- the \l{QFileSystemModel::}{rowCount()} function.
+ In this case, we start by setting up a default QFileSystemModel. We connect
+ it to a lambda, in which we will obtain a parent index using a specific
+ implementation of \l{QFileSystemModel::}{index()} provided by that model.
+ In the lambda, we count the number of rows in the model using the
+ \l{QFileSystemModel::}{rowCount()} function. Finally, we set the root path
+ of the QFileSystemModel so it starts loading data and triggers the lambda.
For simplicity, we are only interested in the items in the first column
of the model. We examine each row in turn, obtaining a model index for
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 75b7f8988c..bbbdf1c6f3 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -4312,20 +4312,20 @@ void QDomElement::setAttribute(const QString& name, const QString& value)
\fn void QDomElement::setAttribute(const QString& name, int value)
\overload
- The number is formatted according to the current locale.
+ The formatting always uses QLocale::C.
*/
/*!
\fn void QDomElement::setAttribute(const QString& name, uint value)
\overload
- The number is formatted according to the current locale.
+ The formatting always uses QLocale::C.
*/
/*!
\overload
- The number is formatted according to the current locale.
+ The formatting always uses QLocale::C.
*/
void QDomElement::setAttribute(const QString& name, qlonglong value)
{
@@ -4339,7 +4339,7 @@ void QDomElement::setAttribute(const QString& name, qlonglong value)
/*!
\overload
- The number is formatted according to the current locale.
+ The formatting always uses QLocale::C.
*/
void QDomElement::setAttribute(const QString& name, qulonglong value)
{
@@ -4353,7 +4353,7 @@ void QDomElement::setAttribute(const QString& name, qulonglong value)
/*!
\overload
- The number is formatted according to the current locale.
+ The formatting always uses QLocale::C.
*/
void QDomElement::setAttribute(const QString& name, float value)
{
@@ -4367,19 +4367,14 @@ void QDomElement::setAttribute(const QString& name, float value)
/*!
\overload
- The number is formatted according to the current locale.
+ The formatting always uses QLocale::C.
*/
void QDomElement::setAttribute(const QString& name, double value)
{
if (!impl)
return;
QString x;
- char buf[256];
- int count = qsnprintf(buf, sizeof(buf), "%.16g", value);
- if (count > 0)
- x = QString::fromLatin1(buf, count);
- else
- x.setNum(value); // Fallback
+ x.setNum(value);
IMPL->setAttribute(name, x);
}
diff --git a/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp b/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
index f95d48f042..01181ce20e 100644
--- a/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
+++ b/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
@@ -67,7 +67,7 @@ void tst_QScopedGuard::exceptions()
bool caught = false;
QT_TRY
{
- auto cleanup = qScopeGuard([&caught] { s_globalState++; });
+ auto cleanup = qScopeGuard([] { s_globalState++; });
QT_THROW(std::bad_alloc()); //if Qt compiled without exceptions this is noop
s_globalState = 100;
}
diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp
index b09a3447e3..99639df5b0 100644
--- a/tests/auto/xml/dom/qdom/tst_qdom.cpp
+++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp
@@ -57,6 +57,7 @@ private slots:
void toString_02();
void hasAttributes_data();
void hasAttributes();
+ void setGetAttributes();
void save_data();
void save();
void saveWithSerialization() const;
@@ -392,6 +393,74 @@ void tst_QDom::hasAttributes()
QTEST( visitedNodes, "visitedNodes" );
}
+void tst_QDom::setGetAttributes()
+{
+ QDomDocument doc;
+ QDomElement rootNode = doc.createElement("Root");
+ doc.appendChild(rootNode);
+
+ const QLocale oldLocale = QLocale();
+ QLocale::setDefault(QLocale::German); // decimal separator != '.'
+
+ const QString qstringVal("QString");
+ const qlonglong qlonglongVal = std::numeric_limits<qlonglong>::min();
+ const qulonglong qulonglongVal = std::numeric_limits<qulonglong>::max();
+ const int intVal = std::numeric_limits<int>::min();
+ const uint uintVal = std::numeric_limits<uint>::max();
+ const float floatVal = 0.1234f;
+ const double doubleVal = 0.1234;
+
+ rootNode.setAttribute("qstringVal", qstringVal);
+ rootNode.setAttribute("qlonglongVal", qlonglongVal);
+ rootNode.setAttribute("qulonglongVal", qulonglongVal);
+ rootNode.setAttribute("intVal", intVal);
+ rootNode.setAttribute("uintVal", uintVal);
+ rootNode.setAttribute("floatVal", floatVal);
+ rootNode.setAttribute("doubleVal", doubleVal);
+
+ QDomElement nsNode = doc.createElement("NS");
+ rootNode.appendChild(nsNode);
+ nsNode.setAttributeNS("namespace", "qstringVal", qstringVal);
+ nsNode.setAttributeNS("namespace", "qlonglongVal", qlonglongVal);
+ nsNode.setAttributeNS("namespace", "qulonglongVal", qulonglongVal);
+ nsNode.setAttributeNS("namespace", "intVal", intVal);
+ nsNode.setAttributeNS("namespace", "uintVal", uintVal);
+ nsNode.setAttributeNS("namespace", "floatVal", floatVal); // not available atm
+ nsNode.setAttributeNS("namespace", "doubleVal", doubleVal);
+
+ bool bOk;
+ QCOMPARE(rootNode.attribute("qstringVal"), qstringVal);
+ QCOMPARE(rootNode.attribute("qlonglongVal").toLongLong(&bOk), qlonglongVal);
+ QVERIFY(bOk);
+ QCOMPARE(rootNode.attribute("qulonglongVal").toULongLong(&bOk), qulonglongVal);
+ QVERIFY(bOk);
+ QCOMPARE(rootNode.attribute("intVal").toInt(&bOk), intVal);
+ QVERIFY(bOk);
+ QCOMPARE(rootNode.attribute("uintVal").toUInt(&bOk), uintVal);
+ QVERIFY(bOk);
+ QCOMPARE(rootNode.attribute("floatVal").toFloat(&bOk), floatVal);
+ QVERIFY(bOk);
+ QCOMPARE(rootNode.attribute("doubleVal").toDouble(&bOk), doubleVal);
+ QVERIFY(bOk);
+
+ QCOMPARE(nsNode.attributeNS("namespace", "qstringVal"), qstringVal);
+ QCOMPARE(nsNode.attributeNS("namespace", "qlonglongVal").toLongLong(&bOk), qlonglongVal);
+ QVERIFY(bOk);
+ QCOMPARE(nsNode.attributeNS("namespace", "qulonglongVal").toULongLong(&bOk), qulonglongVal);
+ QVERIFY(bOk);
+ QCOMPARE(nsNode.attributeNS("namespace", "intVal").toInt(&bOk), intVal);
+ QVERIFY(bOk);
+ QCOMPARE(nsNode.attributeNS("namespace", "uintVal").toUInt(&bOk), uintVal);
+ QVERIFY(bOk);
+ QCOMPARE(nsNode.attributeNS("namespace", "floatVal").toFloat(&bOk), floatVal);
+ QVERIFY(bOk);
+ QCOMPARE(nsNode.attributeNS("namespace", "doubleVal").toDouble(&bOk), doubleVal);
+ QVERIFY(bOk);
+
+ QLocale::setDefault(oldLocale);
+}
+
+
int tst_QDom::hasAttributesHelper( const QDomNode& node )
{
int visitedNodes = 1;