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,
|
||||
Settings::BasicSetting* other_setting, const QString& suffix) {
|
||||
created = true;
|
||||
const auto type = setting.TypeId();
|
||||
const auto type_id = setting.TypeId();
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
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();
|
||||
}
|
||||
|
||||
const bool require_checkbox =
|
||||
other_setting != nullptr && other_setting->ToString() == "bool";
|
||||
|
||||
const bool require_checkbox = other_setting != nullptr && other_setting->TypeId() == "bool";
|
||||
if (other_setting != nullptr && other_setting->TypeId() != "bool") {
|
||||
LOG_WARNING(
|
||||
Frontend,
|
||||
|
|
@ -572,16 +570,27 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
|
|||
}
|
||||
|
||||
if (require_checkbox) {
|
||||
QWidget* lhs =
|
||||
CreateCheckBox(other_setting, label, checkbox_serializer, checkbox_restore_func, touch);
|
||||
QWidget* lhs = CreateCheckBox(other_setting, label, checkbox_serializer, checkbox_restore_func, touch);
|
||||
layout->addWidget(lhs, 1);
|
||||
} else if (setting.TypeId() != "bool") {
|
||||
} else if (type_id != "bool") {
|
||||
QLabel* qt_label = CreateLabel(label);
|
||||
layout->addWidget(qt_label, 1);
|
||||
}
|
||||
|
||||
if (setting.TypeId() == "bool") {
|
||||
if (type_id == "bool") {
|
||||
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()) {
|
||||
if (request == RequestType::RadioGroup) {
|
||||
data_component = CreateRadioGroup(serializer, restore_func, touch);
|
||||
|
|
@ -629,18 +638,6 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
|
|||
default:
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue