aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/components/assetslibrary/assetslibrarydirsmodel.h
blob: 7939d1ea5b9ea7b374aadd5648ba20ab3fd34f1a (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
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QAbstractListModel>
#include "assetslibrarydir.h"

namespace QmlDesigner {

class AssetsLibraryDirsModel : public QAbstractListModel
{
    Q_OBJECT

public:
    AssetsLibraryDirsModel(QObject *parent = nullptr);

    QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override;
    bool setData(const QModelIndex &index, const QVariant &value, int role) override;
    int rowCount(const QModelIndex & parent = QModelIndex()) const override;
    QHash<int, QByteArray> roleNames() const override;

    void addDir(AssetsLibraryDir *assetsDir);

    const QList<AssetsLibraryDir *> assetsDirs() const;

private:
    QList<AssetsLibraryDir *> m_dirs;
    QHash<int, QByteArray> m_roleNames;
};

} // namespace QmlDesigner