add local script labels to event combos for drop down

This commit is contained in:
garak 2022-10-16 18:43:05 -04:00
parent 3f2fea0980
commit 265340eed0
2 changed files with 23 additions and 0 deletions

View file

@ -148,6 +148,10 @@ public:
TriggerFrame(TriggerEvent *trigger, QWidget *parent = nullptr)
: EventFrame(trigger, parent), trigger(trigger) {}
virtual ~TriggerFrame() {
delete this->scriptCompleter;
}
virtual void setup() override;
virtual void initialize() override;
virtual void connectSignals() override;
@ -194,6 +198,10 @@ public:
SignFrame(SignEvent *sign, QWidget *parent = nullptr)
: EventFrame(sign, parent), sign(sign) {}
virtual ~SignFrame() {
delete this->scriptCompleter;
}
virtual void setup() override;
virtual void initialize() override;
virtual void connectSignals() override;

View file

@ -385,6 +385,11 @@ void ObjectFrame::populate(Project *project) {
QStringList scriptLabels = this->object->getMap()->eventScriptLabels() + project->getGlobalScriptLabels();
scriptLabels.removeDuplicates();
if (this->object->getMap()) {
const auto localScriptLabels = this->object->getMap()->eventScriptLabels();
this->combo_script->addItems(localScriptLabels);
}
this->scriptCompleter = new QCompleter(scriptLabels, this);
this->scriptCompleter->setCaseSensitivity(Qt::CaseInsensitive);
this->scriptCompleter->setFilterMode(Qt::MatchContains);
@ -649,6 +654,11 @@ void TriggerFrame::populate(Project *project) {
QStringList scriptLabels = this->trigger->getMap()->eventScriptLabels() + project->getGlobalScriptLabels();
scriptLabels.removeDuplicates();
if (this->trigger->getMap()) {
const auto localScriptLabels = this->trigger->getMap()->eventScriptLabels();
this->combo_script->addItems(localScriptLabels);
}
this->scriptCompleter = new QCompleter(scriptLabels, this);
this->scriptCompleter->setCaseSensitivity(Qt::CaseInsensitive);
this->scriptCompleter->setFilterMode(Qt::MatchContains);
@ -792,6 +802,11 @@ void SignFrame::populate(Project *project) {
QStringList scriptLabels = this->sign->getMap()->eventScriptLabels() + project->getGlobalScriptLabels();
scriptLabels.removeDuplicates();
if (this->sign->getMap()) {
const auto localScriptLabels = this->sign->getMap()->eventScriptLabels();
this->combo_script->addItems(localScriptLabels);
}
this->scriptCompleter = new QCompleter(scriptLabels, this);
this->scriptCompleter->setCaseSensitivity(Qt::CaseInsensitive);
this->scriptCompleter->setFilterMode(Qt::MatchContains);