Skip to content

Commit d6fcad4

Browse files
committed
Allow going to multiple sheets in ExcelEdit
This is useful especially for the ENpcResident/ENpcBase case. Both sheets are useful to look at, but only one is useful for displaying to the user. Now ENpcResident will be chosen to be in the display field, but you have the option to jump to either sheet!
1 parent 56d522a commit d6fcad4

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

parts/scene/exceledit.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ void ExcelEdit::setReadOnly(bool readOnly)
8686

8787
void ExcelEdit::updateRow()
8888
{
89+
m_lineEdit->clear();
8990
m_menu->clear();
9091

9192
if (!m_readOnly) {
@@ -107,20 +108,24 @@ void ExcelEdit::updateRow()
107108
};
108109

109110
if (const auto display = model->resolveDisplay(m_rowId); !display.isNull()) {
110-
m_lineEdit->setText(QStringLiteral("%1 (%2#%3)").arg(display.toString()).arg(name).arg(m_rowId));
111-
addResolveAction();
112-
return;
113-
}
114-
115-
// As a fallback, check if it exists on the sheet. Handles cases like ENpcBase which technically doesn't have a display field.
116-
if (model->existsOnSheet(m_rowId)) {
117-
m_lineEdit->setText(QStringLiteral("%1#%2").arg(name).arg(m_rowId));
111+
if (m_lineEdit->text().isEmpty()) {
112+
m_lineEdit->setText(QStringLiteral("%1 (%2#%3)").arg(display.toString()).arg(name).arg(m_rowId));
113+
}
118114
addResolveAction();
119-
return;
115+
} else {
116+
// As a fallback, check if it exists on the sheet. Handles cases like ENpcBase which technically doesn't have a display field.
117+
if (model->existsOnSheet(m_rowId)) {
118+
if (m_lineEdit->text().isEmpty()) {
119+
m_lineEdit->setText(QStringLiteral("%1#%2").arg(name).arg(m_rowId));
120+
}
121+
addResolveAction();
122+
}
120123
}
121124
}
122125

123-
m_lineEdit->setText(QStringLiteral("???#%1").arg(m_rowId));
126+
if (m_lineEdit->text().isEmpty()) {
127+
m_lineEdit->setText(QStringLiteral("???#%1").arg(m_rowId));
128+
}
124129
}
125130

126131
#include "moc_exceledit.cpp"

0 commit comments

Comments
 (0)