diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-14 17:50:06 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-14 17:50:06 +0200 |
commit | 0b1ae3ce8da9fb3a3b4eaf337d6bf0b7f6aaab1e (patch) | |
tree | c055e2e81878cedd2ed78bf5e182ab9b005be563 /gui | |
parent | 5216e488639fc8420d38c35177b796e1cf56ac8b (diff) | |
download | nextpnr-0b1ae3ce8da9fb3a3b4eaf337d6bf0b7f6aaab1e.tar.gz nextpnr-0b1ae3ce8da9fb3a3b4eaf337d6bf0b7f6aaab1e.tar.bz2 nextpnr-0b1ae3ce8da9fb3a3b4eaf337d6bf0b7f6aaab1e.zip |
use itemSelectionChanged, keyboard selection works
Diffstat (limited to 'gui')
-rw-r--r-- | gui/designwidget.cc | 8 | ||||
-rw-r--r-- | gui/designwidget.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/gui/designwidget.cc b/gui/designwidget.cc index e839f006..9602a4d3 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -160,7 +160,7 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), net // Connection
connect(treeWidget, &QTreeWidget::customContextMenuRequested, this, &DesignWidget::prepareMenu);
- connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), SLOT(onItemClicked(QTreeWidgetItem *, int)));
+ connect(treeWidget, SIGNAL(itemSelectionChanged()), SLOT(onItemSelectionChanged()));
}
DesignWidget::~DesignWidget() {}
@@ -325,8 +325,12 @@ void DesignWidget::clearProperties() idToProperty.clear();
}
-void DesignWidget::onItemClicked(QTreeWidgetItem *clickItem, int pos)
+void DesignWidget::onItemSelectionChanged()
{
+ if (treeWidget->selectedItems().size()== 0) return;
+
+ QTreeWidgetItem *clickItem = treeWidget->selectedItems().at(0);
+
if (!clickItem->parent())
return;
diff --git a/gui/designwidget.h b/gui/designwidget.h index ce0220dd..843fbb72 100644 --- a/gui/designwidget.h +++ b/gui/designwidget.h @@ -46,7 +46,7 @@ class DesignWidget : public QWidget private Q_SLOTS:
void prepareMenu(const QPoint &pos);
- void onItemClicked(QTreeWidgetItem *item, int);
+ void onItemSelectionChanged();
void selectObject();
public Q_SLOTS:
void newContext(Context *ctx);
|