aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-09-25 22:27:31 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-10-12 12:32:32 +0000
commit97cd1782744f45f1c9c249bd5549dd7f1ea53b3c (patch)
tree6f9e084bf05ec66f1020ec2b16d6331d5e8e5424
parent57f877bd984a0befb57626421a6e36ed373056ce (diff)
Merge Checkable into AbstractButton
Change-Id: I2cb3a244a9a084c67a1e3d1d9bc1c955c8cf0722 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-customize.qdoc6
-rw-r--r--src/templates/qquickabstractbutton.cpp100
-rw-r--r--src/templates/qquickabstractbutton_p.h21
-rw-r--r--src/templates/qquickabstractbutton_p_p.h4
-rw-r--r--src/templates/qquickcheckable.cpp158
-rw-r--r--src/templates/qquickcheckable_p.h99
-rw-r--r--src/templates/qquickcheckable_p_p.h69
-rw-r--r--src/templates/qquickcheckbox.cpp5
-rw-r--r--src/templates/qquickcheckbox_p.h4
-rw-r--r--src/templates/qquickradiobutton.cpp5
-rw-r--r--src/templates/qquickradiobutton_p.h4
-rw-r--r--src/templates/qquickswitch.cpp13
-rw-r--r--src/templates/qquickswitch_p.h4
-rw-r--r--src/templates/qquicktabbutton.cpp4
-rw-r--r--src/templates/qquicktabbutton_p.h4
-rw-r--r--src/templates/templates.pri3
16 files changed, 150 insertions, 353 deletions
diff --git a/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc b/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
index 5f48f418..c303d5a2 100644
--- a/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
+++ b/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
@@ -75,7 +75,7 @@
\section1 Customizing CheckBox
CheckBox consists of three visual items: \l {Control::background}{background},
- \l {AbstractButton::label}{label} and \l {Checkable::indicator}{indicator}.
+ \l {AbstractButton::label}{label} and \l {AbstractButton::indicator}{indicator}.
\section3 Background
@@ -186,7 +186,7 @@
\section1 Customizing RadioButton
RadioButton consists of three visual items: \l {Control::background}{background},
- \l {AbstractButton::label}{label} and \l {Checkable::indicator}{indicator}.
+ \l {AbstractButton::label}{label} and \l {AbstractButton::indicator}{indicator}.
\section3 Background
@@ -275,7 +275,7 @@
\section1 Customizing Switch
Switch consists of three visual items: \l {Control::background}{background},
- \l {AbstractButton::label}{label} and \l {Checkable::indicator}{indicator}.
+ \l {AbstractButton::label}{label} and \l {AbstractButton::indicator}{indicator}.
\section3 Background
diff --git a/src/templates/qquickabstractbutton.cpp b/src/templates/qquickabstractbutton.cpp
index 9906f743..8f3e8af8 100644
--- a/src/templates/qquickabstractbutton.cpp
+++ b/src/templates/qquickabstractbutton.cpp
@@ -94,7 +94,9 @@ QT_BEGIN_NAMESPACE
and y position of the release of the click, and whether the click was held.
*/
-QQuickAbstractButtonPrivate::QQuickAbstractButtonPrivate() : pressed(false), label(Q_NULLPTR)
+QQuickAbstractButtonPrivate::QQuickAbstractButtonPrivate() :
+ pressed(false), checked(false), checkable(false), exclusive(false),
+ label(Q_NULLPTR), indicator(Q_NULLPTR)
{
}
@@ -162,6 +164,86 @@ void QQuickAbstractButton::setPressed(bool isPressed)
}
/*!
+ \qmlproperty bool Qt.labs.controls::AbstractButton::checked
+
+ This property holds whether the button is checked.
+*/
+bool QQuickAbstractButton::isChecked() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->checked;
+}
+
+void QQuickAbstractButton::setChecked(bool checked)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->checked != checked) {
+ d->checked = checked;
+ setAccessibleProperty("checked", checked);
+ emit checkedChanged();
+ }
+}
+
+/*!
+ \qmlproperty bool Qt.labs.controls::AbstractButton::checkable
+
+ This property holds whether the button is checkable.
+*/
+bool QQuickAbstractButton::isCheckable() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->checkable;
+}
+
+void QQuickAbstractButton::setCheckable(bool checkable)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->checkable != checkable) {
+ d->checkable = checkable;
+ setAccessibleProperty("checkable", checkable);
+ emit checkableChanged();
+ }
+}
+
+bool QQuickAbstractButton::isExclusive() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->exclusive;
+}
+
+void QQuickAbstractButton::setExclusive(bool exclusive)
+{
+ Q_D(QQuickAbstractButton);
+ d->exclusive = exclusive;
+}
+
+/*!
+ \qmlproperty Item Qt.labs.controls::AbstractButton::indicator
+
+ This property holds the indicator item.
+*/
+QQuickItem *QQuickAbstractButton::indicator() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->indicator;
+}
+
+void QQuickAbstractButton::setIndicator(QQuickItem *indicator)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->indicator != indicator) {
+ delete d->indicator;
+ d->indicator = indicator;
+ if (indicator) {
+ if (!indicator->parentItem())
+ indicator->setParentItem(this);
+ indicator->setAcceptedMouseButtons(Qt::LeftButton);
+ }
+ emit indicatorChanged();
+ }
+}
+
+/*!
\qmlproperty Item Qt.labs.controls::AbstractButton::label
This property holds the label item.
@@ -186,6 +268,17 @@ void QQuickAbstractButton::setLabel(QQuickItem *label)
}
}
+/*!
+ \qmlmethod void Qt.labs.controls::Button::toggle()
+
+ Toggles the checked state of the button.
+*/
+void QQuickAbstractButton::toggle()
+{
+ Q_D(QQuickAbstractButton);
+ setChecked(!d->checked);
+}
+
void QQuickAbstractButton::focusOutEvent(QFocusEvent *event)
{
Q_D(QQuickAbstractButton);
@@ -210,6 +303,7 @@ void QQuickAbstractButton::keyPressEvent(QKeyEvent *event)
void QQuickAbstractButton::keyReleaseEvent(QKeyEvent *event)
{
+ Q_D(QQuickAbstractButton);
QQuickControl::keyReleaseEvent(event);
if (event->key() == Qt::Key_Space) {
setPressed(false);
@@ -218,6 +312,8 @@ void QQuickAbstractButton::keyReleaseEvent(QKeyEvent *event)
emit released(&mre);
QQuickMouseEvent mce(width() / 2, height() / 2, Qt::NoButton, Qt::NoButton, event->modifiers(), true /* isClick */);
emit clicked(&mce);
+ if (d->checkable)
+ setChecked(d->exclusive || !d->checked);
event->setAccepted(mre.isAccepted() || mce.isAccepted());
}
}
@@ -254,6 +350,8 @@ void QQuickAbstractButton::mouseReleaseEvent(QMouseEvent *event)
} else {
emit canceled();
}
+ if (d->checkable && contains(event->pos()))
+ setChecked(d->exclusive || !d->checked);
}
void QQuickAbstractButton::mouseDoubleClickEvent(QMouseEvent *event)
diff --git a/src/templates/qquickabstractbutton_p.h b/src/templates/qquickabstractbutton_p.h
index e1ee002c..80d8be4f 100644
--- a/src/templates/qquickabstractbutton_p.h
+++ b/src/templates/qquickabstractbutton_p.h
@@ -60,6 +60,9 @@ class Q_LABSTEMPLATES_EXPORT QQuickAbstractButton : public QQuickControl
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged FINAL)
+ Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL)
+ Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
Q_PROPERTY(QQuickItem *label READ label WRITE setLabel NOTIFY labelChanged FINAL)
public:
@@ -71,9 +74,24 @@ public:
bool isPressed() const;
void setPressed(bool pressed);
+ bool isChecked() const;
+ void setChecked(bool checked);
+
+ bool isCheckable() const;
+ void setCheckable(bool checkable);
+
+ bool isExclusive() const;
+ void setExclusive(bool exclusive);
+
+ QQuickItem *indicator() const;
+ void setIndicator(QQuickItem *indicator);
+
QQuickItem *label() const;
void setLabel(QQuickItem *label);
+public Q_SLOTS:
+ void toggle();
+
Q_SIGNALS:
void pressed(QQuickMouseEvent *mouse);
void released(QQuickMouseEvent *mouse);
@@ -82,6 +100,9 @@ Q_SIGNALS:
void doubleClicked(QQuickMouseEvent *mouse);
void textChanged();
void pressedChanged();
+ void checkedChanged();
+ void checkableChanged();
+ void indicatorChanged();
void labelChanged();
protected:
diff --git a/src/templates/qquickabstractbutton_p_p.h b/src/templates/qquickabstractbutton_p_p.h
index f0e6561d..e8def77d 100644
--- a/src/templates/qquickabstractbutton_p_p.h
+++ b/src/templates/qquickabstractbutton_p_p.h
@@ -61,7 +61,11 @@ public:
QString text;
bool pressed;
+ bool checked;
+ bool checkable;
+ bool exclusive;
QQuickItem *label;
+ QQuickItem *indicator;
};
Q_DECLARE_TYPEINFO(QQuickAbstractButtonPrivate, Q_COMPLEX_TYPE);
diff --git a/src/templates/qquickcheckable.cpp b/src/templates/qquickcheckable.cpp
deleted file mode 100644
index 7465c901..00000000
--- a/src/templates/qquickcheckable.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickcheckable_p.h"
-#include "qquickcheckable_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Checkable
- \inherits AbstractButton
- \instantiates QQuickCheckable
- \inqmlmodule Qt.labs.controls
- \qmlabstract
- \internal
-*/
-
-QQuickCheckablePrivate::QQuickCheckablePrivate() :
- checked(false), exclusive(false), indicator(Q_NULLPTR)
-{
-}
-
-QQuickCheckable::QQuickCheckable(QQuickItem *parent) :
- QQuickAbstractButton(*(new QQuickCheckablePrivate), parent)
-{
-}
-
-QQuickCheckable::QQuickCheckable(QQuickCheckablePrivate &dd, QQuickItem *parent) :
- QQuickAbstractButton(dd, parent)
-{
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::Checkable::checked
-
- This property holds whether the control is checked.
-*/
-bool QQuickCheckable::isChecked() const
-{
- Q_D(const QQuickCheckable);
- return d->checked;
-}
-
-void QQuickCheckable::setChecked(bool checked)
-{
- Q_D(QQuickCheckable);
- if (d->checked != checked) {
- d->checked = checked;
- setAccessibleProperty("checked", checked);
- emit checkedChanged();
- }
-}
-
-bool QQuickCheckable::isExclusive() const
-{
- Q_D(const QQuickCheckable);
- return d->exclusive;
-}
-
-void QQuickCheckable::setExclusive(bool exclusive)
-{
- Q_D(QQuickCheckable);
- d->exclusive = exclusive;
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::Checkable::indicator
-
- This property holds the indicator item.
-*/
-QQuickItem *QQuickCheckable::indicator() const
-{
- Q_D(const QQuickCheckable);
- return d->indicator;
-}
-
-void QQuickCheckable::setIndicator(QQuickItem *indicator)
-{
- Q_D(QQuickCheckable);
- if (d->indicator != indicator) {
- delete d->indicator;
- d->indicator = indicator;
- if (indicator) {
- if (!indicator->parentItem())
- indicator->setParentItem(this);
- indicator->setAcceptedMouseButtons(Qt::LeftButton);
- }
- emit indicatorChanged();
- }
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Checkable::toggle()
-
- Toggles the checked state of the control.
-*/
-void QQuickCheckable::toggle()
-{
- Q_D(QQuickCheckable);
- setChecked(!d->checked);
-}
-
-void QQuickCheckable::keyReleaseEvent(QKeyEvent *event)
-{
- Q_D(QQuickCheckable);
- QQuickAbstractButton::keyReleaseEvent(event);
- if (event->key() == Qt::Key_Space)
- setChecked(d->exclusive || !d->checked);
-}
-
-void QQuickCheckable::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickCheckable);
- QQuickAbstractButton::mouseReleaseEvent(event);
- if (contains(event->pos()))
- setChecked(d->exclusive || !d->checked);
-}
-
-void QQuickCheckable::classBegin()
-{
- QQuickAbstractButton::classBegin();
- setAccessibleProperty("checkable", true);
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickcheckable_p.h b/src/templates/qquickcheckable_p.h
deleted file mode 100644
index da5faacf..00000000
--- a/src/templates/qquickcheckable_p.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKCHECKABLE_P_H
-#define QQUICKCHECKABLE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickCheckablePrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickCheckable : public QQuickAbstractButton
-{
- Q_OBJECT
- Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged FINAL)
- Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
-
-public:
- explicit QQuickCheckable(QQuickItem *parent = Q_NULLPTR);
-
- bool isChecked() const;
- void setChecked(bool checked);
-
- bool isExclusive() const;
- void setExclusive(bool exclusive);
-
- QQuickItem *indicator() const;
- void setIndicator(QQuickItem *indicator);
-
-public Q_SLOTS:
- void toggle();
-
-Q_SIGNALS:
- void checkedChanged();
- void indicatorChanged();
-
-protected:
- QQuickCheckable(QQuickCheckablePrivate &dd, QQuickItem *parent);
-
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
-
- void classBegin() Q_DECL_OVERRIDE;
-
-private:
- Q_DISABLE_COPY(QQuickCheckable)
- Q_DECLARE_PRIVATE(QQuickCheckable)
-};
-
-Q_DECLARE_TYPEINFO(QQuickCheckable, Q_COMPLEX_TYPE);
-
-QT_END_NAMESPACE
-
-#endif // QQUICKCHECKABLE_P_H
diff --git a/src/templates/qquickcheckable_p_p.h b/src/templates/qquickcheckable_p_p.h
deleted file mode 100644
index 57aa0db2..00000000
--- a/src/templates/qquickcheckable_p_p.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKCHECKABLE_P_P_H
-#define QQUICKCHECKABLE_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickabstractbutton_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickCheckablePrivate : public QQuickAbstractButtonPrivate
-{
-public:
- QQuickCheckablePrivate();
-
- bool checked;
- bool exclusive;
- QQuickItem *indicator;
-};
-
-Q_DECLARE_TYPEINFO(QQuickCheckablePrivate, Q_COMPLEX_TYPE);
-
-QT_END_NAMESPACE
-
-#endif // QQUICKCHECKABLE_P_P_H
diff --git a/src/templates/qquickcheckbox.cpp b/src/templates/qquickcheckbox.cpp
index 84f7076e..1ced357a 100644
--- a/src/templates/qquickcheckbox.cpp
+++ b/src/templates/qquickcheckbox.cpp
@@ -40,7 +40,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype CheckBox
- \inherits Checkable
+ \inherits AbstractButton
\instantiates QQuickCheckBox
\inqmlmodule Qt.labs.controls
\ingroup buttons
@@ -81,8 +81,9 @@ QT_BEGIN_NAMESPACE
*/
QQuickCheckBox::QQuickCheckBox(QQuickItem *parent) :
- QQuickCheckable(parent)
+ QQuickAbstractButton(parent)
{
+ setCheckable(true);
setAccessibleRole(0x0000002C); //QAccessible::CheckBox
}
diff --git a/src/templates/qquickcheckbox_p.h b/src/templates/qquickcheckbox_p.h
index e192a237..c0ff4c44 100644
--- a/src/templates/qquickcheckbox_p.h
+++ b/src/templates/qquickcheckbox_p.h
@@ -48,11 +48,11 @@
// We mean it.
//
-#include <QtLabsTemplates/private/qquickcheckable_p.h>
+#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
QT_BEGIN_NAMESPACE
-class Q_LABSTEMPLATES_EXPORT QQuickCheckBox : public QQuickCheckable
+class Q_LABSTEMPLATES_EXPORT QQuickCheckBox : public QQuickAbstractButton
{
Q_OBJECT
diff --git a/src/templates/qquickradiobutton.cpp b/src/templates/qquickradiobutton.cpp
index 70aed7e2..758cd0fb 100644
--- a/src/templates/qquickradiobutton.cpp
+++ b/src/templates/qquickradiobutton.cpp
@@ -40,7 +40,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype RadioButton
- \inherits Checkable
+ \inherits AbstractButton
\instantiates QQuickRadioButton
\inqmlmodule Qt.labs.controls
\ingroup buttons
@@ -84,8 +84,9 @@ QT_BEGIN_NAMESPACE
*/
QQuickRadioButton::QQuickRadioButton(QQuickItem *parent) :
- QQuickCheckable(parent)
+ QQuickAbstractButton(parent)
{
+ setCheckable(true);
setExclusive(true);
setAccessibleRole(0x0000002D); //QAccessible::RadioButton
}
diff --git a/src/templates/qquickradiobutton_p.h b/src/templates/qquickradiobutton_p.h
index bcff6225..ed55c0f6 100644
--- a/src/templates/qquickradiobutton_p.h
+++ b/src/templates/qquickradiobutton_p.h
@@ -48,11 +48,11 @@
// We mean it.
//
-#include <QtLabsTemplates/private/qquickcheckable_p.h>
+#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
QT_BEGIN_NAMESPACE
-class Q_LABSTEMPLATES_EXPORT QQuickRadioButton : public QQuickCheckable
+class Q_LABSTEMPLATES_EXPORT QQuickRadioButton : public QQuickAbstractButton
{
Q_OBJECT
diff --git a/src/templates/qquickswitch.cpp b/src/templates/qquickswitch.cpp
index 7f05871c..dc66f063 100644
--- a/src/templates/qquickswitch.cpp
+++ b/src/templates/qquickswitch.cpp
@@ -35,7 +35,7 @@
****************************************************************************/
#include "qquickswitch_p.h"
-#include "qquickcheckable_p_p.h"
+#include "qquickabstractbutton_p_p.h"
#include <QtQuick/private/qquickwindow_p.h>
#include <QtQuick/private/qquickevents_p_p.h>
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Switch
- \inherits Checkable
+ \inherits AbstractButton
\instantiates QQuickSwitch
\inqmlmodule Qt.labs.controls
\ingroup buttons
@@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE
\sa {Customizing Switch}
*/
-class QQuickSwitchPrivate : public QQuickCheckablePrivate
+class QQuickSwitchPrivate : public QQuickAbstractButtonPrivate
{
Q_DECLARE_PUBLIC(QQuickSwitch)
@@ -100,10 +100,11 @@ void QQuickSwitchPrivate::updatePosition()
}
QQuickSwitch::QQuickSwitch(QQuickItem *parent) :
- QQuickCheckable(*(new QQuickSwitchPrivate), parent)
+ QQuickAbstractButton(*(new QQuickSwitchPrivate), parent)
{
+ setCheckable(true);
setFiltersChildMouseEvents(true);
- QObjectPrivate::connect(this, &QQuickCheckable::checkedChanged, d_func(), &QQuickSwitchPrivate::updatePosition);
+ QObjectPrivate::connect(this, &QQuickAbstractButton::checkedChanged, d_func(), &QQuickSwitchPrivate::updatePosition);
setAccessibleRole(0x0000002B); //QAccessible::Button
}
@@ -160,7 +161,7 @@ qreal QQuickSwitch::visualPosition() const
void QQuickSwitch::mirrorChange()
{
- QQuickCheckable::mirrorChange();
+ QQuickAbstractButton::mirrorChange();
emit visualPositionChanged();
}
diff --git a/src/templates/qquickswitch_p.h b/src/templates/qquickswitch_p.h
index bb831bfb..8e822b73 100644
--- a/src/templates/qquickswitch_p.h
+++ b/src/templates/qquickswitch_p.h
@@ -48,13 +48,13 @@
// We mean it.
//
-#include <QtLabsTemplates/private/qquickcheckable_p.h>
+#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
QT_BEGIN_NAMESPACE
class QQuickSwitchPrivate;
-class Q_LABSTEMPLATES_EXPORT QQuickSwitch : public QQuickCheckable
+class Q_LABSTEMPLATES_EXPORT QQuickSwitch : public QQuickAbstractButton
{
Q_OBJECT
Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
diff --git a/src/templates/qquicktabbutton.cpp b/src/templates/qquicktabbutton.cpp
index b6254c04..65f39a66 100644
--- a/src/templates/qquicktabbutton.cpp
+++ b/src/templates/qquicktabbutton.cpp
@@ -40,7 +40,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype TabButton
- \inherits Checkable
+ \inherits AbstractButton
\instantiates QQuickTabButton
\inqmlmodule Qt.labs.controls
\ingroup tabs
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
*/
QQuickTabButton::QQuickTabButton(QQuickItem *parent) :
- QQuickCheckable(parent)
+ QQuickAbstractButton(parent)
{
setExclusive(true);
setAccessibleRole(0x00000025); //QAccessible::PageTab
diff --git a/src/templates/qquicktabbutton_p.h b/src/templates/qquicktabbutton_p.h
index b4075749..3dfa360f 100644
--- a/src/templates/qquicktabbutton_p.h
+++ b/src/templates/qquicktabbutton_p.h
@@ -48,11 +48,11 @@
// We mean it.
//
-#include <QtLabsTemplates/private/qquickcheckable_p.h>
+#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
QT_BEGIN_NAMESPACE
-class Q_LABSTEMPLATES_EXPORT QQuickTabButton : public QQuickCheckable
+class Q_LABSTEMPLATES_EXPORT QQuickTabButton : public QQuickAbstractButton
{
Q_OBJECT
diff --git a/src/templates/templates.pri b/src/templates/templates.pri
index 572fa69c..9ba8bbd4 100644
--- a/src/templates/templates.pri
+++ b/src/templates/templates.pri
@@ -6,8 +6,6 @@ HEADERS += \
$$PWD/qquickapplicationwindow_p.h \
$$PWD/qquickbusyindicator_p.h \
$$PWD/qquickbutton_p.h \
- $$PWD/qquickcheckable_p.h \
- $$PWD/qquickcheckable_p_p.h \
$$PWD/qquickcheckbox_p.h \
$$PWD/qquickcontainer_p.h \
$$PWD/qquickcontainer_p_p.h \
@@ -47,7 +45,6 @@ SOURCES += \
$$PWD/qquickapplicationwindow.cpp \
$$PWD/qquickbusyindicator.cpp \
$$PWD/qquickbutton.cpp \
- $$PWD/qquickcheckable.cpp \
$$PWD/qquickcheckbox.cpp \
$$PWD/qquickcontainer.cpp \
$$PWD/qquickcontrol.cpp \