Add feature.checkbox

Change-Id: Ib387390b796c3cab6de4ce94e0d217280a300df8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
Stephan Binner 2017-03-02 20:16:58 +01:00
parent 5c62fd9a2e
commit 0884e42410
9 changed files with 52 additions and 7 deletions

View File

@ -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",

View File

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

View File

@ -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": {

View File

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

View File

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

View File

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

View File

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

View File

@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractbutton.h>
QT_REQUIRE_CONFIG(checkbox);
QT_BEGIN_NAMESPACE

View File

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