diff --git a/include/ui/eventframes.h b/include/ui/eventframes.h index e55e3dca..181ac141 100644 --- a/include/ui/eventframes.h +++ b/include/ui/eventframes.h @@ -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; diff --git a/src/ui/eventframes.cpp b/src/ui/eventframes.cpp index fe0b2bcd..f8b0eacc 100644 --- a/src/ui/eventframes.cpp +++ b/src/ui/eventframes.cpp @@ -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);