diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-08-22 18:37:24 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-08-22 18:37:24 +0200 |
commit | 28e30b2af09a16cc3d58ff8ecd0c742b9be8cf5f (patch) | |
tree | 0a23c90bfbe9ebd636163a4214256dc4cf305d2c /gui/designwidget.cc | |
parent | ad84df7974a82d657938a226da2ceace150cc068 (diff) | |
download | nextpnr-28e30b2af09a16cc3d58ff8ecd0c742b9be8cf5f.tar.gz nextpnr-28e30b2af09a16cc3d58ff8ecd0c742b9be8cf5f.tar.bz2 nextpnr-28e30b2af09a16cc3d58ff8ecd0c742b9be8cf5f.zip |
Added hover on properties as well, fixes #64
Diffstat (limited to 'gui/designwidget.cc')
-rw-r--r-- | gui/designwidget.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gui/designwidget.cc b/gui/designwidget.cc index bd1c6c5a..c49df085 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -69,6 +69,7 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), sel propertyEditor->show();
propertyEditor->treeWidget()->setContextMenuPolicy(Qt::CustomContextMenu);
propertyEditor->treeWidget()->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ propertyEditor->treeWidget()->viewport()->setMouseTracking(true);
searchEdit = new QLineEdit();
searchEdit->setClearButtonEnabled(true);
@@ -177,6 +178,7 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), sel connect(propertyEditor->treeWidget(), &QTreeWidget::customContextMenuRequested, this,
&DesignWidget::prepareMenuProperty);
connect(propertyEditor->treeWidget(), &QTreeWidget::itemDoubleClicked, this, &DesignWidget::onItemDoubleClicked);
+ connect(propertyEditor, &QtTreePropertyBrowser::hoverPropertyChanged, this, &DesignWidget::onHoverPropertyChanged);
connect(treeView, &TreeView::customContextMenuRequested, this, &DesignWidget::prepareMenuTree);
connect(treeView, &TreeView::doubleClicked, this, &DesignWidget::onDoubleClicked);
@@ -832,4 +834,22 @@ void DesignWidget::onHoverIndexChanged(QModelIndex index) Q_EMIT hover(DecalXY());
}
+void DesignWidget::onHoverPropertyChanged(QtBrowserItem *item)
+{
+ if (item!=nullptr) {
+ QtProperty *selectedProperty = item->property();
+ ElementType type = getElementTypeByName(selectedProperty->propertyId());
+ if (type != ElementType::NONE) {
+ IdString value = ctx->id(selectedProperty->valueText().toStdString());
+ if (value!=IdString()) {
+ auto node = treeModel->nodeForIdType(type, value);
+ if (node) {
+ Q_EMIT hover(getDecals((*node)->type(), (*node)->id()).at(0));
+ return;
+ }
+ }
+ }
+ }
+ Q_EMIT hover(DecalXY());
+}
NEXTPNR_NAMESPACE_END
|