aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates/qquickcheckbox.cpp
diff options
context:
space:
mode:
authorSami Shalayel <sami.shalayel@qt.io>2023-10-16 10:15:07 +0200
committerSami Shalayel <sami.shalayel@qt.io>2023-10-23 08:10:26 +0200
commit8ba3d83f28a5d4c84a13df001d59cbcb78ba0f2f (patch)
tree23757b1923183fddcb5d172c39ad6bc6d7a92c9a /src/quicktemplates/qquickcheckbox.cpp
parent89a7868f7b0b71a6c94063829126b7542ee88cd1 (diff)
QQuickCheckBox: make nextCheckState property non-private
QQuickCheckBox has private properties but its private class QQuickCheckBoxPrivate is defined in a .cpp instead of a header. This causes problems with qmltc because it needs to include the header of the private class when it sees private properties. Replace the private property nextCheckState with a non-private one, as nextCheckState does not need to be private (QJSValue is public API). Amends 043e3d24f9306c18af97156ec613bb64a9dc0d91 who exposed this property to QML. Add a file with a CheckBox in the qmltc tests to test if qmltc can properly compile a CheckBox now. Note: call the getter of nextCheckState "getNextCheckState" to not shadow the "nextCheckState" virtual method from the base class. Fixes: QTBUG-118091 Pick-to: 6.5 6.6 Change-Id: I771aeb8a4f388d7068ec78eba968746c8e184f31 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates/qquickcheckbox.cpp')
-rw-r--r--src/quicktemplates/qquickcheckbox.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/quicktemplates/qquickcheckbox.cpp b/src/quicktemplates/qquickcheckbox.cpp
index 21038ccdb9..539e89f2d0 100644
--- a/src/quicktemplates/qquickcheckbox.cpp
+++ b/src/quicktemplates/qquickcheckbox.cpp
@@ -69,8 +69,6 @@ class QQuickCheckBoxPrivate : public QQuickAbstractButtonPrivate
Q_DECLARE_PUBLIC(QQuickCheckBox)
public:
- void setNextCheckState(const QJSValue &callback);
-
QPalette defaultPalette() const override { return QQuickTheme::palette(QQuickTheme::CheckBox); }
bool tristate = false;
@@ -78,13 +76,6 @@ public:
QJSValue nextCheckState;
};
-void QQuickCheckBoxPrivate::setNextCheckState(const QJSValue &callback)
-{
- Q_Q(QQuickCheckBox);
- nextCheckState = callback;
- emit q->nextCheckStateChanged();
-}
-
QQuickCheckBox::QQuickCheckBox(QQuickItem *parent)
: QQuickAbstractButton(*(new QQuickCheckBoxPrivate), parent)
{
@@ -150,6 +141,19 @@ void QQuickCheckBox::setCheckState(Qt::CheckState state)
emit checkedChanged();
}
+QJSValue QQuickCheckBox::getNextCheckState() const
+{
+ Q_D(const QQuickCheckBox);
+ return d->nextCheckState;
+}
+
+void QQuickCheckBox::setNextCheckState(const QJSValue &callback)
+{
+ Q_D(QQuickCheckBox);
+ d->nextCheckState = callback;
+ emit nextCheckStateChanged();
+}
+
QFont QQuickCheckBox::defaultFont() const
{
return QQuickTheme::font(QQuickTheme::CheckBox);