aboutsummaryrefslogtreecommitdiffstats
path: root/gui/designwidget.h
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-08-22 17:38:42 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-08-22 17:38:42 +0200
commitad84df7974a82d657938a226da2ceace150cc068 (patch)
treeae1dba96b357c17bb5e42fdb1d674f83aa625a10 /gui/designwidget.h
parent4cc49ef6e3d01dba409188cc7d2c86f5bbb43391 (diff)
downloadnextpnr-ad84df7974a82d657938a226da2ceace150cc068.tar.gz
nextpnr-ad84df7974a82d657938a226da2ceace150cc068.tar.bz2
nextpnr-ad84df7974a82d657938a226da2ceace150cc068.zip
Hover on items in tree
Diffstat (limited to 'gui/designwidget.h')
-rw-r--r--gui/designwidget.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/gui/designwidget.h b/gui/designwidget.h
index c78d7232..37791aa1 100644
--- a/gui/designwidget.h
+++ b/gui/designwidget.h
@@ -22,6 +22,7 @@
#include <QTreeView>
#include <QVariant>
+#include <QMouseEvent>
#include "nextpnr.h"
#include "qtgroupboxpropertybrowser.h"
#include "qtpropertymanager.h"
@@ -31,6 +32,22 @@
NEXTPNR_NAMESPACE_BEGIN
+class TreeView : public QTreeView
+{
+ Q_OBJECT
+
+ public:
+ explicit TreeView(QWidget *parent = 0);
+ ~TreeView();
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void leaveEvent(QEvent *event) override;
+
+ Q_SIGNALS:
+ void hoverIndexChanged(QModelIndex index);
+ private:
+ QModelIndex current;
+};
+
class DesignWidget : public QWidget
{
Q_OBJECT
@@ -55,6 +72,7 @@ class DesignWidget : public QWidget
Q_SIGNALS:
void selected(std::vector<DecalXY> decal, bool keep);
void highlight(std::vector<DecalXY> decal, int group);
+ void hover(DecalXY decal);
void zoomSelected();
private Q_SLOTS:
@@ -64,6 +82,7 @@ class DesignWidget : public QWidget
void onItemDoubleClicked(QTreeWidgetItem *item, int column);
void onDoubleClicked(const QModelIndex &index);
void onSearchInserted();
+ void onHoverIndexChanged(QModelIndex index);
public Q_SLOTS:
void newContext(Context *ctx);
void updateTree();
@@ -74,7 +93,7 @@ class DesignWidget : public QWidget
private:
Context *ctx;
- QTreeView *treeView;
+ TreeView *treeView;
QItemSelectionModel *selectionModel;
TreeModel::Model *treeModel;
QLineEdit *searchEdit;