aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.h
blob: 68a46d0d322af2b03dac33575a03399eb28ec990 (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
// Copyright (C) 2020 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 <modelnode.h>
#include <nodeinstanceglobal.h>

#include <QtWidgets/qdialog.h>

namespace QmlDesigner {
namespace Ui {
class ChooseFromPropertyListDialog;
class ChooseFromPropertyListFilter;
}

class ChooseFromPropertyListFilter
{
public:
    ChooseFromPropertyListFilter(const NodeMetaInfo &metaInfo, const NodeMetaInfo &newInfo, bool breakOnFirst = false);
    ~ChooseFromPropertyListFilter() {}
    QStringList propertyList;
};

class ChooseFromPropertyListDialog : public QDialog
{
    Q_OBJECT

public:
    ~ChooseFromPropertyListDialog();

    TypeName selectedProperty() const;
    bool isSoloProperty() const { return m_isSoloProperty; }

    static ChooseFromPropertyListDialog *createIfNeeded(const ModelNode &targetNode,
                                                        const ModelNode &newNode,
                                                        QWidget *parent = 0);
    static ChooseFromPropertyListDialog *createIfNeeded(const ModelNode &targetNode,
                                                        const NodeMetaInfo &propertyType,
                                                        QWidget *parent = 0);

private:
    explicit ChooseFromPropertyListDialog(const QStringList &propNames, QWidget *parent = 0);
    void fillList(const QStringList &propNames);

    Ui::ChooseFromPropertyListDialog *m_ui;
    TypeName m_selectedProperty;
    bool m_isSoloProperty = false;
};
}