Skip to content

Commit

Permalink
FIX(a11y): Make plugin config accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartmnt committed Jan 7, 2024
1 parent 1f41199 commit f58b4c6
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/mumble/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ set(MUMBLE_SOURCES
"widgets/MUComboBox.h"
"widgets/MultiStyleWidgetWrapper.cpp"
"widgets/MultiStyleWidgetWrapper.h"
"widgets/MultiColumnTreeWidget.cpp"
"widgets/MultiColumnTreeWidget.h"
"widgets/RichTextItemDelegate.cpp"
"widgets/RichTextItemDelegate.h"
"widgets/SearchDialogItemDelegate.cpp"
Expand Down
12 changes: 11 additions & 1 deletion src/mumble/PluginConfig.ui
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QTreeWidget" name="qtwPlugins">
<widget class="MultiColumnTreeWidget" name="qtwPlugins">
<property name="accessibleName">
<string>List of plugins</string>
</property>
<property name="tabKeyNavigation">
<bool>false</bool>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
Expand Down Expand Up @@ -159,6 +162,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>MultiColumnTreeWidget</class>
<extends>QTreeWidget</extends>
<header>widgets/MultiColumnTreeWidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
29 changes: 29 additions & 0 deletions src/mumble/widgets/MultiColumnTreeWidget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2024 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "MultiColumnTreeWidget.h"

#include <algorithm>

#include <QDebug>

MultiColumnTreeWidget::MultiColumnTreeWidget(QWidget *parent) : QTreeWidget(parent) {
}

QModelIndex MultiColumnTreeWidget::moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers) {
QModelIndex mi = QTreeWidget::moveCursor(cursorAction, modifiers);

if (cursorAction == QAbstractItemView::MoveLeft) {
mi = model()->index(mi.row(), std::max(0, mi.column() - 1));
}

if (cursorAction == QAbstractItemView::MoveRight) {
mi = model()->index(mi.row(), std::min(model()->columnCount() - 1, mi.column() + 1));
}

qDebug() << cursorAction << " - " << modifiers << " = " << mi;

return mi;
}
22 changes: 22 additions & 0 deletions src/mumble/widgets/MultiColumnTreeWidget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2024 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#ifndef MUMBLE_MUMBLE_WIDGETS_MULTICOLUMNTREEWIDGET_H_
#define MUMBLE_MUMBLE_WIDGETS_MULTICOLUMNTREEWIDGET_H_

#include <QTreeWidget>
#include <QModelIndex>
#include <QAbstractItemView>

class MultiColumnTreeWidget : public QTreeWidget {
Q_OBJECT;

public:
MultiColumnTreeWidget(QWidget *parent = nullptr);

QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
};

#endif

0 comments on commit f58b4c6

Please sign in to comment.