From b106fe9502e0a5ae57223a2a152f1d089614c9d7 Mon Sep 17 00:00:00 2001 From: Christophe Date: Thu, 25 May 2023 15:56:06 +0200 Subject: [PATCH] vkconfig: fix profile name invalid init Change-Id: I25493632e09a00aff42baf4c8f6ea33f9a497fea --- vkconfig/widget_setting_filesystem.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/vkconfig/widget_setting_filesystem.cpp b/vkconfig/widget_setting_filesystem.cpp index 0c6d465c7f..1f4c093379 100644 --- a/vkconfig/widget_setting_filesystem.cpp +++ b/vkconfig/widget_setting_filesystem.cpp @@ -103,6 +103,7 @@ void WidgetSettingFilesystem::LoadFile(const std::string& path) { file_setting_data.profile_names = GetProfileNames(path); SettingDataString* enum_setting_data = FindSetting(this->data_set, "profile_name"); + enum_setting_data->value.clear(); if (!file_setting_data.profile_names.empty() && enum_setting_data != nullptr) { enum_setting_data->value = file_setting_data.profile_names[0]; } @@ -135,12 +136,6 @@ void WidgetSettingFilesystem::browseButtonClicked() { if (!file.empty()) { file = ConvertNativeSeparators(file); - LoadFile(file); - - if (VKC_ENV == VKC_ENV_WIN32) { - file = ConvertSeparators(file, "/", GetNativeSeparator()); - } - this->data().value = file; field->setText(this->data().value.c_str()); @@ -151,6 +146,15 @@ void WidgetSettingFilesystem::browseButtonClicked() { void WidgetSettingFilesystem::textFieldChanged(const QString& value) { std::string file = value.toStdString(); + + if (!file.empty()) { + LoadFile(file); + + if (VKC_ENV == VKC_ENV_WIN32) { + file = ConvertSeparators(file, "/", GetNativeSeparator()); + } + } + this->data().value = file; this->field->setToolTip(this->field->text());