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",
"section": "Widgets",
"condition": [
"features.buttongroup",
"features.calendarwidget",
"features.checkbox",
"features.combobox",

View File

@ -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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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