summaryrefslogtreecommitdiffstats
path: root/src/qtbase-1.cherrypicks.patch
diff options
context:
space:
mode:
authorMark Brand <mabrand@mabrand.nl>2013-03-18 04:13:02 (GMT)
committerMark Brand <mabrand@mabrand.nl>2013-03-18 11:10:22 (GMT)
commitbd3e8121ae1f3583b163bf403851ad47a1e57365 (patch)
treef50adb942425f9f7a784d1b41f942f252adeb944 /src/qtbase-1.cherrypicks.patch
parent2f58aca8be7a9df9e6b426a338f8b6a74ca740a7 (diff)
downloadmxe-bd3e8121ae1f3583b163bf403851ad47a1e57365.zip
mxe-bd3e8121ae1f3583b163bf403851ad47a1e57365.tar.gz
mxe-bd3e8121ae1f3583b163bf403851ad47a1e57365.tar.bz2
package qtbase: cherry-pick upstream sql fixes
Qt 5.0.2 should be out one of these days anyway, but in the meantime it's nice to have these fixed.
Diffstat (limited to 'src/qtbase-1.cherrypicks.patch')
-rw-r--r--src/qtbase-1.cherrypicks.patch264
1 files changed, 248 insertions, 16 deletions
diff --git a/src/qtbase-1.cherrypicks.patch b/src/qtbase-1.cherrypicks.patch
index 0b2d4e8..d2089d3 100644
--- a/src/qtbase-1.cherrypicks.patch
+++ b/src/qtbase-1.cherrypicks.patch
@@ -4,7 +4,7 @@ See index.html for further information.
From 990c4a3ec111502fcb4738a6772e90d294cce2cd Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Fri, 11 Jan 2013 00:30:41 +0100
-Subject: [PATCH 1/8] consolidate generation of metafile install targets
+Subject: [PATCH 01/10] consolidate generation of metafile install targets
Metafiles such as .prl and .pc files contain paths that have to be
adjusted during installation. The same code is used for unix and
@@ -126,13 +126,14 @@ index bda035e..3b2c620 100644
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) \"" + dst_pc + "\"");
--
-1.7.10.4
+1.8.1.4
From 569deb7d1a39e17fb5635411a68d374233f74818 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Sun, 27 Jan 2013 14:03:16 +0100
-Subject: [PATCH 2/8] don't prematurely reduce LIBS when adding sql link lists
+Subject: [PATCH 02/10] don't prematurely reduce LIBS when adding sql link
+ lists
It's possible that different database libraries share dependencies.
We need to keep their link lists intact here so that QtSql's .prl and
@@ -195,13 +196,13 @@ index 3b5a689..38aab2f 100644
QMAKE_CXXFLAGS *= $$QT_CFLAGS_TDS
} else {
--
-1.7.10.4
+1.8.1.4
From a541a0a510b148b684cdb15da4e6a276e3c6ef83 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 29 Jan 2013 21:56:24 +0100
-Subject: [PATCH 3/8] adjust paths in installed module metafiles from modular
+Subject: [PATCH 03/10] adjust paths in installed module metafiles from modular
build
Fully modular prefix build now puts the includes and libs into each
@@ -227,13 +228,13 @@ index 50e9469..3ade5a9 100644
include_replace.replace = $$[QT_INSTALL_HEADERS/raw]
lib_replace.match = $$rplbase/lib
--
-1.7.10.4
+1.8.1.4
From facc35e0c2f6b51ad4cbcdfe79475db155ba52e5 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Fri, 11 Jan 2013 00:30:25 +0100
-Subject: [PATCH 4/8] adjust paths in installed prl files for mingw
+Subject: [PATCH 04/10] adjust paths in installed prl files for mingw
Curiously, qmake could fix .prl and .pc files for unix, but only .pc
files for MinGW. qt_module.prf seems to have known this.
@@ -274,13 +275,13 @@ index 3b2c620..2270a00 100644
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) \"" + dst_prl + "\"");
--
-1.7.10.4
+1.8.1.4
From d6a4dcb0dd88fa6fb4c352d48bf0445341e7de35 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 29 Jan 2013 21:51:31 +0100
-Subject: [PATCH 5/8] fix path adjustments in installed metafiles
+Subject: [PATCH 05/10] fix path adjustments in installed metafiles
Task-number: QTBUG-28902
Change-Id: Ia70da8f0f0b7abb4ea2a46cb4068c0827888b322
@@ -337,13 +338,13 @@ index 32eae0b..b8c920b 100644
+ QMAKE_PRL_INSTALL_REPLACE += lib_replace
+}
--
-1.7.10.4
+1.8.1.4
From e2d6cdad6a36928f1415e3e20f5de4544a14058e Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Thu, 31 Jan 2013 17:24:50 +0100
-Subject: [PATCH 6/8] fix build failures on mingw caused by name clash
+Subject: [PATCH 06/10] fix build failures on mingw caused by name clash
In mingw.org, basetyps.h contains
@@ -378,13 +379,13 @@ index 386078d..c7daf80 100644
QT_BEGIN_NAMESPACE
--
-1.7.10.4
+1.8.1.4
From a3e569cc2483f647b71e8bd35035ebeb662d0549 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 26 Feb 2013 13:23:33 +0100
-Subject: [PATCH 7/8] use pkg-config for freetype
+Subject: [PATCH 07/10] use pkg-config for freetype
Change-Id: Id2f78ed9dbdcacd570eb25982cbd700d0437542a
@@ -401,13 +402,13 @@ index 6b5f6d0..d21f4e3 100644
}
--
-1.7.10.4
+1.8.1.4
From f1943915d6179b39418d1d051e316f2862249fac Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Sat, 22 Dec 2012 17:45:34 +0100
-Subject: [PATCH 8/8] WIP: qmake writeFile(): work around concurrent
+Subject: [PATCH 08/10] WIP: qmake writeFile(): work around concurrent
QDir::mkpath() failure
This actually happened when building qtimageformats with make -j4.
@@ -442,5 +443,236 @@ index bafa867..d8b03f7 100644
QString errStr;
if (!doWriteFile(qfi.filePath(), mode, contents, &errStr)) {
--
-1.7.10.4
+1.8.1.4
+
+
+From 2548db5e688d74fb2180464a2a03b56794fe4e5b Mon Sep 17 00:00:00 2001
+From: Mark Brand <mabrand@mabrand.nl>
+Date: Sat, 26 Jan 2013 23:09:24 +0100
+Subject: [PATCH 09/10] fix QSqlTableModel::headerData() for empty query with
+ inserted row
+
+QSqlQueryModel::headerData() relied on virtual indexInQuery() to
+detect whether the requested column at row 0 mapped to an index in
+the query. This failed when row 0 was a pending insert managed by
+QSqlTableModel, and therefore not in the query.
+
+The only thing that matters here is the column.
+
+Task-number: QTBUG-29108
+Change-Id: I3e0ae85ba223e444781ec8033386d394bb44f0e8
+Reviewed-by: Andy Shaw <andy.shaw@digia.com>
+Reviewed-by: Mark Brand <mabrand@mabrand.nl>
+(cherry picked from commit a694b9f8d204d6555caf4e30dbd18f536859c5bd)
+
+diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp
+index c49a1f2..cefc777 100644
+--- a/src/sql/models/qsqlquerymodel.cpp
++++ b/src/sql/models/qsqlquerymodel.cpp
+@@ -95,6 +95,13 @@ void QSqlQueryModelPrivate::initColOffsets(int size)
+ memset(colOffsets.data(), 0, colOffsets.size() * sizeof(int));
+ }
+
++int QSqlQueryModelPrivate::columnInQuery(int modelColumn) const
++{
++ if (modelColumn < 0 || modelColumn >= rec.count() || !rec.isGenerated(modelColumn) || modelColumn >= colOffsets.size())
++ return -1;
++ return modelColumn - colOffsets[modelColumn];
++}
++
+ /*!
+ \class QSqlQueryModel
+ \brief The QSqlQueryModel class provides a read-only data model for SQL
+@@ -370,11 +377,7 @@ QVariant QSqlQueryModel::headerData(int section, Qt::Orientation orientation, in
+ val = d->headers.value(section).value(Qt::EditRole);
+ if (val.isValid())
+ return val;
+-
+- // See if it's an inserted column (iiq.column() != -1)
+- QModelIndex dItem = indexInQuery(createIndex(0, section));
+-
+- if (role == Qt::DisplayRole && d->rec.count() > section && dItem.column() != -1)
++ if (role == Qt::DisplayRole && d->rec.count() > section && d->columnInQuery(section) != -1)
+ return d->rec.fieldName(section);
+ }
+ return QAbstractItemModel::headerData(section, orientation, role);
+@@ -668,12 +671,10 @@ bool QSqlQueryModel::removeColumns(int column, int count, const QModelIndex &par
+ QModelIndex QSqlQueryModel::indexInQuery(const QModelIndex &item) const
+ {
+ Q_D(const QSqlQueryModel);
+- if (item.column() < 0 || item.column() >= d->rec.count()
+- || !d->rec.isGenerated(item.column())
+- || item.column() >= d->colOffsets.size())
++ int modelColumn = d->columnInQuery(item.column());
++ if (modelColumn < 0)
+ return QModelIndex();
+- return createIndex(item.row(), item.column() - d->colOffsets[item.column()],
+- item.internalPointer());
++ return createIndex(item.row(), modelColumn, item.internalPointer());
+ }
+
+ QT_END_NAMESPACE
+diff --git a/src/sql/models/qsqlquerymodel_p.h b/src/sql/models/qsqlquerymodel_p.h
+index 2e10130..0f2e24e 100644
+--- a/src/sql/models/qsqlquerymodel_p.h
++++ b/src/sql/models/qsqlquerymodel_p.h
+@@ -72,6 +72,7 @@ public:
+
+ void prefetch(int);
+ void initColOffsets(int size);
++ int columnInQuery(int modelColumn) const;
+
+ mutable QSqlQuery query;
+ mutable QSqlError error;
+diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
+index a3341ff..a973281 100644
+--- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
++++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
+@@ -1433,6 +1433,14 @@ void tst_QSqlTableModel::emptyTable()
+ QVERIFY_SQL(model, select());
+ QCOMPARE(model.rowCount(), 0);
+ QCOMPARE(model.columnCount(), 1);
++
++ // QTBUG-29108: check correct horizontal header for empty query with pending insert
++ QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), QString("id"));
++ model.setEditStrategy(QSqlTableModel::OnManualSubmit);
++ model.insertRow(0);
++ QCOMPARE(model.rowCount(), 1);
++ QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), QString("id"));
++ model.revertAll();
+ }
+
+ void tst_QSqlTableModel::tablesAndSchemas()
+--
+1.8.1.4
+
+
+From f8714544492bf37b23e3d52d3a06d3dc38a53840 Mon Sep 17 00:00:00 2001
+From: Mark Brand <mabrand@mabrand.nl>
+Date: Wed, 30 Jan 2013 00:39:53 +0100
+Subject: [PATCH 10/10] QSqlTableModel::setData(): fix non-change detection
+
+Commit 10ff9de91bedf93852f13a58287afd8831644759 introduced the
+optimization of ignoring non-changes, but it overshot the mark.
+It neglected to consider that QVariant's equality operator does not
+compare the null flag. It also failed to consider that setData() has
+a useful side effect of setting the generated flag in a column of a
+pending INSERT. This is important when the application actually wants
+a NULL to be inserted into the column.
+
+Task-number: QTBUG-29217
+Change-Id: I1368f7acc21eebfeb5a8d23746fc38f6f30fd395
+Reviewed-by: Andy Shaw <andy.shaw@digia.com>
+Reviewed-by: Mark Brand <mabrand@mabrand.nl>
+(cherry picked from commit 33c212b7d25726b78c4bf630548a76feaab872f0)
+
+diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
+index 27e1c3e..8569cbc 100644
+--- a/src/sql/models/qsqltablemodel.cpp
++++ b/src/sql/models/qsqltablemodel.cpp
+@@ -587,7 +587,10 @@ bool QSqlTableModel::setData(const QModelIndex &index, const QVariant &value, in
+ if (!(flags(index) & Qt::ItemIsEditable))
+ return false;
+
+- if (QSqlTableModel::data(index, role) == value)
++ const QVariant oldValue = QSqlTableModel::data(index, role);
++ if (value == oldValue
++ && value.isNull() == oldValue.isNull()
++ && d->cache.value(index.row()).op() != QSqlTableModelPrivate::Insert)
+ return true;
+
+ QSqlTableModelPrivate::ModifiedRow &row = d->cache[index.row()];
+diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
+index a973281..9f6f232 100644
+--- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
++++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
+@@ -83,6 +83,8 @@ private slots:
+ void insertColumns();
+ void submitAll_data() { generic_data(); }
+ void submitAll();
++ void setData_data() { generic_data(); }
++ void setData();
+ void setRecord_data() { generic_data(); }
+ void setRecord();
+ void setRecordReimpl_data() { generic_data(); }
+@@ -501,6 +503,77 @@ void tst_QSqlTableModel::insertColumns()
+ QCOMPARE(model.data(model.index(3, 5)), QVariant());
+ }
+
++void tst_QSqlTableModel::setData()
++{
++ QFETCH(QString, dbName);
++ QSqlDatabase db = QSqlDatabase::database(dbName);
++ CHECK_DATABASE(db);
++
++ QSqlTableModel model(0, db);
++ model.setEditStrategy(QSqlTableModel::OnManualSubmit);
++ model.setTable(test);
++ model.setSort(0, Qt::AscendingOrder);
++ QVERIFY_SQL(model, select());
++
++ // initial state
++ QModelIndex idx = model.index(0, 0);
++ QVariant val = model.data(idx);
++ QVERIFY(val == int(1));
++ QVERIFY(!val.isNull());
++ QFAIL_SQL(model, isDirty());
++
++ // change 1 to 0
++ idx = model.index(0, 0);
++ QVERIFY_SQL(model, setData(idx, int(0)));
++ val = model.data(idx);
++ QVERIFY(val == int(0));
++ QVERIFY(!val.isNull());
++ QVERIFY_SQL(model, isDirty(idx));
++ QVERIFY_SQL(model, submitAll());
++
++ // change 0 to NULL
++ idx = model.index(0, 0);
++ QVERIFY_SQL(model, setData(idx, QVariant(QVariant::Int)));
++ val = model.data(idx);
++ QVERIFY(val == QVariant(QVariant::Int));
++ QVERIFY(val.isNull());
++ QVERIFY_SQL(model, isDirty(idx));
++ QVERIFY_SQL(model, submitAll());
++
++ // change NULL to 0
++ idx = model.index(0, 0);
++ QVERIFY_SQL(model, setData(idx, int(0)));
++ val = model.data(idx);
++ QVERIFY(val == int(0));
++ QVERIFY(!val.isNull());
++ QVERIFY_SQL(model, isDirty(idx));
++ QVERIFY_SQL(model, submitAll());
++
++ // ignore unchanged 0 to 0
++ idx = model.index(0, 0);
++ QVERIFY_SQL(model, setData(idx, int(0)));
++ val = model.data(idx);
++ QVERIFY(val == int(0));
++ QVERIFY(!val.isNull());
++ QFAIL_SQL(model, isDirty(idx));
++
++ // pending INSERT
++ QVERIFY_SQL(model, insertRow(0));
++ // initial state
++ idx = model.index(0, 0);
++ QSqlRecord rec = model.record(0);
++ QVERIFY(rec.value(0) == QVariant(QVariant::Int));
++ QVERIFY(rec.isNull(0));
++ QVERIFY(!rec.isGenerated(0));
++ // unchanged value, but causes column to be included in INSERT
++ QVERIFY_SQL(model, setData(idx, QVariant(QVariant::Int)));
++ rec = model.record(0);
++ QVERIFY(rec.value(0) == QVariant(QVariant::Int));
++ QVERIFY(rec.isNull(0));
++ QVERIFY(rec.isGenerated(0));
++ QVERIFY_SQL(model, submitAll());
++}
++
+ void tst_QSqlTableModel::setRecord()
+ {
+ QFETCH(QString, dbName);
+--
+1.8.1.4