summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephan Binner <stephan.binner@basyskom.com>2017-08-27 19:12:51 +0200
committerStephan Binner <stephan.binner@basyskom.com>2017-09-04 07:53:34 +0000
commit66d9a2b9971366c906aea1e9e0ed4e600384a4aa (patch)
tree1b91926e0b477fcf388b427f1053828eb4eb305d /src
parent6380729c48b0c9bf4ef109f77ffd8a65b365165d (diff)
Convert features.buttongroup to QT_[REQUIRE_]CONFIG
Change-Id: Id5df397d0aa4cad7f586ef7303902d8ee7b88f1d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/printsupport/configure.json1
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp38
-rw-r--r--src/widgets/widgets/qabstractbutton.h2
-rw-r--r--src/widgets/widgets/qabstractbutton_p.h2
-rw-r--r--src/widgets/widgets/qbuttongroup.cpp4
-rw-r--r--src/widgets/widgets/qbuttongroup.h7
-rw-r--r--src/widgets/widgets/qbuttongroup_p.h6
-rw-r--r--src/widgets/widgets/qradiobutton.cpp2
-rw-r--r--src/widgets/widgets/widgets.pri11
9 files changed, 37 insertions, 36 deletions
diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json
index e8cec22c09..abc704fa18 100644
--- a/src/printsupport/configure.json
+++ b/src/printsupport/configure.json
@@ -38,6 +38,7 @@
"label": "CUPS job control widget",
"section": "Widgets",
"condition": [
+ "features.buttongroup",
"features.calendarwidget",
"features.checkbox",
"features.combobox",
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)
diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h
index 4e438bd851..01dbf4e92d 100644
--- a/src/widgets/widgets/qabstractbutton.h
+++ b/src/widgets/widgets/qabstractbutton.h
@@ -108,7 +108,7 @@ public:
void setAutoExclusive(bool);
bool autoExclusive() const;
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
QButtonGroup *group() const;
#endif
diff --git a/src/widgets/widgets/qabstractbutton_p.h b/src/widgets/widgets/qabstractbutton_p.h
index 8f67c0d367..39e2e399a7 100644
--- a/src/widgets/widgets/qabstractbutton_p.h
+++ b/src/widgets/widgets/qabstractbutton_p.h
@@ -80,7 +80,7 @@ public:
uint blockRefresh :1;
uint pressed : 1;
-#ifndef QT_NO_BUTTONGROUP
+#if QT_CONFIG(buttongroup)
QButtonGroup* group;
#endif
QBasicTimer repeatTimer;
diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp
index ef73fd1b67..fa1ccd347f 100644
--- a/src/widgets/widgets/qbuttongroup.cpp
+++ b/src/widgets/widgets/qbuttongroup.cpp
@@ -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
diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h
index ff931b1ee0..1b4f2377ae 100644
--- a/src/widgets/widgets/qbuttongroup.h
+++ b/src/widgets/widgets/qbuttongroup.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qobject.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(buttongroup);
-#ifndef QT_NO_BUTTONGROUP
+QT_BEGIN_NAMESPACE
class QAbstractButton;
class QAbstractButtonPrivate;
@@ -94,8 +93,6 @@ private:
friend class QAbstractButtonPrivate;
};
-#endif // QT_NO_BUTTONGROUP
-
QT_END_NAMESPACE
#endif // QBUTTONGROUP_H
diff --git a/src/widgets/widgets/qbuttongroup_p.h b/src/widgets/widgets/qbuttongroup_p.h
index 93f3f4e0ec..148f572373 100644
--- a/src/widgets/widgets/qbuttongroup_p.h
+++ b/src/widgets/widgets/qbuttongroup_p.h
@@ -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
diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp
index ac711d34c7..dfba32d3e8 100644
--- a/src/widgets/widgets/qradiobutton.cpp
+++ b/src/widgets/widgets/qradiobutton.cpp
@@ -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"
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index c531ca84cc..5737af41c3 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -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