mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 21:06:43 +00:00
Add members in AdvancedPage class to avoid memory leak when the list of cells names is updated as we recreated a completer at each notification event
This commit is contained in:
parent
c3b581131d
commit
2e27de027e
4 changed files with 12 additions and 6 deletions
|
@ -51,6 +51,7 @@
|
||||||
Feature #5524: Resume failed script execution after reload
|
Feature #5524: Resume failed script execution after reload
|
||||||
Feature #5525: Search fields tweaks (utf-8)
|
Feature #5525: Search fields tweaks (utf-8)
|
||||||
Task #5480: Drop Qt4 support
|
Task #5480: Drop Qt4 support
|
||||||
|
Task #5520: Improve cell name autocompleter implementation
|
||||||
|
|
||||||
0.46.0
|
0.46.0
|
||||||
------
|
------
|
||||||
|
|
|
@ -19,15 +19,15 @@ Launcher::AdvancedPage::AdvancedPage(Files::ConfigurationManager &cfg,
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
mCellNameCompleter.setModel(&mCellNameCompleterModel);
|
||||||
|
startDefaultCharacterAtField->setCompleter(&mCellNameCompleter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::AdvancedPage::loadCellsForAutocomplete(QStringList cellNames) {
|
void Launcher::AdvancedPage::loadCellsForAutocomplete(QStringList cellNames) {
|
||||||
// Set up an auto-completer for the "Start default character at" field
|
// Update the list of suggestions for the "Start default character at" field
|
||||||
auto *completer = new QCompleter(cellNames);
|
mCellNameCompleterModel.setStringList(cellNames);
|
||||||
completer->setCompletionMode(QCompleter::PopupCompletion);
|
mCellNameCompleter.setCompletionMode(QCompleter::PopupCompletion);
|
||||||
completer->setCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive);
|
mCellNameCompleter.setCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive);
|
||||||
startDefaultCharacterAtField->setCompleter(completer);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::AdvancedPage::on_skipMenuCheckBox_stateChanged(int state) {
|
void Launcher::AdvancedPage::on_skipMenuCheckBox_stateChanged(int state) {
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define ADVANCEDPAGE_H
|
#define ADVANCEDPAGE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QCompleter>
|
||||||
|
#include <QStringListModel>
|
||||||
|
|
||||||
#include "ui_advancedpage.h"
|
#include "ui_advancedpage.h"
|
||||||
|
|
||||||
|
@ -35,6 +37,8 @@ namespace Launcher
|
||||||
Files::ConfigurationManager &mCfgMgr;
|
Files::ConfigurationManager &mCfgMgr;
|
||||||
Config::GameSettings &mGameSettings;
|
Config::GameSettings &mGameSettings;
|
||||||
Settings::Manager &mEngineSettings;
|
Settings::Manager &mEngineSettings;
|
||||||
|
QCompleter mCellNameCompleter;
|
||||||
|
QStringListModel mCellNameCompleterModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the cells associated with the given content files for use in autocomplete
|
* Load the cells associated with the given content files for use in autocomplete
|
||||||
|
|
|
@ -8,6 +8,7 @@ ContentSelectorView::ComboBox::ComboBox(QWidget *parent) :
|
||||||
{
|
{
|
||||||
mValidator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9_]*$"), this); // Alpha-numeric + underscore
|
mValidator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9_]*$"), this); // Alpha-numeric + underscore
|
||||||
setValidator(mValidator);
|
setValidator(mValidator);
|
||||||
|
setEditable(true);
|
||||||
setCompleter(0);
|
setCompleter(0);
|
||||||
setEnabled (true);
|
setEnabled (true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue