Convert features.buttongroup to QT_[REQUIRE_]CONFIG

Change-Id: Id5df397d0aa4cad7f586ef7303902d8ee7b88f1d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Stephan Binner 2017-08-27 19:12:51 +02:00
parent 6380729c48
commit 66d9a2b997
9 changed files with 37 additions and 36 deletions

View File

@ -38,6 +38,7 @@
"label": "CUPS job control widget", "label": "CUPS job control widget",
"section": "Widgets", "section": "Widgets",
"condition": [ "condition": [
"features.buttongroup",
"features.calendarwidget", "features.calendarwidget",
"features.checkbox", "features.checkbox",
"features.combobox", "features.combobox",

View File

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

View File

@ -108,7 +108,7 @@ public:
void setAutoExclusive(bool); void setAutoExclusive(bool);
bool autoExclusive() const; bool autoExclusive() const;
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
QButtonGroup *group() const; QButtonGroup *group() const;
#endif #endif

View File

@ -80,7 +80,7 @@ public:
uint blockRefresh :1; uint blockRefresh :1;
uint pressed : 1; uint pressed : 1;
#ifndef QT_NO_BUTTONGROUP #if QT_CONFIG(buttongroup)
QButtonGroup* group; QButtonGroup* group;
#endif #endif
QBasicTimer repeatTimer; QBasicTimer repeatTimer;

View File

@ -39,8 +39,6 @@
#include "private/qbuttongroup_p.h" #include "private/qbuttongroup_p.h"
#ifndef QT_NO_BUTTONGROUP
#include "private/qabstractbutton_p.h" #include "private/qabstractbutton_p.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -362,5 +360,3 @@ int QButtonGroup::checkedId() const
QT_END_NAMESPACE QT_END_NAMESPACE
#include "moc_qbuttongroup.cpp" #include "moc_qbuttongroup.cpp"
#endif // QT_NO_BUTTONGROUP

View File

@ -43,11 +43,10 @@
#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h> #include <QtCore/qobject.h>
QT_REQUIRE_CONFIG(buttongroup);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_BUTTONGROUP
class QAbstractButton; class QAbstractButton;
class QAbstractButtonPrivate; class QAbstractButtonPrivate;
class QButtonGroupPrivate; class QButtonGroupPrivate;
@ -94,8 +93,6 @@ private:
friend class QAbstractButtonPrivate; friend class QAbstractButtonPrivate;
}; };
#endif // QT_NO_BUTTONGROUP
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBUTTONGROUP_H #endif // QBUTTONGROUP_H

View File

@ -54,14 +54,14 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtWidgets/qbuttongroup.h> #include <QtWidgets/qbuttongroup.h>
#ifndef QT_NO_BUTTONGROUP
#include <QtCore/private/qobject_p.h> #include <QtCore/private/qobject_p.h>
#include <QtCore/qlist.h> #include <QtCore/qlist.h>
#include <QtCore/qpointer.h> #include <QtCore/qpointer.h>
#include <QtCore/qhash.h> #include <QtCore/qhash.h>
QT_REQUIRE_CONFIG(buttongroup);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QButtonGroupPrivate: public QObjectPrivate class QButtonGroupPrivate: public QObjectPrivate
@ -81,6 +81,4 @@ public:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_BUTTONGROUP
#endif // QBUTTONGROUP_P_H #endif // QBUTTONGROUP_P_H

View File

@ -40,7 +40,9 @@
#include "qradiobutton.h" #include "qradiobutton.h"
#include "qapplication.h" #include "qapplication.h"
#include "qbitmap.h" #include "qbitmap.h"
#if QT_CONFIG(buttongroup)
#include "qbuttongroup.h" #include "qbuttongroup.h"
#endif
#include "qstylepainter.h" #include "qstylepainter.h"
#include "qstyle.h" #include "qstyle.h"
#include "qstyleoption.h" #include "qstyleoption.h"

View File

@ -1,8 +1,6 @@
# Qt widgets module # Qt widgets module
HEADERS += \ HEADERS += \
widgets/qbuttongroup.h \
widgets/qbuttongroup_p.h \
widgets/qabstractspinbox.h \ widgets/qabstractspinbox.h \
widgets/qabstractspinbox_p.h \ widgets/qabstractspinbox_p.h \
widgets/qframe.h \ widgets/qframe.h \
@ -36,7 +34,6 @@ HEADERS += \
widgets/qplaintextedit_p.h widgets/qplaintextedit_p.h
SOURCES += \ SOURCES += \
widgets/qbuttongroup.cpp \
widgets/qabstractspinbox.cpp \ widgets/qabstractspinbox.cpp \
widgets/qframe.cpp \ widgets/qframe.cpp \
widgets/qlineedit_p.cpp \ widgets/qlineedit_p.cpp \
@ -78,6 +75,14 @@ qtConfig(abstractslider) {
widgets/qabstractslider.cpp widgets/qabstractslider.cpp
} }
qtConfig(buttongroup) {
HEADERS += \
widgets/qbuttongroup.h \
widgets/qbuttongroup_p.h
SOURCES += widgets/qbuttongroup.cpp
}
qtConfig(calendarwidget) { qtConfig(calendarwidget) {
HEADERS += widgets/qcalendarwidget.h HEADERS += widgets/qcalendarwidget.h
SOURCES += widgets/qcalendarwidget.cpp SOURCES += widgets/qcalendarwidget.cpp