QAccessible::Role QAccessibleButton::role() const
{
    QAbstractButton *ab = button();

#ifndef QT_NO_MENU
    if (QPushButton *pb = qobject_cast<QPushButton*>(ab)) {
        if (pb->menu())
            return QAccessible::ButtonMenu;
    }
#endif

    if (ab->isCheckable())
        return ab->autoExclusive() ? QAccessible::RadioButton : QAccessible::CheckBox;

    return QAccessible::Button;
}
Exemple #2
0
QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const
{
#ifndef QT_NO_BUTTONGROUP
    if (group)
        return group->d_func()->buttonList;
#endif

    QList<QAbstractButton*>candidates = qFindChildren<QAbstractButton *>(parent);
    if (autoExclusive) {
        for (int i = candidates.count() - 1; i >= 0; --i) {
            QAbstractButton *candidate = candidates.at(i);
            if (!candidate->autoExclusive()
#ifndef QT_NO_BUTTONGROUP
                    || candidate->group()
#endif
               )
                candidates.removeAt(i);
        }
    }
    return candidates;
}