aboutsummaryrefslogtreecommitdiffstats
path: root/gui/treemodel.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gui/treemodel.cc')
-rw-r--r--gui/treemodel.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/gui/treemodel.cc b/gui/treemodel.cc
index 59391f02..d42dc401 100644
--- a/gui/treemodel.cc
+++ b/gui/treemodel.cc
@@ -141,6 +141,7 @@ void ContextTreeModel::loadData(Context *ctx)
QMap<QString, ContextTreeItem *> pip_items;
// Add pips to tree
+#ifndef ARCH_ECP5
for (auto pip : ctx->getPips()) {
auto id = ctx->getPipName(pip);
QStringList items = QString(id.c_str(ctx)).split("/");
@@ -164,6 +165,7 @@ void ContextTreeModel::loadData(Context *ctx)
parent = pip_items[name];
}
}
+#endif
pip_root->sort();
nets_root = new ContextTreeItem("Nets");
@@ -326,4 +328,19 @@ Qt::ItemFlags ContextTreeModel::flags(const QModelIndex &index) const
ContextTreeItem *node = nodeFromIndex(index);
return Qt::ItemIsEnabled | (node->type() != ElementType::NONE ? Qt::ItemIsSelectable : Qt::NoItemFlags);
}
-NEXTPNR_NAMESPACE_END \ No newline at end of file
+
+QList<QModelIndex> ContextTreeModel::search(QString text)
+{
+ QList<QModelIndex> list;
+ for (int i = 0; i < 6; i++) {
+ for (auto key : nameToItem[i].keys()) {
+ if (key.contains(text, Qt::CaseInsensitive)) {
+ list.append(indexFromNode(nameToItem[i].value(key)));
+ if (list.count() > 500)
+ break; // limit to 500 results
+ }
+ }
+ }
+ return list;
+}
+NEXTPNR_NAMESPACE_END