diff --git a/src/LoginPage.qml b/src/LoginPage.qml index 4f0d1ae..28f50e2 100644 --- a/src/LoginPage.qml +++ b/src/LoginPage.qml @@ -22,6 +22,7 @@ Page { } } + Accessible.role: Accessible.Form title: qsTr("Login") ColumnLayout { diff --git a/src/MnemonicLabel.qml b/src/MnemonicLabel.qml index c1d66f5..0926205 100644 --- a/src/MnemonicLabel.qml +++ b/src/MnemonicLabel.qml @@ -18,4 +18,10 @@ Label { control.buddy.forceActiveFocus(); } } + + Binding { + property: "Accessible.name" + target: control.buddy + value: control.Mnemonic.plainLabel + } } diff --git a/src/mnemonicattached.cpp b/src/mnemonicattached.cpp index 280506e..80d0a49 100644 --- a/src/mnemonicattached.cpp +++ b/src/mnemonicattached.cpp @@ -61,6 +61,7 @@ private: MnemonicAttached::MnemonicAttached(QObject *parent) : QObject{parent} , m_label{} + , m_plainLabel{} , m_richTextLabel{} , m_active{MnemonicEventFilter::instance().isAltPressed()} { @@ -93,9 +94,15 @@ void MnemonicAttached::setLabel(const QString &label) emit labelChanged(); emit sequenceChanged(); + setPlainLabel(QString(m_label).remove('&'_L1)); updateRichText(); } +QString MnemonicAttached::plainLabel() const +{ + return m_plainLabel; +} + QString MnemonicAttached::richTextLabel() const { return m_richTextLabel; @@ -124,6 +131,15 @@ void MnemonicAttached::onAltReleased() updateRichText(); } +void MnemonicAttached::setPlainLabel(const QString &plain) +{ + if (plain == m_plainLabel) { + return; + } + m_plainLabel = plain; + emit plainLabelChanged(); +} + void MnemonicAttached::updateRichText() { QString richTextLabel; diff --git a/src/mnemonicattached.h b/src/mnemonicattached.h index d76429a..df90973 100644 --- a/src/mnemonicattached.h +++ b/src/mnemonicattached.h @@ -11,6 +11,7 @@ class MnemonicAttached : public QObject Q_OBJECT Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged FINAL) + Q_PROPERTY(QString plainLabel READ plainLabel NOTIFY plainLabelChanged FINAL) Q_PROPERTY(QString richTextLabel READ richTextLabel NOTIFY richTextLabelChanged FINAL) Q_PROPERTY(QKeySequence sequence READ sequence NOTIFY sequenceChanged FINAL) @@ -25,6 +26,8 @@ public: QString label() const; void setLabel(const QString &label); + QString plainLabel() const; + QString richTextLabel() const; QKeySequence sequence() const; @@ -32,6 +35,7 @@ public: signals: void enabledChanged(); void labelChanged(); + void plainLabelChanged(); void richTextLabelChanged(); void sequenceChanged(); @@ -40,9 +44,11 @@ private slots: void onAltReleased(); private: + void setPlainLabel(const QString &plain); void updateRichText(); QString m_label; + QString m_plainLabel; QString m_richTextLabel; bool m_active; };