ソースを参照

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.
jp9000 6 年 前
コミット
8f52179912
1 ファイル変更7 行追加1 行削除
  1. 7 1
      UI/source-tree.cpp

+ 7 - 1
UI/source-tree.cpp

@@ -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();
 }