aboutsummaryrefslogtreecommitdiffstats
path: root/gui/designwidget.h
blob: e3f7e6226317040252e3a4d632e91972258ae912 (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
#ifndef DESIGNWIDGET_H
#define DESIGNWIDGET_H

#include <QTreeWidget>
#include "nextpnr.h"
#include "qtpropertymanager.h"
#include "qttreepropertybrowser.h"
#include "qtvariantproperty.h"

// FIXME
USING_NEXTPNR_NAMESPACE

class DesignWidget : public QWidget
{
    Q_OBJECT

  public:
    explicit DesignWidget(Design *design, QWidget *parent = 0);
    ~DesignWidget();
    Design *getDesign() { return design; }

  private:
    void addProperty(QtVariantProperty *property, const QString &id);
    void clearProperties();

  Q_SIGNALS:
    void info(std::string text);

  private Q_SLOTS:
    void prepareMenu(const QPoint &pos);
    void onItemClicked(QTreeWidgetItem *item, int);
    void selectObject();

  private:
    Design *design;

    QTreeWidget *treeWidget;

    QtVariantPropertyManager *variantManager;
    QtVariantEditorFactory *variantFactory;
    QtTreePropertyBrowser *propertyEditor;
    QTreeWidgetItem *itemContextMenu;

    QMap<QtProperty *, QString> propertyToId;
    QMap<QString, QtVariantProperty *> idToProperty;
};

#endif // DESIGNWIDGET_H