aboutsummaryrefslogtreecommitdiffstats
path: root/gui/designwidget.h
diff options
context:
space:
mode:
authorMiodrag Milanović <mmicko@gmail.com>2018-07-29 13:08:28 +0000
committerMiodrag Milanović <mmicko@gmail.com>2018-07-29 13:08:28 +0000
commit0fc206ece6aefffba5b4b3e2e6ece9fa94969a4d (patch)
treedacaf7929b048c7f9b0865016f2670cfcdddab7e /gui/designwidget.h
parentf466ad0faf6d5757d1cb3259486bb7604b9064f2 (diff)
parent7c8865d2fc9c2d6b19185627d650448df858fe75 (diff)
downloadnextpnr-0fc206ece6aefffba5b4b3e2e6ece9fa94969a4d.tar.gz
nextpnr-0fc206ece6aefffba5b4b3e2e6ece9fa94969a4d.tar.bz2
nextpnr-0fc206ece6aefffba5b4b3e2e6ece9fa94969a4d.zip
Merge branch 'treemodel' into 'master'
Move all to tree model See merge request SymbioticEDA/nextpnr!23
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