aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/components/connectioneditor/backendmodel.h
blob: c61a94f2e541897b0be008fa49718b684c10d867 (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
// Copyright (C) 2016 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 <QStandardItemModel>

#include "rewriterview.h"

namespace QmlDesigner {

namespace Internal {

class ConnectionView;

class BackendModel : public QStandardItemModel
{
    Q_OBJECT
public:
    enum ColumnRoles {
        TypeNameColumn = 0,
        PropertyNameColumn = 1,
        IsSingletonColumn = 2,
        IsLocalColumn = 3,
    };

    BackendModel(ConnectionView *parent);

    ConnectionView *connectionView() const;

    void resetModel();

    QStringList possibleCppTypes() const;
    QmlTypeData cppTypeDataForType(const QString &typeName) const;

    void deletePropertyByRow(int rowNumber);

    void addNewBackend();

protected:
    void updatePropertyName(int rowNumber);

private:
    void handleDataChanged(const QModelIndex &topLeft, const QModelIndex& bottomRight);

private:
    ConnectionView *m_connectionView;
    bool m_lock = false;
};

} // namespace Internal

} // namespace QmlDesigner