Setting accessibleName and accessibleRole for objects
This commit is contained in:
committed by
John Preston
parent
ce9c3b4ef8
commit
b9c07e644f
@@ -39,6 +39,7 @@ CodeWidget::CodeWidget(
|
||||
, _callTimeout(getData()->callTimeout)
|
||||
, _callLabel(this, st::introDescription)
|
||||
, _checkRequestTimer([=] { checkRequest(); }) {
|
||||
setAccessibleRole(QAccessible::Role::Dialog);
|
||||
Lang::Updated(
|
||||
) | rpl::start_with_next([=] {
|
||||
refreshLang();
|
||||
|
||||
@@ -160,6 +160,8 @@ void CodeDigit::paintEvent(QPaintEvent *e) {
|
||||
CodeInput::CodeInput(QWidget *parent)
|
||||
: Ui::RpWidget(parent) {
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setAccessibleRole(QAccessible::Role::EditableText);
|
||||
setAccessibleName(tr::lng_code_ph(tr::now));
|
||||
}
|
||||
|
||||
void CodeInput::setDigitsCountMax(int digitsCount) {
|
||||
|
||||
@@ -37,6 +37,7 @@ PasswordCheckWidget::PasswordCheckWidget(
|
||||
, _codeField(this, st::introPassword, tr::lng_signin_code())
|
||||
, _toRecover(this, tr::lng_signin_recover(tr::now))
|
||||
, _toPassword(this, tr::lng_signin_try_password(tr::now)) {
|
||||
setAccessibleRole(QAccessible::Role::Dialog);
|
||||
Expects(_passwordState.hasPassword);
|
||||
|
||||
Lang::Updated(
|
||||
|
||||
@@ -62,6 +62,9 @@ PhoneWidget::PhoneWidget(
|
||||
st::introPhone,
|
||||
[](const QString &s) { return Countries::Groups(s); })
|
||||
, _checkRequestTimer([=] { checkRequest(); }) {
|
||||
setAccessibleRole(QAccessible::Role::Dialog);
|
||||
_code->setAccessibleName(tr::lng_country_code(tr::now));
|
||||
_phone->setAccessibleName(tr::lng_phone_number(tr::now));
|
||||
_phone->frontBackspaceEvent(
|
||||
) | rpl::start_with_next([=](not_null<QKeyEvent*> e) {
|
||||
_code->startErasing(e);
|
||||
|
||||
@@ -80,6 +80,8 @@ namespace {
|
||||
style::PaletteChanged()
|
||||
);
|
||||
auto result = Ui::CreateChild<Ui::RpWidget>(parent.get());
|
||||
result->setAccessibleRole(QAccessible::Role::Graphic);
|
||||
result->setAccessibleName(tr::lng_intro_qr_title(tr::now));
|
||||
const auto state = result->lifetime().make_state<State>(
|
||||
[=] { result->update(); });
|
||||
state->waiting.start();
|
||||
@@ -181,6 +183,20 @@ QrWidget::QrWidget(
|
||||
setTitleText(rpl::single(QString()));
|
||||
setDescriptionText(rpl::single(QString()));
|
||||
setErrorCentered(true);
|
||||
setAccessibleRole(QAccessible::Role::Dialog);
|
||||
setAccessibleName(tr::lng_intro_qr_title(tr::now));
|
||||
|
||||
const auto texts = {
|
||||
tr::lng_intro_qr_step1,
|
||||
tr::lng_intro_qr_step2,
|
||||
tr::lng_intro_qr_step3,
|
||||
};
|
||||
QString fullDescription;
|
||||
int index = 1;
|
||||
for (const auto& text : texts) {
|
||||
fullDescription += QString::number(index++) + ". " + text(tr::now) + "\n";
|
||||
}
|
||||
setAccessibleDescription(fullDescription);
|
||||
|
||||
cancelNearestDcRequest();
|
||||
|
||||
@@ -410,6 +426,10 @@ void QrWidget::sendCheckPasswordRequest() {
|
||||
void QrWidget::activate() {
|
||||
Step::activate();
|
||||
showChildren();
|
||||
|
||||
if (const auto skipButton = findChild<Ui::LinkButton*>()) {
|
||||
skipButton->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
}
|
||||
|
||||
void QrWidget::finished() {
|
||||
|
||||
@@ -77,6 +77,7 @@ Step::Step(
|
||||
_hasCover
|
||||
? st::introCoverDescription
|
||||
: st::introDescription)) {
|
||||
setAccessibleRole(QAccessible::Pane);
|
||||
hide();
|
||||
style::PaletteChanged(
|
||||
) | rpl::start_with_next([=] {
|
||||
@@ -94,6 +95,7 @@ Step::Step(
|
||||
_titleText.value(
|
||||
) | rpl::start_with_next([=](const QString &text) {
|
||||
_title->setText(text);
|
||||
setAccessibleName(text);
|
||||
updateLabelsPosition();
|
||||
}, lifetime());
|
||||
|
||||
@@ -105,6 +107,7 @@ Step::Step(
|
||||
EntityType::Spoiler,
|
||||
&EntityInText::type);
|
||||
label->setMarkedText(text);
|
||||
setAccessibleDescription(text.text);
|
||||
label->setAttribute(Qt::WA_TransparentForMouseEvents, hasSpoiler);
|
||||
updateLabelsPosition();
|
||||
}, lifetime());
|
||||
|
||||
@@ -141,6 +141,7 @@ Widget::Widget(
|
||||
}, lifetime());
|
||||
|
||||
_back->entity()->setClickedCallback([=] { backRequested(); });
|
||||
_back->entity()->setAccessibleName(tr::lng_go_back(tr::now));
|
||||
_back->hide(anim::type::instant);
|
||||
|
||||
if (_changeLanguage) {
|
||||
|
||||
Reference in New Issue
Block a user