From c99fbde0eb0b1b9b725ba2fead13d3210ce961a7 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Thu, 4 Feb 2021 14:47:45 -0800 Subject: Mark IdString and IdStringList single argument constructors explicit. Single argument constructors will silently convert to that type. This is typically not the right thing to do. For example, the nexus and ice40 arch_pybindings.h files were incorrectly parsing bel name strings, etc. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- gui/designwidget.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gui/designwidget.cc') diff --git a/gui/designwidget.cc b/gui/designwidget.cc index a5dc7e3e..5c3584d9 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -911,7 +911,7 @@ void DesignWidget::prepareMenuProperty(const QPoint &pos) ElementType type = getElementTypeByName(selectedProperty->propertyId()); if (type == ElementType::NONE) continue; - IdString value = ctx->id(selectedProperty->valueText().toStdString()); + IdStringList value = IdStringList::parse(ctx, selectedProperty->valueText().toStdString()); auto node = getTreeByElementType(type)->nodeForId(value); if (!node) continue; @@ -996,7 +996,9 @@ void DesignWidget::onItemDoubleClicked(QTreeWidgetItem *item, int column) ElementType type = getElementTypeByName(selectedProperty->propertyId()); if (type == ElementType::NONE) return; - auto it = getTreeByElementType(type)->nodeForId(ctx->id(selectedProperty->valueText().toStdString())); + + IdStringList value = IdStringList::parse(ctx, selectedProperty->valueText().toStdString()); + auto it = getTreeByElementType(type)->nodeForId(value); if (it) { int num = getIndexByElementType(type); clearAllSelectionModels(); @@ -1049,8 +1051,8 @@ void DesignWidget::onHoverPropertyChanged(QtBrowserItem *item) QtProperty *selectedProperty = item->property(); ElementType type = getElementTypeByName(selectedProperty->propertyId()); if (type != ElementType::NONE) { - IdString value = ctx->id(selectedProperty->valueText().toStdString()); - if (value != IdString()) { + IdStringList value = IdStringList::parse(ctx, selectedProperty->valueText().toStdString()); + if (value != IdStringList()) { auto node = getTreeByElementType(type)->nodeForId(value); if (node) { std::vector decals = getDecals((*node)->type(), (*node)->id()); -- cgit v1.2.3