Fix some species name issues for encounter table

This commit is contained in:
GriffinR 2024-08-27 15:32:49 -04:00
parent d8d196b79d
commit a7272191f4
2 changed files with 2 additions and 2 deletions

View file

@ -2611,7 +2611,7 @@ bool Project::readSpeciesIconPaths() {
const QMap<QString, QString> iconIncbins = parser.readCIncbinMulti(incfilename); const QMap<QString, QString> iconIncbins = parser.readCIncbinMulti(incfilename);
// Read species constants. If this fails we can get them from the icon table (but we shouldn't rely on it). // Read species constants. If this fails we can get them from the icon table (but we shouldn't rely on it).
const QStringList prefixes = {projectConfig.getIdentifier(ProjectIdentifier::define_species_prefix)}; const QStringList prefixes = {QString("\\b%1").arg(projectConfig.getIdentifier(ProjectIdentifier::define_species_prefix))};
const QString constantsFilename = projectConfig.getFilePath(ProjectFilePath::constants_species); const QString constantsFilename = projectConfig.getFilePath(ProjectFilePath::constants_species);
fileWatcher.addPath(root + "/" + constantsFilename); fileWatcher.addPath(root + "/" + constantsFilename);
QStringList speciesNames = parser.readCDefineNames(constantsFilename, prefixes); QStringList speciesNames = parser.readCDefineNames(constantsFilename, prefixes);

View file

@ -50,7 +50,7 @@ QWidget *SpeciesComboDelegate::createEditor(QWidget *parent, const QStyleOptionV
void SpeciesComboDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { void SpeciesComboDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const {
QString species = index.data(Qt::EditRole).toString(); QString species = index.data(Qt::EditRole).toString();
NoScrollComboBox *combo = static_cast<NoScrollComboBox *>(editor); NoScrollComboBox *combo = static_cast<NoScrollComboBox *>(editor);
combo->setCurrentIndex(combo->findText(species)); combo->setCurrentText(species);
} }
void SpeciesComboDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { void SpeciesComboDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const {