Commit 39564c0f authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Announce current item when user ID list gets focus

GnuPG-bug-id: 6046
parent 06184481
......@@ -280,6 +280,32 @@ QString formatDate(const QDate &date, QLocale::FormatType format)
return QLocale{}.toString(date, dateFormatWithFourDigitYear(format));
}
class ListView : public QListView
{
Q_OBJECT
public:
using QListView::QListView;
protected:
void focusInEvent(QFocusEvent *event) override
{
QListView::focusInEvent(event);
// queue the invokation, so that it happens after the widget itself got focus
QMetaObject::invokeMethod(this, &ListView::forceAccessibleFocusEventForCurrentItem, Qt::QueuedConnection);
}
private:
void forceAccessibleFocusEventForCurrentItem()
{
// force Qt to send a focus event for the current item to accessibility
// tools; otherwise, the user has no idea which item is selected when the
// list gets keyboard input focus
const auto current = currentIndex();
setCurrentIndex({});
setCurrentIndex(current);
}
};
}
class CertifyWidget::Private
......@@ -323,7 +349,7 @@ public:
mainLay->addWidget(new KSeparator{Qt::Horizontal, q});
auto listView = new QListView{q};
auto listView = new ListView{q};
listView->setModel(&mUserIDModel);
mainLay->addWidget(listView, 1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment