summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-19 01:00:45 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-19 01:00:45 +0200
commit84db112fe2c175a6e0351b5672b87f1425f30c3e (patch)
tree9a15f7f8e6ec03483c6580ae628f916fe4bd0568
parent52484cc4b6696c8a5c1f69125d81eb0cede8cdb2 (diff)
parentff2ba8b9d2798c4b7a77734df723d6312b983f1d (diff)
Merge remote-tracking branch 'origin/5.14' into 5.155.15
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp40
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp2
-rw-r--r--src/gui/painting/qtransform.cpp4
-rw-r--r--src/network/ssl/qsslerror.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm25
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp43
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql_p.h1
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp49
8 files changed, 111 insertions, 55 deletions
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index 675bf4b8c3..978102035e 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -377,6 +377,7 @@ public:
void sort();
bool update_source_sort_column();
+ int find_source_sort_column() const;
void sort_source_rows(QVector<int> &source_rows,
const QModelIndex &source_parent) const;
QVector<QPair<int, QVector<int > > > proxy_intervals_for_source_items_to_add(
@@ -479,11 +480,8 @@ void QSortFilterProxyModelPrivate::_q_clearMapping()
qDeleteAll(source_index_mapping);
source_index_mapping.clear();
- if (dynamic_sortfilter && update_source_sort_column()) {
- //update_source_sort_column might have created wrong mapping so we have to clear it again
- qDeleteAll(source_index_mapping);
- source_index_mapping.clear();
- }
+ if (dynamic_sortfilter)
+ source_sort_column = find_source_sort_column();
// update the persistent indexes
update_persistent_indexes(source_indexes);
@@ -640,6 +638,31 @@ bool QSortFilterProxyModelPrivate::update_source_sort_column()
return old_source_sort_column != source_sort_column;
}
+/*!
+ \internal
+
+ Find the source_sort_column without creating a full mapping and
+ without updating anything.
+*/
+int QSortFilterProxyModelPrivate::find_source_sort_column() const
+{
+ if (proxy_sort_column == -1)
+ return -1;
+
+ const QModelIndex rootIndex;
+ const int source_cols = model->columnCount();
+ int accepted_columns = -1;
+
+ Q_Q(const QSortFilterProxyModel);
+ for (int i = 0; i < source_cols; ++i) {
+ if (q->filterAcceptsColumn(i, rootIndex)) {
+ if (++accepted_columns == proxy_sort_column)
+ return i;
+ }
+ }
+
+ return -1;
+}
/*!
\internal
@@ -1591,11 +1614,8 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersisten
update_persistent_indexes(saved_persistent_indexes);
saved_persistent_indexes.clear();
- if (dynamic_sortfilter && update_source_sort_column()) {
- //update_source_sort_column might have created wrong mapping so we have to clear it again
- qDeleteAll(source_index_mapping);
- source_index_mapping.clear();
- }
+ if (dynamic_sortfilter)
+ source_sort_column = find_source_sort_column();
emit q->layoutChanged(saved_layoutChange_parents);
saved_layoutChange_parents.clear();
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 8c51981120..40c822076b 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1319,7 +1319,7 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
QPaintEngineEx::clip(rect, op);
return;
- } else if (!setClipRectInDeviceCoords(s->matrix.mapRect(rect), op)) {
+ } else if (!setClipRectInDeviceCoords(s->matrix.mapRect(QRectF(rect)).toRect(), op)) {
QPaintEngineEx::clip(rect, op);
return;
}
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 7696da7d45..d75b66c50b 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -1529,12 +1529,12 @@ QRegion QTransform::map(const QRegion &r) const
QRegion res;
if (m11() < 0 || m22() < 0) {
for (const QRect &rect : r)
- res += mapRect(rect);
+ res += mapRect(QRectF(rect)).toRect();
} else {
QVarLengthArray<QRect, 32> rects;
rects.reserve(r.rectCount());
for (const QRect &rect : r) {
- QRect nr = mapRect(rect);
+ QRect nr = mapRect(QRectF(rect)).toRect();
if (!nr.isEmpty())
rects.append(nr);
}
diff --git a/src/network/ssl/qsslerror.h b/src/network/ssl/qsslerror.h
index c4a0d52193..28eb1a9ea8 100644
--- a/src/network/ssl/qsslerror.h
+++ b/src/network/ssl/qsslerror.h
@@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE
class QSslErrorPrivate;
class Q_NETWORK_EXPORT QSslError
{
+ Q_GADGET
public:
enum SslError {
NoError,
@@ -94,6 +95,7 @@ public:
OcspStatusUnknown,
UnspecifiedError = -1
};
+ Q_ENUM(SslError)
// RVCT compiler in debug build does not like about default values in const-
// So as an workaround we define all constructor overloads here explicitly
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index 9daf65abcf..33a45985a8 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -142,28 +142,9 @@ QT_USE_NAMESPACE
- (BOOL)canQuit
{
- bool handle_quit = true;
- NSMenuItem *quitMenuItem = [[QCocoaMenuLoader sharedMenuLoader] quitMenuItem];
- if (!QGuiApplicationPrivate::instance()->modalWindowList.isEmpty()
- && [quitMenuItem isEnabled]) {
- int visible = 0;
- const QWindowList tlws = QGuiApplication::topLevelWindows();
- for (int i = 0; i < tlws.size(); ++i) {
- if (tlws.at(i)->isVisible())
- ++visible;
- }
- handle_quit = (visible <= 1);
- }
-
- if (handle_quit) {
- QCloseEvent ev;
- QGuiApplication::sendEvent(qGuiApp, &ev);
- if (ev.isAccepted()) {
- return YES;
- }
- }
-
- return NO;
+ QCloseEvent ev;
+ QGuiApplication::sendEvent(qGuiApp, &ev);
+ return ev.isAccepted();
}
// This function will only be called when NSApp is actually running.
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index b85a1ac4c7..68313b7ff0 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -1078,8 +1078,10 @@ static QPSQLDriver::Protocol qMakePSQLVersion(int vMaj, int vMin)
return QPSQLDriver::Version10;
case 11:
return QPSQLDriver::Version11;
+ case 12:
+ return QPSQLDriver::Version12;
default:
- if (vMaj > 11)
+ if (vMaj > 12)
return QPSQLDriver::UnknownLaterVersion;
break;
}
@@ -1439,26 +1441,29 @@ QSqlRecord QPSQLDriver::record(const QString &tablename) const
schema = stripDelimiters(schema, QSqlDriver::TableName);
tbl = stripDelimiters(tbl, QSqlDriver::TableName);
- QString stmt = QStringLiteral("SELECT pg_attribute.attname, pg_attribute.atttypid::int, "
- "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
- "pg_attrdef.adsrc "
- "FROM pg_class, pg_attribute "
- "LEFT JOIN pg_attrdef ON (pg_attrdef.adrelid = "
- "pg_attribute.attrelid AND pg_attrdef.adnum = pg_attribute.attnum) "
- "WHERE %1 "
- "AND pg_class.relname = '%2' "
- "AND pg_attribute.attnum > 0 "
- "AND pg_attribute.attrelid = pg_class.oid "
- "AND pg_attribute.attisdropped = false "
- "ORDER BY pg_attribute.attnum");
- if (schema.isEmpty())
- stmt = stmt.arg(QStringLiteral("pg_table_is_visible(pg_class.oid)"));
- else
- stmt = stmt.arg(QStringLiteral("pg_class.relnamespace = (SELECT oid FROM "
- "pg_namespace WHERE pg_namespace.nspname = '%1')").arg(schema));
+ const QString adsrc = protocol() < Version8
+ ? QStringLiteral("pg_attrdef.adsrc")
+ : QStringLiteral("pg_get_expr(pg_attrdef.adbin, pg_attrdef.adrelid)");
+ const QString nspname = schema.isEmpty()
+ ? QStringLiteral("pg_table_is_visible(pg_class.oid)")
+ : QStringLiteral("pg_class.relnamespace = (SELECT oid FROM "
+ "pg_namespace WHERE pg_namespace.nspname = '%1')").arg(schema);
+ const QString stmt =
+ QStringLiteral("SELECT pg_attribute.attname, pg_attribute.atttypid::int, "
+ "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
+ "%1 "
+ "FROM pg_class, pg_attribute "
+ "LEFT JOIN pg_attrdef ON (pg_attrdef.adrelid = "
+ "pg_attribute.attrelid AND pg_attrdef.adnum = pg_attribute.attnum) "
+ "WHERE %2 "
+ "AND pg_class.relname = '%3' "
+ "AND pg_attribute.attnum > 0 "
+ "AND pg_attribute.attrelid = pg_class.oid "
+ "AND pg_attribute.attisdropped = false "
+ "ORDER BY pg_attribute.attnum").arg(adsrc, nspname, tbl);
QSqlQuery query(createResult());
- query.exec(stmt.arg(tbl));
+ query.exec(stmt);
while (query.next()) {
int len = query.value(3).toInt();
int precision = query.value(4).toInt();
diff --git a/src/plugins/sqldrivers/psql/qsql_psql_p.h b/src/plugins/sqldrivers/psql/qsql_psql_p.h
index 99e0b5f60f..9ac1fb50d7 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql_p.h
+++ b/src/plugins/sqldrivers/psql/qsql_psql_p.h
@@ -93,6 +93,7 @@ public:
Version9_6 = 22,
Version10 = 23,
Version11 = 24,
+ Version12 = 25,
UnknownLaterVersion = 100000
};
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index d2a4dfc3e9..6e48439944 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -157,10 +157,10 @@ private slots:
void clippedLines();
void clippedPolygon_data();
void clippedPolygon();
-
void clippedText();
void clipBoundingRect();
+ void transformedClip();
void setOpacity_data();
void setOpacity();
@@ -4589,6 +4589,53 @@ void tst_QPainter::clipBoundingRect()
}
+void tst_QPainter::transformedClip()
+{
+ QImage img(8, 4, QImage::Format_ARGB32_Premultiplied);
+ QImage img2(img.size(), img.format());
+ QRect clip(0, 0, 2, 1);
+ QTransform xf;
+ xf.translate(0.2, 0);
+ xf.scale(2.2, 1);
+ // setClipRect(QRectF)
+ {
+ img.fill(Qt::green);
+ QPainter p(&img);
+ p.setTransform(xf);
+ p.setClipRect(QRectF(clip));
+ p.fillRect(img.rect(), Qt::white);
+ }
+ // setClipRect(QRect)
+ {
+ img2.fill(Qt::green);
+ QPainter p(&img2);
+ p.setTransform(xf);
+ p.setClipRect(clip);
+ p.fillRect(img2.rect(), Qt::white);
+ QCOMPARE(img, img2);
+ }
+ // setClipRegion
+ {
+ img2.fill(Qt::green);
+ QPainter p(&img2);
+ p.setTransform(xf);
+ p.setClipRegion(QRegion(clip) + QRect(0, 3, 1, 1)); // dummy extra rect to avoid single-rect codepath
+ p.fillRect(img2.rect(), Qt::white);
+ QCOMPARE(img.copy(0, 0, 8, 2), img2.copy(0, 0, 8, 2));
+ }
+ // setClipPath
+ {
+ img2.fill(Qt::green);
+ QPainter p(&img2);
+ p.setTransform(xf);
+ QPainterPath path;
+ path.addRect(clip);
+ p.setClipPath(path);
+ p.fillRect(img2.rect(), Qt::white);
+ QCOMPARE(img, img2);
+ }
+}
+
#if defined(Q_OS_MAC)
// Only Mac supports sub pixel positions in raster engine currently
void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()