aboutsummaryrefslogtreecommitdiffstats
path: root/gui/designwidget.h
diff options
context:
space:
mode:
Diffstat (limited to 'gui/designwidget.h')
-rw-r--r--gui/designwidget.h33
1 files changed, 10 insertions, 23 deletions
diff --git a/gui/designwidget.h b/gui/designwidget.h
index 60291cf3..bbd188cd 100644
--- a/gui/designwidget.h
+++ b/gui/designwidget.h
@@ -20,27 +20,17 @@
#ifndef DESIGNWIDGET_H
#define DESIGNWIDGET_H
-#include <QTreeWidget>
+#include <QTreeView>
#include <QVariant>
#include "nextpnr.h"
#include "qtgroupboxpropertybrowser.h"
#include "qtpropertymanager.h"
#include "qttreepropertybrowser.h"
#include "qtvariantproperty.h"
+#include "treemodel.h"
NEXTPNR_NAMESPACE_BEGIN
-enum class ElementType
-{
- NONE,
- BEL,
- WIRE,
- PIP,
- NET,
- CELL,
- GROUP
-};
-
class DesignWidget : public QWidget
{
Q_OBJECT
@@ -59,9 +49,9 @@ class DesignWidget : public QWidget
ElementType getElementTypeByName(QString type);
int getElementIndex(ElementType type);
void updateButtons();
- void addToHistory(QTreeWidgetItem *item);
+ void addToHistory(QModelIndex item);
std::vector<DecalXY> getDecals(ElementType type, IdString value);
- void updateHighlightGroup(QList<QTreeWidgetItem *> item, int group);
+ void updateHighlightGroup(QList<ContextTreeItem *> item, int group);
Q_SIGNALS:
void info(std::string text);
void selected(std::vector<DecalXY> decal, bool keep);
@@ -70,7 +60,7 @@ class DesignWidget : public QWidget
private Q_SLOTS:
void prepareMenuProperty(const QPoint &pos);
void prepareMenuTree(const QPoint &pos);
- void onItemSelectionChanged();
+ void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
void onItemDoubleClicked(QTreeWidgetItem *item, int column);
public Q_SLOTS:
void newContext(Context *ctx);
@@ -82,8 +72,9 @@ class DesignWidget : public QWidget
private:
Context *ctx;
- QTreeWidget *treeWidget;
-
+ QTreeView *treeView;
+ QItemSelectionModel *selectionModel;
+ ContextTreeModel *treeModel;
QtVariantPropertyManager *variantManager;
QtVariantPropertyManager *readOnlyManager;
QtGroupPropertyManager *groupManager;
@@ -93,14 +84,10 @@ class DesignWidget : public QWidget
QMap<QtProperty *, QString> propertyToId;
QMap<QString, QtProperty *> idToProperty;
- QMap<QString, QTreeWidgetItem *> nameToItem[6];
- std::vector<QTreeWidgetItem *> history;
+ std::vector<QModelIndex> history;
int history_index;
bool history_ignore;
- QTreeWidgetItem *nets_root;
- QTreeWidgetItem *cells_root;
-
QAction *actionFirst;
QAction *actionPrev;
QAction *actionNext;
@@ -108,7 +95,7 @@ class DesignWidget : public QWidget
QAction *actionClear;
QColor highlightColors[8];
- QMap<QTreeWidgetItem *, int> highlightSelected;
+ QMap<ContextTreeItem *, int> highlightSelected;
};
NEXTPNR_NAMESPACE_END