UI: Fix accessibility/narration text on sources list
Fixes the narration reading (for the blind) for items in the sources list; previously they would not be read due to the new custom model. This issue is solved by returning the name of item in the form of a QVariant of a QString returned from the QAbstractItemModel::data virtual function when the Qt::AccessibleTextRole role is used.master
parent
87ca80deac
commit
8f52179912
|
@ -695,8 +695,14 @@ int SourceTreeModel::rowCount(const QModelIndex &parent) const
|
|||
return parent.isValid() ? 0 : items.count();
|
||||
}
|
||||
|
||||
QVariant SourceTreeModel::data(const QModelIndex &, int) const
|
||||
QVariant SourceTreeModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role == Qt::AccessibleTextRole) {
|
||||
OBSSceneItem item = items[index.row()];
|
||||
obs_source_t *source = obs_sceneitem_get_source(item);
|
||||
return QVariant(QT_UTF8(obs_source_get_name(source)));
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue