11#include " CustomDataDialog.h"
22#include " ui_CustomDataDialog.h"
33
4+ #include " mission/missionparse.h"
45#include " mission/util.h"
56
67#include < ui/util/SignalBlockers.h>
@@ -104,7 +105,7 @@ void CustomDataDialog::buildView()
104105 auto * hdr = ui->stringsTableView ->horizontalHeader ();
105106 hdr->setSectionsClickable (false ); // no click/press behavior
106107 hdr->setSortIndicatorShown (false ); // hide sort arrow
107- hdr->setHighlightSections (false ); // don’ t change look when selected
108+ hdr->setHighlightSections (false ); // don' t change look when selected
108109 hdr->setSectionsMovable (false ); // no drag-to-reorder columns
109110 hdr->setFocusPolicy (Qt::NoFocus);
110111
@@ -158,8 +159,23 @@ void CustomDataDialog::loadRowIntoEditors(int row)
158159
159160 const auto * keyItem = _tableModel->item (row, ColKey);
160161 const auto * valItem = _tableModel->item (row, ColValue);
161- ui->keyLineEdit ->setText (keyItem ? keyItem->text () : QString ());
162+ const auto key = keyItem ? keyItem->text () : QString ();
163+ ui->keyLineEdit ->setText (key);
162164 ui->valueLineEdit ->setText (valItem ? valItem->text () : QString ());
165+ updateHelpTextForKey (key);
166+ }
167+
168+ void CustomDataDialog::updateHelpTextForKey (const QString& key)
169+ {
170+ auto helpText = tr (" No help text provided" );
171+ for (const auto & entry : Default_custom_data) {
172+ if (key == QString::fromStdString (entry.key )) {
173+ helpText = QString::fromStdString (entry.description );
174+ break ;
175+ }
176+ }
177+
178+ ui->helpTextBrowser ->setPlainText (helpText);
163179}
164180
165181std::pair<SCP_string, SCP_string> CustomDataDialog::editorsToEntry () const
@@ -176,6 +192,7 @@ void CustomDataDialog::clearEditors()
176192
177193 ui->keyLineEdit ->clear ();
178194 ui->valueLineEdit ->clear ();
195+ ui->helpTextBrowser ->setPlainText (" " );
179196}
180197
181198void CustomDataDialog::on_addButton_clicked ()
0 commit comments