Struct qt_gui::accessible::Accessible
source · #[repr(C)]pub struct Accessible(_);
Expand description
C++ type: QAccessible
The QAccessible class provides enums and static functions related to accessibility.
This class is part of Accessibility for QWidget Applications.
Accessible applications can be used by people who are not able to use applications by conventional means.
The functions in this class are used for communication between accessible applications (also called AT Servers) and accessibility tools (AT Clients), such as screen readers and braille displays. Clients and servers communicate in the following way:
- AT Servers notify the clients about events through calls to the updateAccessibility() function.
- AT Clients request information about the objects in the server. The QAccessibleInterface class is the core interface, and encapsulates this information in a pure virtual API. Implementations of the interface are provided by Qt through the queryAccessibleInterface() API.
The communication between servers and clients is initialized by the setRootObject() function. Function pointers can be installed to replace or extend the default behavior of the static functions in QAccessible.
Qt supports Microsoft Active Accessibility (MSAA), macOS Accessibility, and the Unix/X11 AT-SPI standard. Other backends can be supported using QAccessibleBridge.
In the Unix/X11 AT-SPI implementation, applications become accessible when two conditions are met:
- org.a11y.Status.IsEnabled DBus property is true
- org.a11y.Status.ScreenReaderEnabled DBus property is true
An alternative to setting the DBus AT-SPI properties is to set the QT_LINUX_ACCESSIBILITY_ALWAYS_ON environment variable.
In addition to QAccessible's static functions, Qt offers one generic interface, QAccessibleInterface, that can be used to wrap all widgets and objects (e.g., QPushButton). This single interface provides all the metadata necessary for the assistive technologies. Qt provides implementations of this interface for its built-in widgets as plugins.
When you develop custom widgets, you can create custom subclasses of QAccessibleInterface and distribute them as plugins (using QAccessiblePlugin) or compile them into the application. Likewise, Qt's predefined accessibility support can be built as plugin (the default) or directly into the Qt library. The main advantage of using plugins is that the accessibility classes are only loaded into memory if they are actually used; they don't slow down the common case where no assistive technology is being used.
Qt also includes two convenience classes, QAccessibleObject and QAccessibleWidget, that inherit from QAccessibleInterface and provide the lowest common denominator of metadata (e.g., widget geometry, window title, basic help text). You can use them as base classes when wrapping your custom QObject or QWidget subclasses.
Implementations§
source§impl Accessible
impl Accessible
sourcepub fn accessible_interface(unique_id: c_uint) -> *mut AccessibleInterface
pub fn accessible_interface(unique_id: c_uint) -> *mut AccessibleInterface
C++ method: static QAccessibleInterface* QAccessible::accessibleInterface(unsigned int uniqueId)
Returns the QAccessibleInterface belonging to the id.
Returns 0 if the id is invalid.
sourcepub fn delete_accessible_interface(unique_id: c_uint)
pub fn delete_accessible_interface(unique_id: c_uint)
C++ method: static void QAccessible::deleteAccessibleInterface(unsigned int uniqueId)
Removes the interface belonging to this id from the cache and deletes it. The id becomes invalid an may be re-used by the cache.
sourcepub unsafe fn install_root_object_handler(
arg1: extern "C" fn(_: *mut Object)
) -> extern "C" fn(_: *mut Object)
pub unsafe fn install_root_object_handler(
arg1: extern "C" fn(_: *mut Object)
) -> extern "C" fn(_: *mut Object)
C++ method: static void (*FN_PTR)(QObject*) QAccessible::installRootObjectHandler(void (*FN_PTR)(QObject*) arg1)
sourcepub unsafe fn install_update_handler(
arg1: extern "C" fn(_: *mut AccessibleEvent)
) -> extern "C" fn(_: *mut AccessibleEvent)
pub unsafe fn install_update_handler(
arg1: extern "C" fn(_: *mut AccessibleEvent)
) -> extern "C" fn(_: *mut AccessibleEvent)
C++ method: static void (*FN_PTR)(QAccessibleEvent*) QAccessible::installUpdateHandler(void (*FN_PTR)(QAccessibleEvent*) arg1)
sourcepub fn is_active() -> bool
pub fn is_active() -> bool
C++ method: static bool QAccessible::isActive()
Returns true
if the platform requested accessibility information.
This function will return false until a tool such as a screen reader accessed the accessibility framework. It is still possible to use QAccessible::queryAccessibleInterface() even if accessibility is not active. But there will be no notifications sent to the platform.
It is recommended to use this function to prevent expensive notifications via updateAccessibility() when they are not needed.
sourcepub fn q_accessible_text_boundary_helper(
cursor: &TextCursor,
boundary_type: TextBoundaryType
) -> PairCIntCInt
pub fn q_accessible_text_boundary_helper(
cursor: &TextCursor,
boundary_type: TextBoundaryType
) -> PairCIntCInt
C++ method: static QPair<int, int> QAccessible::qAccessibleTextBoundaryHelper(const QTextCursor& cursor, QAccessible::TextBoundaryType boundaryType)
sourcepub unsafe fn query_accessible_interface(
arg1: *mut Object
) -> *mut AccessibleInterface
pub unsafe fn query_accessible_interface(
arg1: *mut Object
) -> *mut AccessibleInterface
C++ method: static QAccessibleInterface* QAccessible::queryAccessibleInterface(QObject* arg1)
If a QAccessibleInterface implementation exists for the given object, this function returns a pointer to the implementation; otherwise it returns 0.
The function calls all installed factory functions (from most recently installed to least recently installed) until one is found that provides an interface for the class of object. If no factory can provide an accessibility implementation for the class the function loads installed accessibility plugins, and tests if any of the plugins can provide the implementation.
If no implementation for the object's class is available, the function tries to find an implementation for the object's parent class, using the above strategy.
All interfaces are managed by an internal cache and should not be deleted.
sourcepub unsafe fn register_accessible_interface(
iface: *mut AccessibleInterface
) -> c_uint
pub unsafe fn register_accessible_interface(
iface: *mut AccessibleInterface
) -> c_uint
C++ method: static unsigned int QAccessible::registerAccessibleInterface(QAccessibleInterface* iface)
Call this function to ensure that manually created interfaces are properly memory managed.
Must only be called exactly once per interface iface. This is implicitly called when calling queryAccessibleInterface, calling this function is only required when QAccessibleInterfaces are instantiated with the "new" operator. This is not recommended, whenever possible use the default functions and let queryAccessibleInterface() take care of this.
When it is necessary to reimplement the QAccessibleInterface::child() function and returning the child after constructing it, this function needs to be called.
sourcepub fn set_active(active: bool)
pub fn set_active(active: bool)
C++ method: static void QAccessible::setActive(bool active)
sourcepub unsafe fn set_root_object(object: *mut Object)
pub unsafe fn set_root_object(object: *mut Object)
C++ method: static void QAccessible::setRootObject(QObject* object)
Sets the root object of the accessible objects of this application to object. All other accessible objects are reachable using object navigation from the root object.
Normally, it isn't necessary to call this function, because Qt sets the QApplication object as the root object immediately before the event loop is entered in QApplication::exec().
Use QAccessible::installRootObjectHandler() to redirect the function call to a customized handler function.
See also queryAccessibleInterface().
sourcepub unsafe fn unique_id(iface: *mut AccessibleInterface) -> c_uint
pub unsafe fn unique_id(iface: *mut AccessibleInterface) -> c_uint
C++ method: static unsigned int QAccessible::uniqueId(QAccessibleInterface* iface)
Returns the unique ID for the QAccessibleInterface iface.
sourcepub unsafe fn update_accessibility(event: *mut AccessibleEvent)
pub unsafe fn update_accessibility(event: *mut AccessibleEvent)
C++ method: static void QAccessible::updateAccessibility(QAccessibleEvent* event)
Warning: no exact match found in C++ documentation.Below is the C++ documentation for static void QAccessible::updateAccessibility(QObject object, int child, Event reason)
:
Use QAccessible::updateAccessibility(QAccessibleEvent) instead.