void QAccessibleComboBox::doAction(const QString &actionName) { if (actionName == showMenuAction()) { if (comboBox()->view()->isVisible()) { comboBox()->hidePopup(); } else { comboBox()->showPopup(); } } }
/* The three different tool button types can have the following actions: | DelayedPopup | ShowMenuAction + (PressedAction || CheckedAction) | | MenuButtonPopup | ShowMenuAction + (PressedAction || CheckedAction) | | InstantPopup | ShowMenuAction | */ QStringList QAccessibleToolButton::actionNames() const { QStringList names; if (widget()->isEnabled()) { if (toolButton()->menu()) names << showMenuAction(); if (toolButton()->popupMode() != QToolButton::InstantPopup) names << QAccessibleButton::actionNames(); } return names; }
QStringList QAccessibleMenuItem::actionNames() const { QStringList actions; if (!m_action || m_action->isSeparator()) return actions; if (m_action->menu()) { actions << showMenuAction(); } else { actions << pressAction(); } return actions; }
void QAccessibleToolButton::doAction(const QString &actionName) { if (!widget()->isEnabled()) return; if (actionName == pressAction()) { button()->click(); } else if (actionName == showMenuAction()) { if (toolButton()->popupMode() != QToolButton::InstantPopup) { toolButton()->setDown(true); #ifndef QT_NO_MENU toolButton()->showMenu(); #endif } } else { QAccessibleButton::doAction(actionName); } }
void QAccessibleButton::doAction(const QString &actionName) { if (!widget()->isEnabled()) return; if (actionName == pressAction() || actionName == showMenuAction()) { #ifndef QT_NO_MENU QPushButton *pb = qobject_cast<QPushButton*>(object()); if (pb && pb->menu()) pb->showMenu(); else #endif button()->animateClick(); } else if (actionName == toggleAction()) { button()->toggle(); } else { QAccessibleWidget::doAction(actionName); } }
QStringList QAccessibleButton::actionNames() const { QStringList names; if (widget()->isEnabled()) { switch (role()) { case QAccessible::ButtonMenu: names << showMenuAction(); break; case QAccessible::RadioButton: names << toggleAction(); break; default: if (button()->isCheckable()) { names << toggleAction(); } else { names << pressAction(); } break; } } names << QAccessibleWidget::actionNames(); return names; }
void QAccessibleMenuItem::doAction(const QString &actionName) { if (!m_action->isEnabled()) return; if (actionName == pressAction()) { m_action->trigger(); } else if (actionName == showMenuAction()) { if (QMenuBar *bar = qobject_cast<QMenuBar*>(owner())) { if (m_action->menu() && m_action->menu()->isVisible()) { m_action->menu()->hide(); } else { bar->setActiveAction(m_action); } } else if (QMenu *menu = qobject_cast<QMenu*>(owner())){ if (m_action->menu() && m_action->menu()->isVisible()) { m_action->menu()->hide(); } else { menu->setActiveAction(m_action); } } } }
QString QAccessibleComboBox::localizedActionDescription(const QString &actionName) const { if (actionName == showMenuAction()) return QComboBox::tr("Open the combo box selection popup"); return QString(); }
QStringList QAccessibleComboBox::actionNames() const { return QStringList(showMenuAction()); }