diff options
Diffstat (limited to 'src/widgets/widgets/qabstractbutton.cpp')
-rw-r--r-- | src/widgets/widgets/qabstractbutton.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 4eb871ea4b..3a5fbe1b90 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -8,19 +8,21 @@ #endif #if QT_CONFIG(buttongroup) #include "qbuttongroup.h" -#include "private/qapplication_p.h" #include "private/qbuttongroup_p.h" #endif +#include "private/qapplication_p.h" #include "qabstractbutton_p.h" #include "qevent.h" #include "qpainter.h" #include "qapplication.h" #include "qstyle.h" -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) #include "qaccessible.h" #endif #include <qpa/qplatformtheme.h> +#include <QtCore/qpointer.h> + #include <algorithm> QT_BEGIN_NAMESPACE @@ -180,10 +182,10 @@ QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const Q_Q(const QAbstractButton); QList<QAbstractButton *> buttonList = queryButtonList(); - if (!autoExclusive || buttonList.count() == 1) // no group + if (!autoExclusive || buttonList.size() == 1) // no group return nullptr; - for (int i = 0; i < buttonList.count(); ++i) { + for (int i = 0; i < buttonList.size(); ++i) { QAbstractButton *b = buttonList.at(i); if (b->d_func()->checked && b != q) return b; @@ -227,7 +229,7 @@ void QAbstractButtonPrivate::moveFocus(int key) QPoint goal = target.center(); uint focus_flag = qt_tab_all_widgets() ? Qt::TabFocus : Qt::StrongFocus; - for (int i = 0; i < buttonList.count(); ++i) { + for (int i = 0; i < buttonList.size(); ++i) { QAbstractButton *button = buttonList.at(i); if (button != f && button->window() == f->window() && button->isEnabled() && !button->isHidden() && (exclusive || (button->focusPolicy() & focus_flag) == focus_flag)) { @@ -310,7 +312,7 @@ void QAbstractButtonPrivate::fixFocusPolicy() return; QList<QAbstractButton *> buttonList = queryButtonList(); - for (int i = 0; i < buttonList.count(); ++i) { + for (int i = 0; i < buttonList.size(); ++i) { QAbstractButton *b = buttonList.at(i); if (!b->isCheckable()) continue; @@ -490,7 +492,7 @@ void QAbstractButton::setText(const QString &text) d->sizeHint = QSize(); update(); updateGeometry(); -#ifndef QT_NO_ACCESSIBILITY +#if QT_CONFIG(accessibility) QAccessibleEvent event(this, QAccessible::NameChanged); QAccessible::updateAccessibility(&event); #endif @@ -613,12 +615,13 @@ void QAbstractButton::setChecked(bool checked) if (guard) d->emitToggled(checked); - -#ifndef QT_NO_ACCESSIBILITY - QAccessible::State s; - s.checked = true; - QAccessibleStateChangeEvent event(this, s); - QAccessible::updateAccessibility(&event); +#if QT_CONFIG(accessibility) + if (guard) { + QAccessible::State s; + s.checked = true; + QAccessibleStateChangeEvent event(this, s); + QAccessible::updateAccessibility(&event); + } #endif } @@ -904,9 +907,6 @@ bool QAbstractButton::event(QEvent *e) case QEvent::HoverEnter: case QEvent::HoverLeave: case QEvent::ContextMenu: -#if QT_CONFIG(wheelevent) - case QEvent::Wheel: -#endif return true; default: break; @@ -1050,7 +1050,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e) // cleaned up when fixing task 194373. It's here to ensure that we // keep compatibility outside QAbstractItemView. d->moveFocus(e->key()); - if (hasFocus()) // nothing happend, propagate + if (hasFocus()) // nothing happened, propagate e->ignore(); } else { // Prefer parent widget, use this if parent is absent |