Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I69f44ea7254cb2643a00b040bbb46f41b7f76a87
This commit is contained in:
commit
84db112fe2
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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();
|
||||
|
@ -93,6 +93,7 @@ public:
|
||||
Version9_6 = 22,
|
||||
Version10 = 23,
|
||||
Version11 = 24,
|
||||
Version12 = 25,
|
||||
UnknownLaterVersion = 100000
|
||||
};
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user