diff --git a/openbr/openbr_plugin.cpp b/openbr/openbr_plugin.cpp index 9322f5d..8860734 100644 --- a/openbr/openbr_plugin.cpp +++ b/openbr/openbr_plugin.cpp @@ -476,13 +476,18 @@ TemplateList TemplateList::fromGallery(const br::File &gallery) // indexes some property, assigns an integer id to each unique value of propName // stores the index values in "Label" of the output template list -TemplateList TemplateList::relabel(const TemplateList &tl, const QString & propName) +TemplateList TemplateList::relabel(const TemplateList &tl, const QString &propName) { const QList originalLabels = File::get(tl, propName); QHash labelTable; - foreach (const QString & label, originalLabels) - if (!labelTable.contains(label)) - labelTable.insert(label, labelTable.size()); + foreach (const QString &label, originalLabels) + if (!labelTable.contains(label)) { + int value; bool ok; + value = label.toInt(&ok); + // If the label is already an integer value we don't want to change it. + if (ok) labelTable.insert(label, value); + else labelTable.insert(label, labelTable.size()); + } TemplateList result = tl; for (int i=0; i