summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/code/src_gui_accessible_qaccessible.cpp
blob: 621d00a40174b1418ba9e08fe82d13876f090774 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QAccessible>

namespace src_gui_accessible_qaccessible {
class MyWidget
{
    void setFocus(Qt::FocusReason reason);
};
QAccessibleInterface *f = nullptr;

//! [1]
typedef QAccessibleInterface *myFactoryFunction(const QString &key, QObject *);
//! [1]

//! [2]
void MyWidget::setFocus(Qt::FocusReason reason)
{
    // handle custom focus setting...
    QAccessibleEvent event(f, QAccessible::Focus);
    QAccessible::updateAccessibility(&event);
}
//! [2]

} // src_gui_accessible_qaccessible