4#include "private/qabstractbutton_p.h"
6#if QT_CONFIG(itemviews)
9#if QT_CONFIG(buttongroup)
11#include "private/qbuttongroup_p.h"
13#include "private/qapplication_p.h"
19#if QT_CONFIG(accessibility)
22#include <qpa/qplatformtheme.h>
28#define AUTO_REPEAT_DELAY 300
29#define AUTO_REPEAT_INTERVAL 100
138#ifndef QT_NO_SHORTCUT
153#if QT_CONFIG(buttongroup)
155 return group->d_func()->buttonList;
162 auto isNoMemberOfMyAutoExclusiveGroup = [](
QAbstractButton *candidate) {
164#if QT_CONFIG(buttongroup)
165 || candidate->group()
169 candidates.
removeIf(isNoMemberOfMyAutoExclusiveGroup);
176#if QT_CONFIG(buttongroup)
178 return group->d_func()->checkedButton;
186 for (
int i = 0;
i < buttonList.
size(); ++
i) {
188 if (
b->d_func()->checked &&
b !=
q)
196#if QT_CONFIG(buttongroup)
200 group->d_func()->checkedButton =
q;
201 if (
group->d_func()->exclusive && previous && previous !=
q)
207 b->setChecked(
false);
214#if QT_CONFIG(buttongroup)
221 if (!fb || !buttonList.
contains(fb))
230 for (
int i = 0;
i < buttonList.
size(); ++
i) {
244 score = (
qAbs(
p.y() - goal.
y()) << 16) +
qAbs(
p.x() - goal.
x());
248 score = (
qAbs(
p.x() - goal.
x()) << 16) +
qAbs(
p.y() - goal.
y());
250 score = (1 << 30) + (
p.y() - goal.
y()) * (
p.y() - goal.
y()) + (
p.x() - goal.
x()) * (
p.x() - goal.
x());
253 if (score > bestScore && candidate)
258 if (
p.y() < goal.
y()) {
264 if (
p.y() > goal.
y()) {
270 if (
p.x() < goal.
x()) {
276 if (
p.x() > goal.
x()) {
286#ifdef QT_KEYPAD_NAVIGATION
287 && !QApplicationPrivate::keypadNavigationEnabled()
305#if QT_CONFIG(buttongroup)
313 for (
int i = 0;
i < buttonList.
size(); ++
i) {
315 if (!
b->isCheckable())
319 : (
b->focusPolicy() &
~Qt::TabFocus)));
349 bool changeState =
true;
352#if QT_CONFIG(buttongroup)
380#if QT_CONFIG(buttongroup)
381 if (guard &&
group) {
394#if QT_CONFIG(buttongroup)
395 if (guard &&
group) {
408#if QT_CONFIG(buttongroup)
409 if (guard &&
group) {
422#if QT_CONFIG(buttongroup)
423 if (guard &&
group) {
446#if QT_CONFIG(buttongroup)
449 d->group->removeButton(
this);
486#ifndef QT_NO_SHORTCUT
493#if QT_CONFIG(accessibility)
494 QAccessibleEvent
event(
this, QAccessible::NameChanged);
495 QAccessible::updateAccessibility(&
event);
528#ifndef QT_NO_SHORTCUT
537 if (
d->shortcutId != 0)
585 if (!
d->checkable ||
d->checked ==
checked) {
586 if (!
d->blockRefresh)
591 if (!
checked &&
d->queryCheckedButton() ==
this) {
593#if QT_CONFIG(buttongroup)
594 if (
d->group ?
d->group->d_func()->exclusive :
d->autoExclusive)
597 d->group->d_func()->detectCheckedButton();
599 if (
d->autoExclusive)
607 if (!
d->blockRefresh)
616#if QT_CONFIG(accessibility)
620 QAccessibleStateChangeEvent
event(
this,
s);
621 QAccessible::updateAccessibility(&
event);
648 if (
d->autoRepeat &&
d->down)
649 d->repeatTimer.start(
d->autoRepeatDelay,
this);
651 d->repeatTimer.stop();
680 if (
d->autoRepeat &&
d->down)
681 d->repeatTimer.start(
d->autoRepeatDelay,
this);
683 d->repeatTimer.stop();
689 return d->autoRepeat;
712 return d->autoRepeatDelay;
735 return d->autoRepeatInterval;
766 return d->autoExclusive;
769#if QT_CONFIG(buttongroup)
807 if (!
d->animateTimer.isActive())
809 d->animateTimer.start(100,
this);
914#ifndef QT_NO_SHORTCUT
918 if (
d->shortcutId != se->shortcutId())
920 if (!se->isAmbiguous()) {
921 if (!
d->animateTimer.isActive())
973 d->repeatTimer.stop();
991 if (
hitButton(
e->position().toPoint()) !=
d->down) {
999 }
else if (!
hitButton(
e->position().toPoint())) {
1010 const auto key =
e->key();
1014 if (buttonPressKeys.contains(
key) && !
e->isAutoRepeat()) {
1028#ifdef QT_KEYPAD_NAVIGATION
1029 if ((QApplicationPrivate::keypadNavigationEnabled()
1038 if (
d->autoExclusive
1043 || (pw && qobject_cast<QAbstractItemView *>(pw->
parentWidget()))
1050 d->moveFocus(
e->key());
1066#ifndef QT_NO_SHORTCUT
1083 if (!
e->isAutoRepeat())
1084 d->repeatTimer.stop();
1089 if (buttonPressKeys.contains(
e->key()) && !
e->isAutoRepeat() &&
d->down) {
1102 if (
e->timerId() ==
d->repeatTimer.timerId()) {
1103 d->repeatTimer.start(
d->autoRepeatInterval,
this);
1114 }
else if (
e->timerId() ==
d->animateTimer.timerId()) {
1115 d->animateTimer.stop();
1124#ifdef QT_KEYPAD_NAVIGATION
1125 if (!QApplicationPrivate::keypadNavigationEnabled())
1127 d->fixFocusPolicy();
1146 switch (
e->type()) {
1235 if (
d->iconSize.isValid())
1244 if (
d->iconSize ==
size)
1259#include "moc_qabstractbutton.cpp"
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or \nullptr if no widget in this ap...
The QFocusEvent class contains event parameters for widget focus events.
static QPlatformTheme * platformTheme()
The QIcon class provides scalable icons in different modes and states.
The QKeyEvent class describes a key event.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
static QKeySequence mnemonic(const QString &text)
Returns the shortcut key sequence for the mnemonic in text, or an empty key sequence if no mnemonics ...
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
qsizetype removeIf(Predicate pred)
QList< T > findChildren(const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns all children of this object with the given name that can be cast to type T,...
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QRect translated(int dx, int dy) const noexcept
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis,...
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr QPoint center() const noexcept
Returns the center point of the rectangle.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
The QShortcutEvent class provides an event which is generated when the user presses a key combination...
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
\macro QT_RESTRICTED_CAST_FROM_ASCII
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
Combined button and popup list for selecting options.
@ NavigationModeKeypadDirectional
@ WA_WState_OwnSizePolicy
constexpr T qAbs(const T &t)
GLboolean GLboolean GLboolean b
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble GLdouble GLdouble q
#define QT_CONFIG(feature)
if(qFloatDistance(a, b)<(1<< 7))
[0]
bool contains(const AT &t) const noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent