Skip to content

Commit

Permalink
FIX(a11y): Make search result tree accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartmnt committed Jan 6, 2024
1 parent fdb4a26 commit a683d7d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/mumble/SearchDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "Accessibility.h"
#include "SearchDialog.h"
#include "Channel.h"
#include "ClientUser.h"
Expand All @@ -26,6 +27,8 @@

#include <stack>

#include <QDebug>

namespace Search {

QString SearchDialog::toString(UserAction action) {
Expand Down Expand Up @@ -97,6 +100,10 @@ class ChannelItem : public QTreeWidgetItem {
constexpr int NAME_COLUMN = 0;

setText(NAME_COLUMN, chan->qsName);
setData(NAME_COLUMN, Qt::AccessibleTextRole, Mumble::Accessibility::channelToText(chan));
setData(1, Qt::AccessibleTextRole, Mumble::Accessibility::channelToText(chan));

qDebug() << Mumble::Accessibility::channelToText(chan);

setTextAlignment(NAME_COLUMN, Qt::AlignLeft | Qt::AlignVCenter);
}
Expand Down Expand Up @@ -226,6 +233,9 @@ void SearchDialog::on_searchResultTree_currentItemChanged(QTreeWidgetItem *c, QT
if (user) {
// Only try to select the user if (s)he still exists
Global::get().mw->pmModel->setSelectedUser(user->uiSession);
item.setData(0, Qt::AccessibleTextRole, Mumble::Accessibility::userToText(user));
item.setData(1, Qt::AccessibleTextRole, Mumble::Accessibility::userToText(user));
qDebug() << Mumble::Accessibility::userToText(user);
}
} else {
const Channel *channel = Channel::get(static_cast< int >(item.getID()));
Expand Down

0 comments on commit a683d7d

Please sign in to comment.