51 #ifndef QT_NO_ACCESSIBILITY 57 #define AUTO_REPEAT_DELAY 300 58 #define AUTO_REPEAT_INTERVAL 100 172 checkable(false), checked(false), autoRepeat(false), autoExclusive(false),
173 down(false), blockRefresh(false), pressed(false),
182 #ifndef QT_NO_BUTTONGROUP 192 void detectCheckedButton();
206 for (
int i = 0; i <
d->buttonList.count(); ++i)
207 d->buttonList.at(i)->d_func()->group = 0;
234 previous->removeButton(button);
235 button->d_func()->
group =
this;
236 d->buttonList.append(button);
240 d->mapping[button] = -2;
250 button->d_func()->notifyChecked();
256 if (
d->checkedButton == button) {
257 d->detectCheckedButton();
259 if (button->d_func()->
group ==
this) {
260 button->d_func()->
group = 0;
261 d->buttonList.removeAll(button);
262 d->mapping.remove(button);
269 return d->buttonList;
275 return d->checkedButton;
281 return d->mapping.key(
id);
287 if (button &&
id != -1)
294 return d->mapping.value(button, -1);
300 return d->mapping.value(
d->checkedButton, -1);
310 for (
int i = 0; i < buttonList.count(); i++) {
311 if (buttonList.at(i) != previous && buttonList.at(i)->
isChecked()) {
318 #endif // QT_NO_BUTTONGROUP 322 #ifndef QT_NO_BUTTONGROUP 324 return group->d_func()->buttonList;
329 for (
int i = candidates.
count() - 1; i >= 0; --i) {
332 #ifndef QT_NO_BUTTONGROUP 333 || candidate->
group()
344 #ifndef QT_NO_BUTTONGROUP 346 return group->d_func()->checkedButton;
351 if (!autoExclusive || buttonList.
count() == 1)
354 for (
int i = 0; i < buttonList.
count(); ++i) {
356 if (b->d_func()->
checked && b != q)
364 #ifndef QT_NO_BUTTONGROUP 368 group->d_func()->checkedButton = q;
369 if (group->d_func()->exclusive && previous && previous != q)
375 b->setChecked(
false);
382 #ifndef QT_NO_BUTTONGROUP 383 bool exclusive = group ? group->d_func()->exclusive : autoExclusive;
385 bool exclusive = autoExclusive;
389 if (!fb || !buttonList.
contains(fb))
398 for (
int i = 0; i < buttonList.
count(); ++i) {
401 (autoExclusive || (button->
focusPolicy() & focus_flag) == focus_flag)) {
409 if ((buttonRect.
x() < target.
right() && target.
x() < buttonRect.
right())
412 score = (
qAbs(p.
y() - goal.
y()) << 16) +
qAbs(p.
x() - goal.
x());
413 }
else if ((buttonRect.
y() < target.
bottom() && target.
y() < buttonRect.
bottom())
416 score = (
qAbs(p.
x() - goal.
x()) << 16) +
qAbs(p.
y() - goal.
y());
418 score = (1 << 30) + (p.
y() - goal.
y()) * (p.
y() - goal.
y()) + (p.
x() - goal.
x()) * (p.
x() - goal.
x());
421 if (score > bestScore && candidate)
426 if (p.
y() < goal.
y()) {
432 if (p.
y() > goal.
y()) {
438 if (p.
x() < goal.
x()) {
444 if (p.
x() > goal.
x()) {
454 #ifdef QT_KEYPAD_NAVIGATION
455 && !QApplication::keypadNavigationEnabled()
473 #ifndef QT_NO_BUTTONGROUP 474 if (!group && !autoExclusive)
481 for (
int i = 0; i < buttonList.
count(); ++i) {
509 #ifndef QT_NO_ACCESSIBILITY 520 bool changeState =
true;
521 if (checked && queryCheckedButton() == q) {
523 #ifndef QT_NO_BUTTONGROUP 524 if (group ? group->d_func()->exclusive : autoExclusive)
537 blockRefresh =
false;
551 emit q->clicked(checked);
552 #ifndef QT_NO_BUTTONGROUP 553 if (guard && group) {
554 emit group->buttonClicked(group->id(q));
556 emit group->buttonClicked(q);
566 #ifndef QT_NO_BUTTONGROUP 567 if (guard && group) {
568 emit group->buttonPressed(group->id(q));
570 emit group->buttonPressed(q);
580 #ifndef QT_NO_BUTTONGROUP 581 if (guard && group) {
582 emit group->buttonReleased(group->id(q));
584 emit group->buttonReleased(q);
604 #ifndef QT_NO_BUTTONGROUP 607 d->group->removeButton(
this);
647 #ifndef QT_NO_SHORTCUT 654 #ifndef QT_NO_ACCESSIBILITY 691 #ifndef QT_NO_SHORTCUT 703 if (
d->shortcutId != 0)
714 #endif // QT_NO_SHORTCUT 730 if (
d->checkable == checkable)
757 if (!
d->checkable ||
d->checked == checked) {
758 if (!
d->blockRefresh)
763 if (!checked &&
d->queryCheckedButton() ==
this) {
765 #ifndef QT_NO_BUTTONGROUP 766 if (
d->group ?
d->group->d_func()->exclusive :
d->autoExclusive)
769 d->group->d_func()->detectCheckedButton();
771 if (
d->autoExclusive)
779 if (!
d->blockRefresh)
783 if (guard && checked)
814 if (
d->autoRepeat &&
d->down)
815 d->repeatTimer.start(
d->autoRepeatDelay,
this);
817 d->repeatTimer.stop();
845 if (
d->autoRepeat == autoRepeat)
848 if (
d->autoRepeat &&
d->down)
849 d->repeatTimer.start(
d->autoRepeatDelay,
this);
851 d->repeatTimer.stop();
857 return d->autoRepeat;
883 return d->autoRepeatDelay;
909 return d->autoRepeatInterval;
943 return d->autoExclusive;
946 #ifndef QT_NO_BUTTONGROUP 960 #endif // QT_NO_BUTTONGROUP 986 if (!
d->animateTimer.isActive())
988 d->animateTimer.start(msec,
this);
1091 #ifndef QT_NO_WHEELEVENT 1100 #ifndef QT_NO_SHORTCUT 1107 if (!
d->animateTimer.isActive())
1157 d->repeatTimer.stop();
1214 #ifdef QT_KEYPAD_NAVIGATION 1215 if ((QApplication::keypadNavigationEnabled()
1224 if (
d->autoExclusive
1236 d->moveFocus(e->
key());
1263 d->repeatTimer.stop();
1281 if (e->
timerId() ==
d->repeatTimer.timerId()) {
1282 d->repeatTimer.start(
d->autoRepeatInterval,
this);
1293 }
else if (e->
timerId() ==
d->animateTimer.timerId()) {
1294 d->animateTimer.stop();
1303 #ifdef QT_KEYPAD_NAVIGATION 1304 if (!QApplication::keypadNavigationEnabled())
1306 d->fixFocusPolicy();
1323 switch (e->
type()) {
1419 if (
d->iconSize.isValid())
1428 if (
d->iconSize == size)
1444 QIcon *QAbstractButton::iconSet()
const 1447 if (!
d->icon.isNull())
1448 return const_cast<QIcon *>(&
d->icon);
static void updateAccessibility(QObject *, int who, Event reason)
Notifies accessibility clients about a change in object's accessibility information.
The QKeyEvent class describes a key event.
#define QT_END_NAMESPACE
This macro expands to.
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
static QKeySequence mnemonic(const QString &text)
Returns the shortcut key sequence for the mnemonic in text, or an empty key sequence if no mnemonics ...
#define QT_NO_BUTTONGROUP
The QShortcutEvent class provides an event which is generated when the user presses a key combination...
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
int count(const T &t) const
Returns the number of occurrences of value in the list.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
Q_DECL_CONSTEXPR T qAbs(const T &t)
The QObject class is the base class of all Qt objects.
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
void setObjectName(const QString &name)
int key() const
Returns the code of the key that was pressed or released.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
const T & at(int i) const
Returns the item at index position i in the list.
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
Qt::MouseButton button() const
Returns the button that caused the event.
void qSort(RandomAccessIterator start, RandomAccessIterator end)
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
The QMouseEvent class contains parameters that describe a mouse event.
T & first()
Returns a reference to the first item in the list.
QPoint center() const
Returns the center point of the rectangle.
int shortcutId()
This is an overloaded member function, provided for convenience. It differs from the above function o...
#define Q_DECLARE_PUBLIC(Class)
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
int right() const
Returns the x-coordinate of the rectangle's right edge.
The QTimerEvent class contains parameters that describe a timer event.
int y() const
Returns the y-coordinate of the rectangle's top edge.
int x() const
Returns the x-coordinate of the rectangle's left edge.
QObject * parent() const
Returns a pointer to the parent object.
The QPoint class defines a point in the plane using integer precision.
The QRect class defines a rectangle in the plane using integer precision.
bool isAutoRepeat() const
Returns true if this event comes from an auto-repeating key; returns false if it comes from an initia...
int y() const
Returns the y coordinate of this point.
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
The QSize class defines the size of a two-dimensional object using integer point precision.
int x() const
Returns the x coordinate of this point.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
static QWidget * focusWidget()
Returns the application widget that has the keyboard input focus, or 0 if no widget in this applicati...
QList< T > findChildren(const QString &aName=QString()) const
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
The QFocusEvent class contains event parameters for widget focus events.
static void flush()
Flushes the platform specific event queues.
The QList class is a template class that provides lists.
The QIcon class provides scalable icons in different modes and states.
void removeAt(int i)
Removes the item at index position i.