fix using tostring instead of typeid
This commit is contained in:
parent
87ebcb1066
commit
6052279fdb
|
|
@ -505,7 +505,7 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
|
||||||
RequestType request, float multiplier,
|
RequestType request, float multiplier,
|
||||||
Settings::BasicSetting* other_setting, const QString& suffix) {
|
Settings::BasicSetting* other_setting, const QString& suffix) {
|
||||||
created = true;
|
created = true;
|
||||||
const auto type = setting.TypeId();
|
const auto type_id = setting.TypeId();
|
||||||
|
|
||||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
@ -514,9 +514,7 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
|
||||||
other_setting = setting.PairedSetting();
|
other_setting = setting.PairedSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool require_checkbox =
|
const bool require_checkbox = other_setting != nullptr && other_setting->TypeId() == "bool";
|
||||||
other_setting != nullptr && other_setting->ToString() == "bool";
|
|
||||||
|
|
||||||
if (other_setting != nullptr && other_setting->TypeId() != "bool") {
|
if (other_setting != nullptr && other_setting->TypeId() != "bool") {
|
||||||
LOG_WARNING(
|
LOG_WARNING(
|
||||||
Frontend,
|
Frontend,
|
||||||
|
|
@ -572,16 +570,27 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
|
||||||
}
|
}
|
||||||
|
|
||||||
if (require_checkbox) {
|
if (require_checkbox) {
|
||||||
QWidget* lhs =
|
QWidget* lhs = CreateCheckBox(other_setting, label, checkbox_serializer, checkbox_restore_func, touch);
|
||||||
CreateCheckBox(other_setting, label, checkbox_serializer, checkbox_restore_func, touch);
|
|
||||||
layout->addWidget(lhs, 1);
|
layout->addWidget(lhs, 1);
|
||||||
} else if (setting.TypeId() != "bool") {
|
} else if (type_id != "bool") {
|
||||||
QLabel* qt_label = CreateLabel(label);
|
QLabel* qt_label = CreateLabel(label);
|
||||||
layout->addWidget(qt_label, 1);
|
layout->addWidget(qt_label, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting.TypeId() == "bool") {
|
if (type_id == "bool") {
|
||||||
data_component = CreateCheckBox(&setting, label, serializer, restore_func, touch);
|
data_component = CreateCheckBox(&setting, label, serializer, restore_func, touch);
|
||||||
|
} else if (type_id == "string") {
|
||||||
|
switch (request) {
|
||||||
|
case RequestType::Default:
|
||||||
|
case RequestType::LineEdit:
|
||||||
|
data_component = CreateLineEdit(serializer, restore_func, touch);
|
||||||
|
break;
|
||||||
|
case RequestType::ComboBox:
|
||||||
|
data_component = CreateCombobox(serializer, restore_func, touch);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
UNIMPLEMENTED();
|
||||||
|
}
|
||||||
} else if (setting.IsEnum()) {
|
} else if (setting.IsEnum()) {
|
||||||
if (request == RequestType::RadioGroup) {
|
if (request == RequestType::RadioGroup) {
|
||||||
data_component = CreateRadioGroup(serializer, restore_func, touch);
|
data_component = CreateRadioGroup(serializer, restore_func, touch);
|
||||||
|
|
@ -629,18 +638,6 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
|
||||||
default:
|
default:
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
}
|
}
|
||||||
} else if (type == "string") {
|
|
||||||
switch (request) {
|
|
||||||
case RequestType::Default:
|
|
||||||
case RequestType::LineEdit:
|
|
||||||
data_component = CreateLineEdit(serializer, restore_func, touch);
|
|
||||||
break;
|
|
||||||
case RequestType::ComboBox:
|
|
||||||
data_component = CreateCombobox(serializer, restore_func, touch);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
UNIMPLEMENTED();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data_component == nullptr) {
|
if (data_component == nullptr) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue