diff --git a/UI/properties-view.cpp b/UI/properties-view.cpp index b048d75e9..d47270c56 100644 --- a/UI/properties-view.cpp +++ b/UI/properties-view.cpp @@ -541,30 +541,30 @@ static void AddComboItem(QComboBox *combo, obs_property_t *prop, template -static string from_obs_data(obs_data_t *data, const char *name, - obs_combo_format format) +static QVariant from_obs_data(obs_data_t *data, const char *name, + obs_combo_format format) { switch (format) { case OBS_COMBO_FORMAT_INT: - return to_string(get_int(data, name)); + return QVariant::fromValue(get_int(data, name)); case OBS_COMBO_FORMAT_FLOAT: - return to_string(get_double(data, name)); + return QVariant::fromValue(get_double(data, name)); case OBS_COMBO_FORMAT_STRING: - return get_string(data, name); + return QByteArray(get_string(data, name)); default: - return ""; + return QVariant(); } } -static string from_obs_data(obs_data_t *data, const char *name, - obs_combo_format format) +static QVariant from_obs_data(obs_data_t *data, const char *name, + obs_combo_format format) { return from_obs_data(data, name, format); } -static string from_obs_data_autoselect(obs_data_t *data, const char *name, - obs_combo_format format) +static QVariant from_obs_data_autoselect(obs_data_t *data, const char *name, + obs_combo_format format) { return from_obs_datasetMaxVisibleItems(40); combo->setToolTip(QT_UTF8(obs_property_long_description(prop))); - string value = from_obs_data(settings, name, format); + QVariant value = from_obs_data(settings, name, format); if (format == OBS_COMBO_FORMAT_STRING && type == OBS_COMBO_TYPE_EDITABLE) { - combo->lineEdit()->setText(QT_UTF8(value.c_str())); + combo->lineEdit()->setText(value.toString()); } else { - idx = combo->findData(QByteArray(value.c_str())); + idx = combo->findData(value); } if (type == OBS_COMBO_TYPE_EDITABLE) @@ -607,9 +607,9 @@ QWidget *OBSPropertiesView::AddList(obs_property_t *prop, bool &warning) combo->setCurrentIndex(idx); if (obs_data_has_autoselect_value(settings, name)) { - string autoselect = + QVariant autoselect = from_obs_data_autoselect(settings, name, format); - int id = combo->findData(QT_UTF8(autoselect.c_str())); + int id = combo->findData(autoselect); if (id != -1 && id != idx) { QString actual = combo->itemText(id);