aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/components/collectioneditor/collectioneditorutils.h
blob: 46429f04b66d3c573f77e4a1e7c874c30b5ac509 (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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "collectiondetails.h"
#include "collectioneditorconstants.h"

QT_BEGIN_NAMESPACE
class QJsonArray;
QT_END_NAMESPACE

namespace Utils {
class FilePath;
}

namespace QmlDesigner::CollectionEditorUtils {

bool variantIslessThan(const QVariant &a, const QVariant &b, CollectionDetails::DataType type);

CollectionEditorConstants::SourceFormat getSourceCollectionFormat(const QmlDesigner::ModelNode &node);

QString getSourceCollectionType(const QmlDesigner::ModelNode &node);

QString getSourceCollectionPath(const QmlDesigner::ModelNode &dataStoreNode);

Utils::FilePath dataStoreJsonFilePath();

Utils::FilePath dataStoreQmlFilePath();

bool isDataStoreNode(const ModelNode &dataStoreNode);

bool ensureDataStoreExists(bool &justCreated);

bool canAcceptCollectionAsModel(const ModelNode &node);

bool hasTextRoleProperty(const ModelNode &node);

QJsonArray defaultCollectionArray();

QJsonArray loadAsSingleJsonCollection(const QUrl &url);

QJsonArray loadAsCsvCollection(const QUrl &url);

QString getFirstColumnName(const QString &collectionName);

bool collectionHasColumn(const QString &collectionName, const QString &columnName);

} // namespace QmlDesigner::CollectionEditorUtils