mimetypebrowser example: Fix building of the hierarchy.
Replace QMimeType::inherits() by a check using the list of parents since only the direct children are needed to build the tree. Change-Id: I041f21c4b94c8a250f7402a6f550f987c64f8fe8 Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
f7cdb0abdb
commit
99490d3e8b
@ -135,8 +135,8 @@ void MimetypeModel::populate()
|
|||||||
// append the items to parent and truncate the list.
|
// append the items to parent and truncate the list.
|
||||||
const QString &parentName = nameIndexIt.key();
|
const QString &parentName = nameIndexIt.key();
|
||||||
const Iterator start =
|
const Iterator start =
|
||||||
std::stable_partition(allTypes.begin(), end,
|
std::stable_partition(allTypes.begin(), end, [parentName](const QMimeType &t)
|
||||||
[parentName](const QMimeType &t) { return !t.inherits(parentName); });
|
{ return !t.parentMimeTypes().contains(parentName); });
|
||||||
std::stable_sort(start, end);
|
std::stable_sort(start, end);
|
||||||
QStandardItem *parentItem = itemFromIndex(nameIndexIt.value());
|
QStandardItem *parentItem = itemFromIndex(nameIndexIt.value());
|
||||||
for (Iterator it = start; it != end; ++it) {
|
for (Iterator it = start; it != end; ++it) {
|
||||||
|
Loading…
Reference in New Issue
Block a user