diff options
Diffstat (limited to 'src/widgets/widgets/qabstractbutton.cpp')
-rw-r--r-- | src/widgets/widgets/qabstractbutton.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 1d78d24a88..dbd94e890d 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -39,11 +39,13 @@ #include "private/qabstractbutton_p.h" -#include "private/qbuttongroup_p.h" #if QT_CONFIG(itemviews) #include "qabstractitemview.h" #endif +#if QT_CONFIG(buttongroup) #include "qbuttongroup.h" +#include "private/qbuttongroup_p.h" +#endif #include "qabstractbutton_p.h" #include "qevent.h" #include "qpainter.h" @@ -173,7 +175,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type) #endif checkable(false), checked(false), autoRepeat(false), autoExclusive(false), down(false), blockRefresh(false), pressed(false), -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) group(0), #endif autoRepeatDelay(AUTO_REPEAT_DELAY), @@ -183,7 +185,7 @@ QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type) QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const { -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (group) return group->d_func()->buttonList; #endif @@ -192,7 +194,7 @@ QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const if (autoExclusive) { auto isNoMemberOfMyAutoExclusiveGroup = [](QAbstractButton *candidate) { return !candidate->autoExclusive() -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) || candidate->group() #endif ; @@ -206,7 +208,7 @@ QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const { -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (group) return group->d_func()->checkedButton; #endif @@ -226,7 +228,7 @@ QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const void QAbstractButtonPrivate::notifyChecked() { -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) Q_Q(QAbstractButton); if (group) { QAbstractButton *previous = group->d_func()->checkedButton; @@ -244,7 +246,7 @@ void QAbstractButtonPrivate::notifyChecked() void QAbstractButtonPrivate::moveFocus(int key) { QList<QAbstractButton *> buttonList = queryButtonList();; -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) bool exclusive = group ? group->d_func()->exclusive : autoExclusive; #else bool exclusive = autoExclusive; @@ -335,7 +337,7 @@ void QAbstractButtonPrivate::moveFocus(int key) void QAbstractButtonPrivate::fixFocusPolicy() { Q_Q(QAbstractButton); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (!group && !autoExclusive) #else if (!autoExclusive) @@ -382,7 +384,7 @@ void QAbstractButtonPrivate::click() bool changeState = true; if (checked && queryCheckedButton() == q) { // the checked button of an exclusive or autoexclusive group cannot be unchecked -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (group ? group->d_func()->exclusive : autoExclusive) #else if (autoExclusive) @@ -410,7 +412,7 @@ void QAbstractButtonPrivate::emitClicked() Q_Q(QAbstractButton); QPointer<QAbstractButton> guard(q); emit q->clicked(checked); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (guard && group) { emit group->buttonClicked(group->id(q)); if (guard && group) @@ -424,7 +426,7 @@ void QAbstractButtonPrivate::emitPressed() Q_Q(QAbstractButton); QPointer<QAbstractButton> guard(q); emit q->pressed(); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (guard && group) { emit group->buttonPressed(group->id(q)); if (guard && group) @@ -438,7 +440,7 @@ void QAbstractButtonPrivate::emitReleased() Q_Q(QAbstractButton); QPointer<QAbstractButton> guard(q); emit q->released(); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (guard && group) { emit group->buttonReleased(group->id(q)); if (guard && group) @@ -452,7 +454,7 @@ void QAbstractButtonPrivate::emitToggled(bool checked) Q_Q(QAbstractButton); QPointer<QAbstractButton> guard(q); emit q->toggled(checked); -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (guard && group) { emit group->buttonToggled(group->id(q), checked); if (guard && group) @@ -476,7 +478,7 @@ QAbstractButton::QAbstractButton(QWidget *parent) */ QAbstractButton::~QAbstractButton() { -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) Q_D(QAbstractButton); if (d->group) d->group->removeButton(this); @@ -623,7 +625,7 @@ void QAbstractButton::setChecked(bool checked) if (!checked && d->queryCheckedButton() == this) { // the checked button of an exclusive or autoexclusive group cannot be unchecked -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) if (d->group ? d->group->d_func()->exclusive : d->autoExclusive) return; if (d->group) @@ -798,7 +800,7 @@ bool QAbstractButton::autoExclusive() const return d->autoExclusive; } -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) /*! Returns the group that this button belongs to. @@ -812,7 +814,7 @@ QButtonGroup *QAbstractButton::group() const Q_D(const QAbstractButton); return d->group; } -#endif // QT_NO_BUTTONGROUP +#endif // QT_CONFIG(buttongroup) /*! Performs an animated click: the button is pressed immediately, and @@ -1070,7 +1072,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e) #endif QWidget *pw = parentWidget(); if (d->autoExclusive -#ifndef QT_NO_BUTTONGROUP +#if QT_CONFIG(buttongroup) || d->group #endif #if QT_CONFIG(itemviews) |