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();
|
void sort();
|
||||||
bool update_source_sort_column();
|
bool update_source_sort_column();
|
||||||
|
int find_source_sort_column() const;
|
||||||
void sort_source_rows(QVector<int> &source_rows,
|
void sort_source_rows(QVector<int> &source_rows,
|
||||||
const QModelIndex &source_parent) const;
|
const QModelIndex &source_parent) const;
|
||||||
QVector<QPair<int, QVector<int > > > proxy_intervals_for_source_items_to_add(
|
QVector<QPair<int, QVector<int > > > proxy_intervals_for_source_items_to_add(
|
||||||
@ -479,11 +480,8 @@ void QSortFilterProxyModelPrivate::_q_clearMapping()
|
|||||||
|
|
||||||
qDeleteAll(source_index_mapping);
|
qDeleteAll(source_index_mapping);
|
||||||
source_index_mapping.clear();
|
source_index_mapping.clear();
|
||||||
if (dynamic_sortfilter && update_source_sort_column()) {
|
if (dynamic_sortfilter)
|
||||||
//update_source_sort_column might have created wrong mapping so we have to clear it again
|
source_sort_column = find_source_sort_column();
|
||||||
qDeleteAll(source_index_mapping);
|
|
||||||
source_index_mapping.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the persistent indexes
|
// update the persistent indexes
|
||||||
update_persistent_indexes(source_indexes);
|
update_persistent_indexes(source_indexes);
|
||||||
@ -640,6 +638,31 @@ bool QSortFilterProxyModelPrivate::update_source_sort_column()
|
|||||||
return old_source_sort_column != 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
|
\internal
|
||||||
@ -1591,11 +1614,8 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersisten
|
|||||||
update_persistent_indexes(saved_persistent_indexes);
|
update_persistent_indexes(saved_persistent_indexes);
|
||||||
saved_persistent_indexes.clear();
|
saved_persistent_indexes.clear();
|
||||||
|
|
||||||
if (dynamic_sortfilter && update_source_sort_column()) {
|
if (dynamic_sortfilter)
|
||||||
//update_source_sort_column might have created wrong mapping so we have to clear it again
|
source_sort_column = find_source_sort_column();
|
||||||
qDeleteAll(source_index_mapping);
|
|
||||||
source_index_mapping.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
emit q->layoutChanged(saved_layoutChange_parents);
|
emit q->layoutChanged(saved_layoutChange_parents);
|
||||||
saved_layoutChange_parents.clear();
|
saved_layoutChange_parents.clear();
|
||||||
|
@ -1319,7 +1319,7 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
|
|||||||
QPaintEngineEx::clip(rect, op);
|
QPaintEngineEx::clip(rect, op);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else if (!setClipRectInDeviceCoords(s->matrix.mapRect(rect), op)) {
|
} else if (!setClipRectInDeviceCoords(s->matrix.mapRect(QRectF(rect)).toRect(), op)) {
|
||||||
QPaintEngineEx::clip(rect, op);
|
QPaintEngineEx::clip(rect, op);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1529,12 +1529,12 @@ QRegion QTransform::map(const QRegion &r) const
|
|||||||
QRegion res;
|
QRegion res;
|
||||||
if (m11() < 0 || m22() < 0) {
|
if (m11() < 0 || m22() < 0) {
|
||||||
for (const QRect &rect : r)
|
for (const QRect &rect : r)
|
||||||
res += mapRect(rect);
|
res += mapRect(QRectF(rect)).toRect();
|
||||||
} else {
|
} else {
|
||||||
QVarLengthArray<QRect, 32> rects;
|
QVarLengthArray<QRect, 32> rects;
|
||||||
rects.reserve(r.rectCount());
|
rects.reserve(r.rectCount());
|
||||||
for (const QRect &rect : r) {
|
for (const QRect &rect : r) {
|
||||||
QRect nr = mapRect(rect);
|
QRect nr = mapRect(QRectF(rect)).toRect();
|
||||||
if (!nr.isEmpty())
|
if (!nr.isEmpty())
|
||||||
rects.append(nr);
|
rects.append(nr);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
class QSslErrorPrivate;
|
class QSslErrorPrivate;
|
||||||
class Q_NETWORK_EXPORT QSslError
|
class Q_NETWORK_EXPORT QSslError
|
||||||
{
|
{
|
||||||
|
Q_GADGET
|
||||||
public:
|
public:
|
||||||
enum SslError {
|
enum SslError {
|
||||||
NoError,
|
NoError,
|
||||||
@ -94,6 +95,7 @@ public:
|
|||||||
OcspStatusUnknown,
|
OcspStatusUnknown,
|
||||||
UnspecifiedError = -1
|
UnspecifiedError = -1
|
||||||
};
|
};
|
||||||
|
Q_ENUM(SslError)
|
||||||
|
|
||||||
// RVCT compiler in debug build does not like about default values in const-
|
// RVCT compiler in debug build does not like about default values in const-
|
||||||
// So as an workaround we define all constructor overloads here explicitly
|
// So as an workaround we define all constructor overloads here explicitly
|
||||||
|
@ -142,28 +142,9 @@ QT_USE_NAMESPACE
|
|||||||
|
|
||||||
- (BOOL)canQuit
|
- (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;
|
QCloseEvent ev;
|
||||||
QGuiApplication::sendEvent(qGuiApp, &ev);
|
QGuiApplication::sendEvent(qGuiApp, &ev);
|
||||||
if (ev.isAccepted()) {
|
return ev.isAccepted();
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function will only be called when NSApp is actually running.
|
// 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;
|
return QPSQLDriver::Version10;
|
||||||
case 11:
|
case 11:
|
||||||
return QPSQLDriver::Version11;
|
return QPSQLDriver::Version11;
|
||||||
|
case 12:
|
||||||
|
return QPSQLDriver::Version12;
|
||||||
default:
|
default:
|
||||||
if (vMaj > 11)
|
if (vMaj > 12)
|
||||||
return QPSQLDriver::UnknownLaterVersion;
|
return QPSQLDriver::UnknownLaterVersion;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1439,26 +1441,29 @@ QSqlRecord QPSQLDriver::record(const QString &tablename) const
|
|||||||
schema = stripDelimiters(schema, QSqlDriver::TableName);
|
schema = stripDelimiters(schema, QSqlDriver::TableName);
|
||||||
tbl = stripDelimiters(tbl, QSqlDriver::TableName);
|
tbl = stripDelimiters(tbl, QSqlDriver::TableName);
|
||||||
|
|
||||||
QString stmt = QStringLiteral("SELECT pg_attribute.attname, pg_attribute.atttypid::int, "
|
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, "
|
"pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
|
||||||
"pg_attrdef.adsrc "
|
"%1 "
|
||||||
"FROM pg_class, pg_attribute "
|
"FROM pg_class, pg_attribute "
|
||||||
"LEFT JOIN pg_attrdef ON (pg_attrdef.adrelid = "
|
"LEFT JOIN pg_attrdef ON (pg_attrdef.adrelid = "
|
||||||
"pg_attribute.attrelid AND pg_attrdef.adnum = pg_attribute.attnum) "
|
"pg_attribute.attrelid AND pg_attrdef.adnum = pg_attribute.attnum) "
|
||||||
"WHERE %1 "
|
"WHERE %2 "
|
||||||
"AND pg_class.relname = '%2' "
|
"AND pg_class.relname = '%3' "
|
||||||
"AND pg_attribute.attnum > 0 "
|
"AND pg_attribute.attnum > 0 "
|
||||||
"AND pg_attribute.attrelid = pg_class.oid "
|
"AND pg_attribute.attrelid = pg_class.oid "
|
||||||
"AND pg_attribute.attisdropped = false "
|
"AND pg_attribute.attisdropped = false "
|
||||||
"ORDER BY pg_attribute.attnum");
|
"ORDER BY pg_attribute.attnum").arg(adsrc, nspname, tbl);
|
||||||
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));
|
|
||||||
|
|
||||||
QSqlQuery query(createResult());
|
QSqlQuery query(createResult());
|
||||||
query.exec(stmt.arg(tbl));
|
query.exec(stmt);
|
||||||
while (query.next()) {
|
while (query.next()) {
|
||||||
int len = query.value(3).toInt();
|
int len = query.value(3).toInt();
|
||||||
int precision = query.value(4).toInt();
|
int precision = query.value(4).toInt();
|
||||||
|
@ -93,6 +93,7 @@ public:
|
|||||||
Version9_6 = 22,
|
Version9_6 = 22,
|
||||||
Version10 = 23,
|
Version10 = 23,
|
||||||
Version11 = 24,
|
Version11 = 24,
|
||||||
|
Version12 = 25,
|
||||||
UnknownLaterVersion = 100000
|
UnknownLaterVersion = 100000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -157,10 +157,10 @@ private slots:
|
|||||||
void clippedLines();
|
void clippedLines();
|
||||||
void clippedPolygon_data();
|
void clippedPolygon_data();
|
||||||
void clippedPolygon();
|
void clippedPolygon();
|
||||||
|
|
||||||
void clippedText();
|
void clippedText();
|
||||||
|
|
||||||
void clipBoundingRect();
|
void clipBoundingRect();
|
||||||
|
void transformedClip();
|
||||||
|
|
||||||
void setOpacity_data();
|
void setOpacity_data();
|
||||||
void setOpacity();
|
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)
|
#if defined(Q_OS_MAC)
|
||||||
// Only Mac supports sub pixel positions in raster engine currently
|
// Only Mac supports sub pixel positions in raster engine currently
|
||||||
void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()
|
void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user