Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ic4ffd206bdd3ed68fd3d21a93818923e8d3a1e7a
This commit is contained in:
commit
1315133233
@ -13,7 +13,7 @@ QMKSRC = $(SOURCE_PATH)\qmake
|
|||||||
!if "$(QMAKESPEC)" == "win32-icc"
|
!if "$(QMAKESPEC)" == "win32-icc"
|
||||||
CXX = icl
|
CXX = icl
|
||||||
LINKER = xilink
|
LINKER = xilink
|
||||||
CFLAGS_EXTRA = /Zc:forScope /Qstd=c++11 /O3
|
CFLAGS_EXTRA = /Zc:forScope /Qstd=c++11
|
||||||
!elseif "$(QMAKESPEC)" == "win32-clang-msvc"
|
!elseif "$(QMAKESPEC)" == "win32-clang-msvc"
|
||||||
CXX = clang-cl
|
CXX = clang-cl
|
||||||
LINKER = lld-link
|
LINKER = lld-link
|
||||||
|
@ -846,6 +846,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
|
|||||||
/*!
|
/*!
|
||||||
Constructs a wheel event object.
|
Constructs a wheel event object.
|
||||||
|
|
||||||
|
\since 5.12
|
||||||
The \a pos provides the location of the mouse cursor
|
The \a pos provides the location of the mouse cursor
|
||||||
within the window. The position in global coordinates is specified
|
within the window. The position in global coordinates is specified
|
||||||
by \a globalPos.
|
by \a globalPos.
|
||||||
|
@ -182,6 +182,9 @@ QSqlQueryPrivate::~QSqlQueryPrivate()
|
|||||||
You can retrieve the values of all the fields in a single variable
|
You can retrieve the values of all the fields in a single variable
|
||||||
(a map) using boundValues().
|
(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
|
\section1 Approaches to Binding Values
|
||||||
|
|
||||||
Below we present the same example using each of the four
|
Below we present the same example using each of the four
|
||||||
|
@ -79,8 +79,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
QFileSystemModel *model = new QFileSystemModel;
|
QFileSystemModel *model = new QFileSystemModel;
|
||||||
QModelIndex parentIndex = model->index(QDir::currentPath());
|
connect(model, &QFileSystemModel::directoryLoaded, [model](const QString &directory) {
|
||||||
int numRows = model->rowCount(parentIndex);
|
QModelIndex parentIndex = model->index(directory);
|
||||||
|
int numRows = model->rowCount(parentIndex);
|
||||||
|
});
|
||||||
|
model->setRootPath(QDir::currentPath);
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
//! [1]
|
//! [1]
|
||||||
|
@ -465,14 +465,19 @@
|
|||||||
Although this does not show a normal way of using a model, it demonstrates
|
Although this does not show a normal way of using a model, it demonstrates
|
||||||
the conventions used by models when dealing with model indexes.
|
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:
|
We construct a file system model in the following way:
|
||||||
|
|
||||||
\snippet simplemodel-use/main.cpp 0
|
\snippet simplemodel-use/main.cpp 0
|
||||||
|
|
||||||
In this case, we set up a default QFileSystemModel, obtain a parent index
|
In this case, we start by setting up a default QFileSystemModel. We connect
|
||||||
using a specific implementation of \l{QFileSystemModel::}{index()}
|
it to a lambda, in which we will obtain a parent index using a specific
|
||||||
provided by that model, and we count the number of rows in the model using
|
implementation of \l{QFileSystemModel::}{index()} provided by that model.
|
||||||
the \l{QFileSystemModel::}{rowCount()} function.
|
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
|
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
|
of the model. We examine each row in turn, obtaining a model index for
|
||||||
|
@ -4312,20 +4312,20 @@ void QDomElement::setAttribute(const QString& name, const QString& value)
|
|||||||
\fn void QDomElement::setAttribute(const QString& name, int value)
|
\fn void QDomElement::setAttribute(const QString& name, int value)
|
||||||
|
|
||||||
\overload
|
\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)
|
\fn void QDomElement::setAttribute(const QString& name, uint value)
|
||||||
|
|
||||||
\overload
|
\overload
|
||||||
The number is formatted according to the current locale.
|
The formatting always uses QLocale::C.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
|
|
||||||
The number is formatted according to the current locale.
|
The formatting always uses QLocale::C.
|
||||||
*/
|
*/
|
||||||
void QDomElement::setAttribute(const QString& name, qlonglong value)
|
void QDomElement::setAttribute(const QString& name, qlonglong value)
|
||||||
{
|
{
|
||||||
@ -4339,7 +4339,7 @@ void QDomElement::setAttribute(const QString& name, qlonglong value)
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
|
|
||||||
The number is formatted according to the current locale.
|
The formatting always uses QLocale::C.
|
||||||
*/
|
*/
|
||||||
void QDomElement::setAttribute(const QString& name, qulonglong value)
|
void QDomElement::setAttribute(const QString& name, qulonglong value)
|
||||||
{
|
{
|
||||||
@ -4353,7 +4353,7 @@ void QDomElement::setAttribute(const QString& name, qulonglong value)
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
|
|
||||||
The number is formatted according to the current locale.
|
The formatting always uses QLocale::C.
|
||||||
*/
|
*/
|
||||||
void QDomElement::setAttribute(const QString& name, float value)
|
void QDomElement::setAttribute(const QString& name, float value)
|
||||||
{
|
{
|
||||||
@ -4367,19 +4367,14 @@ void QDomElement::setAttribute(const QString& name, float value)
|
|||||||
/*!
|
/*!
|
||||||
\overload
|
\overload
|
||||||
|
|
||||||
The number is formatted according to the current locale.
|
The formatting always uses QLocale::C.
|
||||||
*/
|
*/
|
||||||
void QDomElement::setAttribute(const QString& name, double value)
|
void QDomElement::setAttribute(const QString& name, double value)
|
||||||
{
|
{
|
||||||
if (!impl)
|
if (!impl)
|
||||||
return;
|
return;
|
||||||
QString x;
|
QString x;
|
||||||
char buf[256];
|
x.setNum(value);
|
||||||
int count = qsnprintf(buf, sizeof(buf), "%.16g", value);
|
|
||||||
if (count > 0)
|
|
||||||
x = QString::fromLatin1(buf, count);
|
|
||||||
else
|
|
||||||
x.setNum(value); // Fallback
|
|
||||||
IMPL->setAttribute(name, x);
|
IMPL->setAttribute(name, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ void tst_QScopedGuard::exceptions()
|
|||||||
bool caught = false;
|
bool caught = false;
|
||||||
QT_TRY
|
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
|
QT_THROW(std::bad_alloc()); //if Qt compiled without exceptions this is noop
|
||||||
s_globalState = 100;
|
s_globalState = 100;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ private slots:
|
|||||||
void toString_02();
|
void toString_02();
|
||||||
void hasAttributes_data();
|
void hasAttributes_data();
|
||||||
void hasAttributes();
|
void hasAttributes();
|
||||||
|
void setGetAttributes();
|
||||||
void save_data();
|
void save_data();
|
||||||
void save();
|
void save();
|
||||||
void saveWithSerialization() const;
|
void saveWithSerialization() const;
|
||||||
@ -392,6 +393,74 @@ void tst_QDom::hasAttributes()
|
|||||||
QTEST( visitedNodes, "visitedNodes" );
|
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 tst_QDom::hasAttributesHelper( const QDomNode& node )
|
||||||
{
|
{
|
||||||
int visitedNodes = 1;
|
int visitedNodes = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user