diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-10-19 01:00:45 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-10-19 01:00:45 +0200 |
commit | 84db112fe2c175a6e0351b5672b87f1425f30c3e (patch) | |
tree | 9a15f7f8e6ec03483c6580ae628f916fe4bd0568 /src | |
parent | 52484cc4b6696c8a5c1f69125d81eb0cede8cdb2 (diff) | |
parent | ff2ba8b9d2798c4b7a77734df723d6312b983f1d (diff) |
Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I69f44ea7254cb2643a00b040bbb46f41b7f76a87
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/itemmodels/qsortfilterproxymodel.cpp | 40 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qtransform.cpp | 4 | ||||
-rw-r--r-- | src/network/ssl/qsslerror.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm | 25 | ||||
-rw-r--r-- | src/plugins/sqldrivers/psql/qsql_psql.cpp | 43 | ||||
-rw-r--r-- | src/plugins/sqldrivers/psql/qsql_psql_p.h | 1 |
7 files changed, 63 insertions, 54 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 }; |