blob: de6c59d0dbd74f61ccf802ff70fa0d3443f6a62e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "contentlibrarymaterialscategory.h"
#include "contentlibrarymaterial.h"
namespace QmlDesigner {
ContentLibraryMaterialsCategory::ContentLibraryMaterialsCategory(QObject *parent, const QString &name)
: QObject(parent), m_name(name) {}
void ContentLibraryMaterialsCategory::addBundleMaterial(ContentLibraryMaterial *bundleMat)
{
m_categoryMaterials.append(bundleMat);
}
bool ContentLibraryMaterialsCategory::updateImportedState(const QStringList &importedMats)
{
bool changed = false;
for (ContentLibraryMaterial *mat : std::as_const(m_categoryMaterials))
changed |= mat->setImported(importedMats.contains(mat->qml().chopped(4)));
return changed;
}
bool ContentLibraryMaterialsCategory::filter(const QString &searchText)
{
bool visible = false;
for (ContentLibraryMaterial *mat : std::as_const(m_categoryMaterials))
visible |= mat->filter(searchText);
if (visible != m_visible) {
m_visible = visible;
emit categoryVisibleChanged();
return true;
}
return false;
}
QString ContentLibraryMaterialsCategory::name() const
{
return m_name;
}
bool ContentLibraryMaterialsCategory::visible() const
{
return m_visible;
}
bool ContentLibraryMaterialsCategory::expanded() const
{
return m_expanded;
}
QList<ContentLibraryMaterial *> ContentLibraryMaterialsCategory::categoryMaterials() const
{
return m_categoryMaterials;
}
} // namespace QmlDesigner
|