Skip to content

Commit

Permalink
UI: Add Selected and Hidden Array Values
Browse files Browse the repository at this point in the history
Add Selected and Hidden Array Values

Let developers get and set whether items in an editable list are hidden
or selected. May be useful in when editable lists are modified and
handled in a callback. Especially when edit button callbacks are used.

Closes obsproject#1200
  • Loading branch information
Andersama authored and jp9000 committed Apr 19, 2018
1 parent 4fcc2cc commit e92b256
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion UI/properties-view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,10 @@ void OBSPropertiesView::AddEditableList(obs_property_t *prop,
for (size_t i = 0; i < count; i++) {
obs_data_t *item = obs_data_array_item(array, i);
list->addItem(QT_UTF8(obs_data_get_string(item, "value")));
list->setItemSelected(list->item((int)i),
obs_data_get_bool(item, "selected"));
list->setItemHidden(list->item((int)i),
obs_data_get_bool(item, "hidden"));
obs_data_release(item);
}

Expand Down Expand Up @@ -1690,7 +1694,10 @@ void WidgetInfo::EditableListChanged()
obs_data_t *arrayItem = obs_data_create();
obs_data_set_string(arrayItem, "value",
QT_TO_UTF8(item->text()));

obs_data_set_bool(arrayItem, "selected",
item->isSelected());
obs_data_set_bool(arrayItem, "hidden",
item->isHidden());
obs_data_array_push_back(array, arrayItem);
obs_data_release(arrayItem);
}
Expand Down

0 comments on commit e92b256

Please sign in to comment.