Merge "Merge remote-tracking branch 'origin/5.11' into 5.12" into refs/staging/5.12

This commit is contained in:
Liang Qi 2018-08-22 10:31:09 +00:00 committed by The Qt Project
commit 9be1256e0c
11 changed files with 268 additions and 33 deletions

View File

@ -12,6 +12,7 @@ include(../common/msvc-desktop.conf)
# modifications to msvc-desktop.conf # modifications to msvc-desktop.conf
QMAKE_COMPILER += intel_icl QMAKE_COMPILER += intel_icl
DEFINES += _ENABLE_EXTENDED_ALIGNED_STORAGE
QMAKE_CFLAGS_OPTIMIZE_FULL = -O3 QMAKE_CFLAGS_OPTIMIZE_FULL = -O3

View File

@ -471,8 +471,6 @@ void QLoggingCategory::setFilterRules(const QString &rules)
\note Arguments are not processed if debug output for the category is not \note Arguments are not processed if debug output for the category is not
enabled, so do not rely on any side effects. enabled, so do not rely on any side effects.
\note Using the macro is thread-safe.
\sa qDebug() \sa qDebug()
*/ */
@ -493,8 +491,6 @@ void QLoggingCategory::setFilterRules(const QString &rules)
\note Arguments might not be processed if debug output for the category is \note Arguments might not be processed if debug output for the category is
not enabled, so do not rely on any side effects. not enabled, so do not rely on any side effects.
\note Using the macro is thread-safe.
\sa qDebug() \sa qDebug()
*/ */
@ -518,8 +514,6 @@ void QLoggingCategory::setFilterRules(const QString &rules)
\note Arguments are not processed if debug output for the category is not \note Arguments are not processed if debug output for the category is not
enabled, so do not rely on any side effects. enabled, so do not rely on any side effects.
\note Using the macro is thread-safe.
\sa qInfo() \sa qInfo()
*/ */
@ -540,8 +534,6 @@ void QLoggingCategory::setFilterRules(const QString &rules)
\note Arguments might not be processed if debug output for the category is \note Arguments might not be processed if debug output for the category is
not enabled, so do not rely on any side effects. not enabled, so do not rely on any side effects.
\note Using the macro is thread-safe.
\sa qInfo() \sa qInfo()
*/ */
@ -565,8 +557,6 @@ void QLoggingCategory::setFilterRules(const QString &rules)
\note Arguments are not processed if warning output for the category is not \note Arguments are not processed if warning output for the category is not
enabled, so do not rely on any side effects. enabled, so do not rely on any side effects.
\note Using the macro is thread-safe.
\sa qWarning() \sa qWarning()
*/ */
@ -587,8 +577,6 @@ void QLoggingCategory::setFilterRules(const QString &rules)
\note Arguments might not be processed if warning output for the category is \note Arguments might not be processed if warning output for the category is
not enabled, so do not rely on any side effects. not enabled, so do not rely on any side effects.
\note Using the macro is thread-safe.
\sa qWarning() \sa qWarning()
*/ */
@ -612,8 +600,6 @@ void QLoggingCategory::setFilterRules(const QString &rules)
\note Arguments are not processed if critical output for the category is not \note Arguments are not processed if critical output for the category is not
enabled, so do not rely on any side effects. enabled, so do not rely on any side effects.
\note Using the macro is thread-safe.
\sa qCritical() \sa qCritical()
*/ */
@ -634,8 +620,6 @@ void QLoggingCategory::setFilterRules(const QString &rules)
\note Arguments might not be processed if critical output for the category \note Arguments might not be processed if critical output for the category
is not enabled, so do not rely on any side effects. is not enabled, so do not rely on any side effects.
\note Using the macro is thread-safe.
\sa qCritical() \sa qCritical()
*/ */
/*! /*!

View File

@ -2347,7 +2347,7 @@ bool QSortFilterProxyModel::insertRows(int row, int count, const QModelIndex &pa
if (row > m->source_rows.count()) if (row > m->source_rows.count())
return false; return false;
int source_row = (row >= m->source_rows.count() int source_row = (row >= m->source_rows.count()
? m->source_rows.count() ? m->proxy_rows.count()
: m->source_rows.at(row)); : m->source_rows.at(row));
return d->model->insertRows(source_row, count, source_parent); return d->model->insertRows(source_row, count, source_parent);
} }
@ -2367,7 +2367,7 @@ bool QSortFilterProxyModel::insertColumns(int column, int count, const QModelInd
if (column > m->source_columns.count()) if (column > m->source_columns.count())
return false; return false;
int source_column = (column >= m->source_columns.count() int source_column = (column >= m->source_columns.count()
? m->source_columns.count() ? m->proxy_columns.count()
: m->source_columns.at(column)); : m->source_columns.at(column));
return d->model->insertColumns(source_column, count, source_parent); return d->model->insertColumns(source_column, count, source_parent);
} }

View File

@ -490,7 +490,7 @@ Q_OUTOFLINE_TEMPLATE typename QVarLengthArray<T, Prealloc>::iterator QVarLengthA
} }
} else { } else {
T *b = ptr + offset; T *b = ptr + offset;
memmove(b + 1, b, (s - offset) * sizeof(T)); memmove(static_cast<void *>(b + 1), static_cast<const void *>(b), (s - offset) * sizeof(T));
new (b) T(std::move(t)); new (b) T(std::move(t));
} }
s += 1; s += 1;
@ -518,7 +518,7 @@ Q_OUTOFLINE_TEMPLATE typename QVarLengthArray<T, Prealloc>::iterator QVarLengthA
} else { } else {
T *b = ptr + offset; T *b = ptr + offset;
T *i = b + n; T *i = b + n;
memmove(i, b, (s - offset - n) * sizeof(T)); memmove(static_cast<void *>(i), static_cast<const void *>(b), (s - offset - n) * sizeof(T));
while (i != b) while (i != b)
new (--i) T(copy); new (--i) T(copy);
} }
@ -544,7 +544,7 @@ Q_OUTOFLINE_TEMPLATE typename QVarLengthArray<T, Prealloc>::iterator QVarLengthA
i->~T(); i->~T();
} }
} else { } else {
memmove(ptr + f, ptr + l, (s - l) * sizeof(T)); memmove(static_cast<void *>(ptr + f), static_cast<const void *>(ptr + l), (s - l) * sizeof(T));
} }
s -= n; s -= n;
return ptr + f; return ptr + f;

View File

@ -4163,7 +4163,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
const QNativeGestureEvent *ne = static_cast<const QNativeGestureEvent *>(e); const QNativeGestureEvent *ne = static_cast<const QNativeGestureEvent *>(e);
dbg << "QNativeGestureEvent("; dbg << "QNativeGestureEvent(";
QtDebugUtils::formatQEnum(dbg, ne->gestureType()); QtDebugUtils::formatQEnum(dbg, ne->gestureType());
dbg << "localPos="; dbg << ", localPos=";
QtDebugUtils::formatQPoint(dbg, ne->localPos()); QtDebugUtils::formatQPoint(dbg, ne->localPos());
dbg << ", value=" << ne->value() << ')'; dbg << ", value=" << ne->value() << ')';
} }

View File

@ -1043,19 +1043,31 @@ struct QBidiAlgorithm {
} }
} }
bool process() bool checkForBidi() const
{ {
memset(analysis, 0, length * sizeof(QScriptAnalysis)); if (baseLevel != 0)
return true;
bool hasBidi = (baseLevel != 0);
if (!hasBidi) {
for (int i = 0; i < length; ++i) { for (int i = 0; i < length; ++i) {
if (text[i].unicode() >= 0x590) { if (text[i].unicode() >= 0x590) {
hasBidi = true; switch (text[i].direction()) {
case QChar::DirR: case QChar::DirAN:
case QChar::DirLRE: case QChar::DirLRO: case QChar::DirAL:
case QChar::DirRLE: case QChar::DirRLO: case QChar::DirPDF:
case QChar::DirLRI: case QChar::DirRLI: case QChar::DirFSI: case QChar::DirPDI:
return true;
default:
break; break;
} }
} }
} }
return false;
}
bool process()
{
memset(analysis, 0, length * sizeof(QScriptAnalysis));
bool hasBidi = checkForBidi();
if (!hasBidi) if (!hasBidi)
return false; return false;
@ -2071,7 +2083,6 @@ void QTextEngine::itemize() const
case QChar::Nbsp: case QChar::Nbsp:
if (option.flags() & QTextOption::ShowTabsAndSpaces) { if (option.flags() & QTextOption::ShowTabsAndSpaces) {
analysis->flags = (*uc == QChar::Space) ? QScriptAnalysis::Space : QScriptAnalysis::Nbsp; analysis->flags = (*uc == QChar::Space) ? QScriptAnalysis::Space : QScriptAnalysis::Nbsp;
analysis->bidiLevel = bidi.baseLevel;
break; break;
} }
Q_FALLTHROUGH(); Q_FALLTHROUGH();

View File

@ -180,7 +180,7 @@ long roleToControlTypeId(QAccessible::Role role)
{QAccessible::PropertyPage, UIA_CustomControlTypeId}, {QAccessible::PropertyPage, UIA_CustomControlTypeId},
{QAccessible::Indicator, UIA_CustomControlTypeId}, {QAccessible::Indicator, UIA_CustomControlTypeId},
{QAccessible::Graphic, UIA_ImageControlTypeId}, {QAccessible::Graphic, UIA_ImageControlTypeId},
{QAccessible::StaticText, UIA_EditControlTypeId}, {QAccessible::StaticText, UIA_TextControlTypeId},
{QAccessible::EditableText, UIA_EditControlTypeId}, {QAccessible::EditableText, UIA_EditControlTypeId},
{QAccessible::Button, UIA_ButtonControlTypeId}, {QAccessible::Button, UIA_ButtonControlTypeId},
{QAccessible::CheckBox, UIA_CheckBoxControlTypeId}, {QAccessible::CheckBox, UIA_CheckBoxControlTypeId},

View File

@ -8,6 +8,7 @@
"Description": "An instrumentation framework for building dynamic analysis tools.", "Description": "An instrumentation framework for building dynamic analysis tools.",
"Homepage": "http://valgrind.org/", "Homepage": "http://valgrind.org/",
"Version": "3.3.0",
"License": "BSD 4-clause \"Original\" or \"Old\" License", "License": "BSD 4-clause \"Original\" or \"Old\" License",
"LicenseId": "BSD-4-Clause", "LicenseId": "BSD-4-Clause",
"LicenseFile": "VALGRIND_LICENSE.txt", "LicenseFile": "VALGRIND_LICENSE.txt",
@ -36,6 +37,8 @@ Copyright (c) 2003, 2006 Massachusetts Institute of Technology"
"Files": "linux_perf_event_p.h", "Files": "linux_perf_event_p.h",
"Description": "Allows access to the Linux kernel's performance events.", "Description": "Allows access to the Linux kernel's performance events.",
"Homepage": "https://www.kernel.org",
"Version": "3.7",
"License": "GNU General Public License v2.0 only with Linux Syscall Note", "License": "GNU General Public License v2.0 only with Linux Syscall Note",
"LicenseId": "GPL-2.0 WITH Linux-syscall-note", "LicenseId": "GPL-2.0 WITH Linux-syscall-note",
"LicenseFile": "LINUX_LICENSE.txt", "LicenseFile": "LINUX_LICENSE.txt",

View File

@ -4662,4 +4662,236 @@ void tst_QSortFilterProxyModel::checkSetNewModel()
QCoreApplication::processEvents(); QCoreApplication::processEvents();
} }
enum ColumnFilterMode {
FilterNothing,
FilterOutMiddle,
FilterOutBeginEnd,
FilterAll
};
Q_DECLARE_METATYPE(ColumnFilterMode)
void tst_QSortFilterProxyModel::filterAndInsertColumn_data()
{
QTest::addColumn<int>("insertCol");
QTest::addColumn<ColumnFilterMode>("filterMode");
QTest::addColumn<QStringList>("expectedModelList");
QTest::addColumn<QStringList>("expectedProxyModelList");
QTest::newRow("at_beginning_filter_out_middle")
<< 0
<< FilterOutMiddle
<< QStringList{{"", "A1", "B1", "C1", "D1"}}
<< QStringList{{"", "D1"}}
;
QTest::newRow("at_end_filter_out_middle")
<< 2
<< FilterOutMiddle
<< QStringList{{"A1", "B1", "C1", "D1", ""}}
<< QStringList{{"A1", ""}}
;
QTest::newRow("in_the_middle_filter_out_middle")
<< 1
<< FilterOutMiddle
<< QStringList{{"A1", "B1", "C1", "", "D1"}}
<< QStringList{{"A1", "D1"}}
;
QTest::newRow("at_beginning_filter_out_begin_and_end")
<< 0
<< FilterOutBeginEnd
<< QStringList{{"A1", "", "B1", "C1", "D1"}}
<< QStringList{{"", "B1", "C1"}}
;
QTest::newRow("at_end_filter_out_begin_and_end")
<< 2
<< FilterOutBeginEnd
<< QStringList{{"A1", "B1", "C1", "D1", ""}}
<< QStringList{{"B1", "C1", "D1"}}
;
QTest::newRow("in_the_middle_filter_out_begin_and_end")
<< 1
<< FilterOutBeginEnd
<< QStringList{{"A1", "B1", "", "C1", "D1"}}
<< QStringList{{"B1", "", "C1"}}
;
QTest::newRow("at_beginning_filter_nothing")
<< 0
<< FilterAll
<< QStringList{{"", "A1", "B1", "C1", "D1"}}
<< QStringList{{"", "A1", "B1", "C1", "D1"}}
;
QTest::newRow("at_end_filter_nothing")
<< 4
<< FilterAll
<< QStringList{{"A1", "B1", "C1", "D1", ""}}
<< QStringList{{"A1", "B1", "C1", "D1", ""}}
;
QTest::newRow("in_the_middle_nothing")
<< 2
<< FilterAll
<< QStringList{{"A1", "B1", "", "C1", "D1"}}
<< QStringList{{"A1", "B1", "", "C1", "D1"}}
;
QTest::newRow("filter_all")
<< 0
<< FilterNothing
<< QStringList{{"A1", "B1", "C1", "D1", ""}}
<< QStringList{}
;
}
void tst_QSortFilterProxyModel::filterAndInsertColumn()
{
class ColumnFilterProxy : public QSortFilterProxyModel {
Q_DISABLE_COPY(ColumnFilterProxy)
ColumnFilterMode filerMode;
public:
ColumnFilterProxy(ColumnFilterMode mode)
: filerMode(mode)
{}
bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const override
{
Q_UNUSED(source_parent)
switch (filerMode){
case FilterAll:
return true;
case FilterNothing:
return false;
case FilterOutMiddle:
return source_column == 0 || source_column == sourceModel()->columnCount() - 1;
case FilterOutBeginEnd:
return source_column > 0 && source_column< sourceModel()->columnCount() - 1;
}
Q_UNREACHABLE();
}
};
QFETCH(int, insertCol);
QFETCH(ColumnFilterMode, filterMode);
QFETCH(QStringList, expectedModelList);
QFETCH(QStringList, expectedProxyModelList);
QStandardItemModel model;
model.insertColumns(0, 4);
model.insertRows(0, 1);
for (int i = 0; i < model.rowCount(); ++i) {
for (int j = 0; j < model.columnCount(); ++j)
model.setData(model.index(i, j), QString('A' + j) + QString::number(i + 1));
}
ColumnFilterProxy proxy(filterMode);
proxy.setSourceModel(&model);
QVERIFY(proxy.insertColumn(insertCol));
proxy.invalidate();
QStringList modelStringList;
for (int i = 0; i < model.rowCount(); ++i) {
for (int j = 0; j < model.columnCount(); ++j)
modelStringList.append(model.index(i, j).data().toString());
}
QCOMPARE(expectedModelList, modelStringList);
modelStringList.clear();
for (int i = 0; i < proxy.rowCount(); ++i) {
for (int j = 0; j < proxy.columnCount(); ++j)
modelStringList.append(proxy.index(i, j).data().toString());
}
QCOMPARE(expectedProxyModelList, modelStringList);
}
void tst_QSortFilterProxyModel::filterAndInsertRow_data()
{
QTest::addColumn<QStringList>("initialModelList");
QTest::addColumn<int>("row");
QTest::addColumn<QString>("filterRegExp");
QTest::addColumn<QStringList>("expectedModelList");
QTest::addColumn<QStringList>("expectedProxyModelList");
QTest::newRow("at_beginning_filter_out_middle")
<< QStringList{{"A5", "B5", "B6", "A7"}}
<< 0
<< "^A"
<< QStringList{{"", "A5", "B5", "B6", "A7"}}
<< QStringList{{"A5", "A7"}};
QTest::newRow("at_end_filter_out_middle")
<< QStringList{{"A5", "B5", "B6", "A7"}}
<< 2
<< "^A"
<< QStringList{{"A5", "B5", "B6", "A7", ""}}
<< QStringList{{"A5", "A7"}};
QTest::newRow("in_the_middle_filter_out_middle")
<< QStringList{{"A5", "B5", "B6", "A7"}}
<< 1
<< "^A"
<< QStringList{{"A5", "B5", "B6", "", "A7"}}
<< QStringList{{"A5", "A7"}};
QTest::newRow("at_beginning_filter_out_first_and_last")
<< QStringList{{"A5", "B5", "B6", "A7"}}
<< 0
<< "^B"
<< QStringList{{"A5", "", "B5", "B6", "A7"}}
<< QStringList{{"B5", "B6"}};
QTest::newRow("at_end_filter_out_first_and_last")
<< QStringList{{"A5", "B5", "B6", "A7"}}
<< 2
<< "^B"
<< QStringList{{"A5", "B5", "B6", "A7", ""}}
<< QStringList{{"B5", "B6"}};
QTest::newRow("in_the_middle_filter_out_first_and_last")
<< QStringList{{"A5", "B5", "B6", "A7"}}
<< 1
<< "^B"
<< QStringList{{"A5", "B5", "", "B6", "A7"}}
<< QStringList{{"B5", "B6"}};
QTest::newRow("at_beginning_no_filter")
<< QStringList{{"A5", "B5", "B6", "A7"}}
<< 0
<< ".*"
<< QStringList{{"", "A5", "B5", "B6", "A7"}}
<< QStringList{{"", "A5", "B5", "B6", "A7"}};
QTest::newRow("at_end_no_filter")
<< QStringList{{"A5", "B5", "B6", "A7"}}
<< 4
<< ".*"
<< QStringList{{"A5", "B5", "B6", "A7", ""}}
<< QStringList{{"A5", "B5", "B6", "A7", ""}};
QTest::newRow("in_the_middle_no_filter")
<< QStringList{{"A5", "B5", "B6", "A7"}}
<< 2
<< ".*"
<< QStringList{{"A5", "B5", "", "B6", "A7"}}
<< QStringList{{"A5", "B5", "", "B6", "A7"}};
QTest::newRow("filter_all")
<< QStringList{{"A5", "B5", "B6", "A7"}}
<< 0
<< "$a"
<< QStringList{{"A5", "B5", "B6", "A7", ""}}
<< QStringList{};
}
void tst_QSortFilterProxyModel::filterAndInsertRow()
{
QFETCH(QStringList, initialModelList);
QFETCH(int, row);
QFETCH(QString, filterRegExp);
QFETCH(QStringList, expectedModelList);
QFETCH(QStringList, expectedProxyModelList);
QStringListModel model;
QSortFilterProxyModel proxyModel;
model.setStringList(initialModelList);
proxyModel.setSourceModel(&model);
proxyModel.setDynamicSortFilter(true);
proxyModel.setFilterRegExp(filterRegExp);
QVERIFY(proxyModel.insertRow(row));
QCOMPARE(model.stringList(), expectedModelList);
QCOMPARE(proxyModel.rowCount(), expectedProxyModelList.count());
for (int r = 0; r < proxyModel.rowCount(); ++r) {
QModelIndex index = proxyModel.index(r, 0);
QVERIFY(index.isValid());
QCOMPARE(proxyModel.data(index).toString(), expectedProxyModelList.at(r));
}
}
#include "tst_qsortfilterproxymodel.moc" #include "tst_qsortfilterproxymodel.moc"

View File

@ -161,6 +161,10 @@ private slots:
void emitLayoutChangedOnlyIfSortingChanged(); void emitLayoutChangedOnlyIfSortingChanged();
void checkSetNewModel(); void checkSetNewModel();
void filterAndInsertRow_data();
void filterAndInsertRow();
void filterAndInsertColumn_data();
void filterAndInsertColumn();
void removeIntervals_data(); void removeIntervals_data();
void removeIntervals(); void removeIntervals();

View File

@ -3882,7 +3882,7 @@ void tst_QAccessibility::bridgeTest()
// Label // Label
hr = nodeList.at(4)->get_CurrentControlType(&controlTypeId); hr = nodeList.at(4)->get_CurrentControlType(&controlTypeId);
QVERIFY(SUCCEEDED(hr)); QVERIFY(SUCCEEDED(hr));
QCOMPARE(controlTypeId, UIA_EditControlTypeId); QCOMPARE(controlTypeId, UIA_TextControlTypeId);
for (auto nd : nodeList) { for (auto nd : nodeList) {
nd->Release(); nd->Release();