summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephan Binner <stephan.binner@basyskom.com>2017-03-02 20:16:58 +0100
committerStephan Binner <stephan.binner@basyskom.com>2017-03-06 20:34:58 +0000
commit0884e424106962785b8f2e6742d3590fb3919a97 (patch)
treeb722990083249a1d222cd03dd5e36022bd40acbc /src
parent5c62fd9a2e01047074b3594153e5652794ac6a36 (diff)
Add feature.checkbox
Change-Id: Ib387390b796c3cab6de4ce94e0d217280a300df8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/printsupport/configure.json10
-rw-r--r--src/widgets/accessible/simplewidgets.cpp8
-rw-r--r--src/widgets/configure.json19
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm3
-rw-r--r--src/widgets/styles/qmacstyle_mac_p_p.h2
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p_p.h1
-rw-r--r--src/widgets/widgets/qcheckbox.h2
-rw-r--r--src/widgets/widgets/widgets.pri10
9 files changed, 52 insertions, 7 deletions
diff --git a/src/printsupport/configure.json b/src/printsupport/configure.json
index 002f7f84cb..93d345840f 100644
--- a/src/printsupport/configure.json
+++ b/src/printsupport/configure.json
@@ -34,7 +34,14 @@
"cupsjobwidget": {
"label": "CUPS job control widget",
"section": "Widgets",
- "condition": "features.cups && features.calendarwidget && features.datetimeedit && features.groupbox && features.combobox",
+ "condition": [
+ "features.calendarwidget",
+ "features.checkbox",
+ "features.combobox",
+ "features.cups",
+ "features.datetimeedit",
+ "features.groupbox"
+ ],
"output": [ "privateFeature", "feature" ]
},
"printer": {
@@ -57,6 +64,7 @@
"section": "Dialogs",
"condition": [
"features.buttongroup",
+ "features.checkbox",
"features.combobox",
"features.datetimeedit",
"features.dialogbuttonbox",
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index 99b22a735e..97d6f90c0e 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -40,7 +40,9 @@
#include "simplewidgets_p.h"
#include <qabstractbutton.h>
+#if QT_CONFIG(checkbox)
#include <qcheckbox.h>
+#endif
#include <qpushbutton.h>
#include <qprogressbar.h>
#include <qstatusbar.h>
@@ -140,13 +142,17 @@ QAccessible::State QAccessibleButton::state() const
QAccessible::State state = QAccessibleWidget::state();
QAbstractButton *b = button();
+#if QT_CONFIG(checkbox)
QCheckBox *cb = qobject_cast<QCheckBox *>(b);
+#endif
if (b->isCheckable())
state.checkable = true;
if (b->isChecked())
state.checked = true;
+#if QT_CONFIG(checkbox)
else if (cb && cb->checkState() == Qt::PartiallyChecked)
state.checkStateMixed = true;
+#endif
if (b->isDown())
state.pressed = true;
QPushButton *pb = qobject_cast<QPushButton*>(b);
@@ -168,12 +174,14 @@ QRect QAccessibleButton::rect() const
if (!ab->isVisible())
return QRect();
+#if QT_CONFIG(checkbox)
if (QCheckBox *cb = qobject_cast<QCheckBox *>(ab)) {
QPoint wpos = cb->mapToGlobal(QPoint(0, 0));
QStyleOptionButton opt;
cb->initStyleOption(&opt);
return cb->style()->subElementRect(QStyle::SE_CheckBoxClickRect, &opt, cb).translated(wpos);
}
+#endif
#if QT_CONFIG(radiobutton)
else if (QRadioButton *rb = qobject_cast<QRadioButton *>(ab)) {
QPoint wpos = rb->mapToGlobal(QPoint(0, 0));
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index a59f86e278..b05bf465a1 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -229,6 +229,12 @@
"condition": "features.combobox && features.stringlistmodel",
"output": [ "publicFeature", "feature" ]
},
+ "checkbox": {
+ "label": "QCheckBox(",
+ "purpose": "Provides a checkbox with a text label.",
+ "section": "Widgets",
+ "output": [ "publicFeature" ]
+ },
"toolbutton": {
"label": "QToolButton",
"purpose": "Provides quick-access buttons to commands and options.",
@@ -433,7 +439,11 @@
"label": "QMessageBox",
"purpose": "Provides message boxes displaying informative messages and simple questions.",
"section": "Dialogs",
- "condition" : "features.dialogbuttonbox && features.label",
+ "condition" : [
+ "features.checkbox",
+ "features.dialogbuttonbox",
+ "features.label"
+ ],
"output": [ "publicFeature", "feature" ]
},
"colordialog": {
@@ -470,6 +480,7 @@
"purpose": "Provides a dialog widget for selecting fonts.",
"section": "Dialogs",
"condition": [
+ "features.checkbox",
"features.combobox",
"features.dialogbuttonbox",
"features.groupbox",
@@ -504,7 +515,11 @@
"label": "QErrorMessage",
"purpose": "Provides an error message display dialog.",
"section": "Dialogs",
- "condition": "features.textedit && features.label",
+ "condition": [
+ "features.checkbox",
+ "features.textedit",
+ "features.label"
+ ],
"output": [ "publicFeature", "feature" ]
},
"wizard": {
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index e78946577c..8aace93328 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -55,7 +55,6 @@
#include <private/qpainter_p.h>
#include <qapplication.h>
#include <qbitmap.h>
-#include <qcheckbox.h>
#include <qcombobox.h>
#if QT_CONFIG(dialogbuttonbox)
#include <qdialogbuttonbox.h>
@@ -668,8 +667,10 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
ct = QStyle::CT_PushButton;
else if (qobject_cast<const QRadioButton *>(widg))
ct = QStyle::CT_RadioButton;
+#if QT_CONFIG(checkbox)
else if (qobject_cast<const QCheckBox *>(widg))
ct = QStyle::CT_CheckBox;
+#endif
#ifndef QT_NO_COMBOBOX
else if (qobject_cast<const QComboBox *>(widg))
ct = QStyle::CT_ComboBox;
diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h
index 819ac42293..063d7e7c80 100644
--- a/src/widgets/styles/qmacstyle_mac_p_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p_p.h
@@ -53,7 +53,9 @@
#include <private/qstylehelper_p.h>
#include <qapplication.h>
#include <qbitmap.h>
+#if QT_CONFIG(checkbox)
#include <qcheckbox.h>
+#endif
#include <qcombobox.h>
#if QT_CONFIG(dialogbuttonbox)
#include <qdialogbuttonbox.h>
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 3a43f146da..ba05155b74 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -62,7 +62,9 @@
#include <qscrollbar.h>
#include <qstring.h>
#include <qfile.h>
+#if QT_CONFIG(checkbox)
#include <qcheckbox.h>
+#endif
#include <qstatusbar.h>
#include <qheaderview.h>
#include <private/qwindowsstyle_p_p.h>
@@ -4740,10 +4742,12 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const
return rule.box()->spacing;
break;
case PM_CheckBoxLabelSpacing:
+#if QT_CONFIG(checkbox)
if (qobject_cast<const QCheckBox *>(w)) {
if (rule.hasBox() && rule.box()->spacing != -1)
return rule.box()->spacing;
}
+#endif
// assume group box
subRule = renderRule(w, opt, PseudoElement_GroupBoxTitle);
if (subRule.hasBox() && subRule.box()->spacing != -1)
diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h
index 038bad0c58..7173b2183c 100644
--- a/src/widgets/styles/qwindowsvistastyle_p_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p_p.h
@@ -66,7 +66,6 @@
#include <qstyleoption.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
-#include <qcheckbox.h>
#include <qlineedit.h>
#include <qgroupbox.h>
#include <qtoolbutton.h>
diff --git a/src/widgets/widgets/qcheckbox.h b/src/widgets/widgets/qcheckbox.h
index 22f26b6667..8543c4c86f 100644
--- a/src/widgets/widgets/qcheckbox.h
+++ b/src/widgets/widgets/qcheckbox.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractbutton.h>
+QT_REQUIRE_CONFIG(checkbox);
+
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index bc36105849..2d082812b6 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -10,7 +10,6 @@ HEADERS += \
widgets/qabstractspinbox.h \
widgets/qabstractspinbox_p.h \
widgets/qcalendarwidget.h \
- widgets/qcheckbox.h \
widgets/qcombobox.h \
widgets/qcombobox_p.h \
widgets/qdatetimeedit.h \
@@ -85,7 +84,6 @@ SOURCES += \
widgets/qabstractslider.cpp \
widgets/qabstractspinbox.cpp \
widgets/qcalendarwidget.cpp \
- widgets/qcheckbox.cpp \
widgets/qcombobox.cpp \
widgets/qdatetimeedit.cpp \
widgets/qdial.cpp \
@@ -136,6 +134,14 @@ SOURCES += \
widgets/qtoolbararealayout.cpp \
widgets/qplaintextedit.cpp
+qtConfig(checkbox) {
+ HEADERS += \
+ widgets/qcheckbox.h
+
+ SOURCES += \
+ widgets/qcheckbox.cpp
+}
+
qtConfig(commandlinkbutton) {
HEADERS += \
widgets/qcommandlinkbutton.h