aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-07-08 14:16:04 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-07-08 17:10:09 +0000
commitb4bd6b8afc2b2f3eaaf1912a5717a3ae175249ba (patch)
tree06f344810a45ce9c6dc3f1f2886efaccdcfd2c84
parente828b95142aa6e3adff13b308f656eef20531b00 (diff)
Add QQuickAbstractButton
Don't inherit QQuickButton directly for the checkables, so that we can add checkable, iconSource, icon (delegate item) etc. properties to Button if desired. Such properties wouldn't make sense for CheckBox, RadioButton, and Switch. Change-Id: Ic1a8d4b3ddeda67a2d49d8c87e0fe7c7d01d36f0 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r--src/controls/controls.pri4
-rw-r--r--src/controls/doc/src/qtquickcontrols2-customize.qdoc12
-rw-r--r--src/controls/qquickabstractbutton.cpp233
-rw-r--r--src/controls/qquickabstractbutton_p.h103
-rw-r--r--src/controls/qquickabstractbutton_p_p.h (renamed from src/controls/qquickbutton_p_p.h)12
-rw-r--r--src/controls/qquickbutton.cpp183
-rw-r--r--src/controls/qquickbutton_p.h36
-rw-r--r--src/controls/qquickcheckable.cpp10
-rw-r--r--src/controls/qquickcheckable_p.h4
-rw-r--r--src/controls/qquickcheckable_p_p.h4
10 files changed, 367 insertions, 234 deletions
diff --git a/src/controls/controls.pri b/src/controls/controls.pri
index 743f2ee9..a86adb02 100644
--- a/src/controls/controls.pri
+++ b/src/controls/controls.pri
@@ -1,10 +1,11 @@
INCLUDEPATH += $$PWD
HEADERS += \
+ $$PWD/qquickabstractbutton_p.h \
+ $$PWD/qquickabstractbutton_p_p.h \
$$PWD/qquickapplicationwindow_p.h \
$$PWD/qquickbusyindicator_p.h \
$$PWD/qquickbutton_p.h \
- $$PWD/qquickbutton_p_p.h \
$$PWD/qquickcheckable_p.h \
$$PWD/qquickcheckable_p_p.h \
$$PWD/qquickcheckbox_p.h \
@@ -35,6 +36,7 @@ HEADERS += \
$$PWD/qquicktoolbutton_p.h
SOURCES += \
+ $$PWD/qquickabstractbutton.cpp \
$$PWD/qquickapplicationwindow.cpp \
$$PWD/qquickbusyindicator.cpp \
$$PWD/qquickbutton.cpp \
diff --git a/src/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/controls/doc/src/qtquickcontrols2-customize.qdoc
index c070b8e5..2f627de2 100644
--- a/src/controls/doc/src/qtquickcontrols2-customize.qdoc
+++ b/src/controls/doc/src/qtquickcontrols2-customize.qdoc
@@ -58,7 +58,7 @@
\section1 Customizing Button
Button consists of two visual items: \l {Control::background}{background}
- and \l {Button::label}{label}.
+ and \l {AbstractButton::label}{label}.
\section3 Background
@@ -76,7 +76,7 @@
\section1 Customizing CheckBox
CheckBox consists of three visual items: \l {Control::background}{background},
- \l {Button::label}{label} and \l {Checkable::indicator}{indicator}.
+ \l {AbstractButton::label}{label} and \l {Checkable::indicator}{indicator}.
\section3 Background
@@ -170,7 +170,7 @@
\section1 Customizing RadioButton
RadioButton consists of three visual items: \l {Control::background}{background},
- \l {Button::label}{label} and \l {Checkable::indicator}{indicator}.
+ \l {AbstractButton::label}{label} and \l {Checkable::indicator}{indicator}.
\section3 Background
@@ -259,7 +259,7 @@
\section1 Customizing Switch
Switch consists of three visual items: \l {Control::background}{background},
- \l {Button::label}{label} and \l {Checkable::indicator}{indicator}.
+ \l {AbstractButton::label}{label} and \l {Checkable::indicator}{indicator}.
\section3 Background
@@ -316,7 +316,7 @@
\section1 Customizing ToggleButton
ToggleButton consists of three visual items: \l {Control::background}{background},
- \l {Button::label}{label} and \l {Checkable::indicator}{indicator}.
+ \l {AbstractButton::label}{label} and \l {Checkable::indicator}{indicator}.
\section3 Background
@@ -358,7 +358,7 @@
\section1 Customizing ToolButton
ToolButton consists of two visual items: \l {Control::background}{background}
- and \l {Button::label}{label}.
+ and \l {AbstractButton::label}{label}.
\section3 Background
diff --git a/src/controls/qquickabstractbutton.cpp b/src/controls/qquickabstractbutton.cpp
new file mode 100644
index 00000000..4211e5a5
--- /dev/null
+++ b/src/controls/qquickabstractbutton.cpp
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 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 "qquickabstractbutton_p.h"
+#include "qquickabstractbutton_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype AbstractButton
+ \inherits Control
+ \instantiates QQuickAbstractButton
+ \inqmlmodule QtQuick.Controls
+ \qmlabstract
+ \internal
+*/
+
+/*!
+ \qmlsignal QtQuickControls2::AbstractButton::pressed()
+
+ This signal is emitted when the button is interactively pressed by the user.
+*/
+
+/*!
+ \qmlsignal QtQuickControls2::AbstractButton::released()
+
+ This signal is emitted when the button is interactively released by the user.
+*/
+
+/*!
+ \qmlsignal QtQuickControls2::AbstractButton::canceled()
+
+ This signal is emitted when the button loses mouse grab
+ while being pressed, or when it would emit the \l released
+ signal but the mouse cursor is not inside the button.
+*/
+
+/*!
+ \qmlsignal QtQuickControls2::AbstractButton::clicked()
+
+ This signal is emitted when the button is clicked.
+*/
+
+QQuickAbstractButtonPrivate::QQuickAbstractButtonPrivate() : pressed(false), label(Q_NULLPTR)
+{
+}
+
+QQuickAbstractButton::QQuickAbstractButton(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractButtonPrivate), parent)
+{
+ setActiveFocusOnTab(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+QQuickAbstractButton::QQuickAbstractButton(QQuickAbstractButtonPrivate &dd, QQuickItem *parent) :
+ QQuickControl(dd, parent)
+{
+ setActiveFocusOnTab(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+/*!
+ \qmlproperty string QtQuickControls2::AbstractButton::text
+
+ This property holds a textual description of the button.
+
+ \note The text is used for accessibility purposes, so it makes sense to
+ set a textual description even if the label item is an image.
+
+ \sa label
+*/
+QString QQuickAbstractButton::text() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->text;
+}
+
+void QQuickAbstractButton::setText(const QString &text)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->text != text) {
+ d->text = text;
+ emit textChanged();
+ }
+}
+
+/*!
+ \qmlproperty bool QtQuickControls2::AbstractButton::pressed
+
+ This property holds whether the button is pressed.
+*/
+bool QQuickAbstractButton::isPressed() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->pressed;
+}
+
+void QQuickAbstractButton::setPressed(bool isPressed)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->pressed != isPressed) {
+ d->pressed = isPressed;
+ emit pressedChanged();
+ }
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::AbstractButton::label
+
+ This property holds the label item.
+
+ \sa text
+*/
+QQuickItem *QQuickAbstractButton::label() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->label;
+}
+
+void QQuickAbstractButton::setLabel(QQuickItem *label)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->label != label) {
+ delete d->label;
+ d->label = label;
+ if (label && !label->parentItem())
+ label->setParentItem(this);
+ emit labelChanged();
+ }
+}
+
+void QQuickAbstractButton::focusOutEvent(QFocusEvent *event)
+{
+ Q_D(QQuickAbstractButton);
+ QQuickControl::focusOutEvent(event);
+ if (d->pressed) {
+ setPressed(false);
+ emit canceled();
+ }
+}
+
+void QQuickAbstractButton::keyPressEvent(QKeyEvent *event)
+{
+ QQuickControl::keyPressEvent(event);
+ if (event->key() == Qt::Key_Space) {
+ setPressed(true);
+ emit pressed();
+ event->accept();
+ }
+}
+
+void QQuickAbstractButton::keyReleaseEvent(QKeyEvent *event)
+{
+ QQuickControl::keyReleaseEvent(event);
+ if (event->key() == Qt::Key_Space) {
+ setPressed(false);
+ emit released();
+ emit clicked();
+ event->accept();
+ }
+}
+
+void QQuickAbstractButton::mousePressEvent(QMouseEvent *event)
+{
+ QQuickControl::mousePressEvent(event);
+ setPressed(true);
+ emit pressed();
+}
+
+void QQuickAbstractButton::mouseMoveEvent(QMouseEvent *event)
+{
+ QQuickControl::mouseMoveEvent(event);
+ setPressed(contains(event->pos()));
+}
+
+void QQuickAbstractButton::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractButton);
+ QQuickControl::mouseReleaseEvent(event);
+ bool wasPressed = d->pressed;
+ setPressed(false);
+ if (wasPressed) {
+ emit released();
+ emit clicked();
+ } else {
+ emit canceled();
+ }
+}
+
+void QQuickAbstractButton::mouseUngrabEvent()
+{
+ Q_D(QQuickAbstractButton);
+ QQuickControl::mouseUngrabEvent();
+ if (d->pressed) {
+ setPressed(false);
+ emit canceled();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/controls/qquickabstractbutton_p.h b/src/controls/qquickabstractbutton_p.h
new file mode 100644
index 00000000..071dfe67
--- /dev/null
+++ b/src/controls/qquickabstractbutton_p.h
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 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 QQUICKABSTRACTBUTTON_P_H
+#define QQUICKABSTRACTBUTTON_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 <QtQuickControls/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractButtonPrivate;
+
+class Q_QUICKCONTROLS_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(QQuickItem *label READ label WRITE setLabel NOTIFY labelChanged FINAL)
+
+public:
+ explicit QQuickAbstractButton(QQuickItem *parent = Q_NULLPTR);
+
+ QString text() const;
+ void setText(const QString &text);
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+ QQuickItem *label() const;
+ void setLabel(QQuickItem *label);
+
+Q_SIGNALS:
+ void pressed();
+ void released();
+ void canceled();
+ void clicked();
+ void textChanged();
+ void pressedChanged();
+ void labelChanged();
+
+protected:
+ QQuickAbstractButton(QQuickAbstractButtonPrivate &dd, QQuickItem *parent);
+
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractButton)
+ Q_DECLARE_PRIVATE(QQuickAbstractButton)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTBUTTON_P_H
diff --git a/src/controls/qquickbutton_p_p.h b/src/controls/qquickabstractbutton_p_p.h
index ca67c224..252a2863 100644
--- a/src/controls/qquickbutton_p_p.h
+++ b/src/controls/qquickabstractbutton_p_p.h
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKBUTTON_P_P_H
-#define QQUICKBUTTON_P_P_H
+#ifndef QQUICKABSTRACTBUTTON_P_P_H
+#define QQUICKABSTRACTBUTTON_P_P_H
//
// W A R N I N G
@@ -52,12 +52,12 @@
QT_BEGIN_NAMESPACE
-class QQuickButtonPrivate : public QQuickControlPrivate
+class QQuickAbstractButtonPrivate : public QQuickControlPrivate
{
- Q_DECLARE_PUBLIC(QQuickButton)
+ Q_DECLARE_PUBLIC(QQuickAbstractButton)
public:
- QQuickButtonPrivate();
+ QQuickAbstractButtonPrivate();
QString text;
bool pressed;
@@ -66,4 +66,4 @@ public:
QT_END_NAMESPACE
-#endif // QQUICKBUTTON_P_P_H
+#endif // QQUICKABSTRACTBUTTON_P_P_H
diff --git a/src/controls/qquickbutton.cpp b/src/controls/qquickbutton.cpp
index ffdd00bd..286b5ccd 100644
--- a/src/controls/qquickbutton.cpp
+++ b/src/controls/qquickbutton.cpp
@@ -35,13 +35,13 @@
****************************************************************************/
#include "qquickbutton_p.h"
-#include "qquickbutton_p_p.h"
+#include "qquickabstractbutton_p_p.h"
QT_BEGIN_NAMESPACE
/*!
\qmltype Button
- \inherits Control
+ \inherits AbstractButton
\instantiates QQuickButton
\inqmlmodule QtQuick.Controls
\ingroup buttons
@@ -79,186 +79,13 @@ QT_BEGIN_NAMESPACE
\sa {Customizing Button}
*/
-/*!
- \qmlsignal QtQuickControls2::Button::pressed()
-
- This signal is emitted when the button is interactively pressed by the user.
-*/
-
-/*!
- \qmlsignal QtQuickControls2::Button::released()
-
- This signal is emitted when the button is interactively released by the user.
-*/
-
-/*!
- \qmlsignal QtQuickControls2::Button::canceled()
-
- This signal is emitted when the button loses mouse grab
- while being pressed, or when it would emit the \l released
- signal but the mouse cursor is not inside the button.
-*/
-
-/*!
- \qmlsignal QtQuickControls2::Button::clicked()
-
- This signal is emitted when the button is clicked.
-*/
-
-QQuickButtonPrivate::QQuickButtonPrivate() : pressed(false), label(Q_NULLPTR)
+class QQuickButtonPrivate : public QQuickAbstractButtonPrivate
{
-}
+};
QQuickButton::QQuickButton(QQuickItem *parent) :
- QQuickControl(*(new QQuickButtonPrivate), parent)
-{
- setActiveFocusOnTab(true);
- setAcceptedMouseButtons(Qt::LeftButton);
-}
-
-QQuickButton::QQuickButton(QQuickButtonPrivate &dd, QQuickItem *parent) :
- QQuickControl(dd, parent)
+ QQuickAbstractButton(*(new QQuickButtonPrivate), parent)
{
- setActiveFocusOnTab(true);
- setAcceptedMouseButtons(Qt::LeftButton);
-}
-
-/*!
- \qmlproperty string QtQuickControls2::Button::text
-
- This property holds a textual description of the button.
-
- \note The text is used for accessibility purposes, so it makes sense to
- set a textual description even if the label item is an image.
-
- \sa label
-*/
-QString QQuickButton::text() const
-{
- Q_D(const QQuickButton);
- return d->text;
-}
-
-void QQuickButton::setText(const QString &text)
-{
- Q_D(QQuickButton);
- if (d->text != text) {
- d->text = text;
- emit textChanged();
- }
-}
-
-/*!
- \qmlproperty bool QtQuickControls2::Button::pressed
-
- This property holds whether the button is pressed.
-*/
-bool QQuickButton::isPressed() const
-{
- Q_D(const QQuickButton);
- return d->pressed;
-}
-
-void QQuickButton::setPressed(bool isPressed)
-{
- Q_D(QQuickButton);
- if (d->pressed != isPressed) {
- d->pressed = isPressed;
- emit pressedChanged();
- }
-}
-
-/*!
- \qmlproperty Item QtQuickControls2::Button::label
-
- This property holds the label item.
-
- \sa text
-*/
-QQuickItem *QQuickButton::label() const
-{
- Q_D(const QQuickButton);
- return d->label;
-}
-
-void QQuickButton::setLabel(QQuickItem *label)
-{
- Q_D(QQuickButton);
- if (d->label != label) {
- delete d->label;
- d->label = label;
- if (label && !label->parentItem())
- label->setParentItem(this);
- emit labelChanged();
- }
-}
-
-void QQuickButton::focusOutEvent(QFocusEvent *event)
-{
- Q_D(QQuickButton);
- QQuickControl::focusOutEvent(event);
- if (d->pressed) {
- setPressed(false);
- emit canceled();
- }
-}
-
-void QQuickButton::keyPressEvent(QKeyEvent *event)
-{
- QQuickControl::keyPressEvent(event);
- if (event->key() == Qt::Key_Space) {
- setPressed(true);
- emit pressed();
- event->accept();
- }
-}
-
-void QQuickButton::keyReleaseEvent(QKeyEvent *event)
-{
- QQuickControl::keyReleaseEvent(event);
- if (event->key() == Qt::Key_Space) {
- setPressed(false);
- emit released();
- emit clicked();
- event->accept();
- }
-}
-
-void QQuickButton::mousePressEvent(QMouseEvent *event)
-{
- QQuickControl::mousePressEvent(event);
- setPressed(true);
- emit pressed();
-}
-
-void QQuickButton::mouseMoveEvent(QMouseEvent *event)
-{
- QQuickControl::mouseMoveEvent(event);
- setPressed(contains(event->pos()));
-}
-
-void QQuickButton::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickButton);
- QQuickControl::mouseReleaseEvent(event);
- bool wasPressed = d->pressed;
- setPressed(false);
- if (wasPressed) {
- emit released();
- emit clicked();
- } else {
- emit canceled();
- }
-}
-
-void QQuickButton::mouseUngrabEvent()
-{
- Q_D(QQuickButton);
- QQuickControl::mouseUngrabEvent();
- if (d->pressed) {
- setPressed(false);
- emit canceled();
- }
}
QT_END_NAMESPACE
diff --git a/src/controls/qquickbutton_p.h b/src/controls/qquickbutton_p.h
index 43ac6ae4..3d0c5c46 100644
--- a/src/controls/qquickbutton_p.h
+++ b/src/controls/qquickbutton_p.h
@@ -48,51 +48,19 @@
// We mean it.
//
-#include <QtQuickControls/private/qquickcontrol_p.h>
+#include <QtQuickControls/private/qquickabstractbutton_p.h>
QT_BEGIN_NAMESPACE
class QQuickButtonPrivate;
-class Q_QUICKCONTROLS_EXPORT QQuickButton : public QQuickControl
+class Q_QUICKCONTROLS_EXPORT QQuickButton : public QQuickAbstractButton
{
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(QQuickItem *label READ label WRITE setLabel NOTIFY labelChanged FINAL)
public:
explicit QQuickButton(QQuickItem *parent = Q_NULLPTR);
- QString text() const;
- void setText(const QString &text);
-
- bool isPressed() const;
- void setPressed(bool pressed);
-
- QQuickItem *label() const;
- void setLabel(QQuickItem *label);
-
-Q_SIGNALS:
- void pressed();
- void released();
- void canceled();
- void clicked();
- void textChanged();
- void pressedChanged();
- void labelChanged();
-
-protected:
- QQuickButton(QQuickButtonPrivate &dd, QQuickItem *parent);
-
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseUngrabEvent() Q_DECL_OVERRIDE;
-
private:
Q_DISABLE_COPY(QQuickButton)
Q_DECLARE_PRIVATE(QQuickButton)
diff --git a/src/controls/qquickcheckable.cpp b/src/controls/qquickcheckable.cpp
index 2f6381c1..faf26c92 100644
--- a/src/controls/qquickcheckable.cpp
+++ b/src/controls/qquickcheckable.cpp
@@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Checkable
- \inherits Button
+ \inherits AbstractButton
\instantiates QQuickCheckable
\inqmlmodule QtQuick.Controls
\qmlabstract
@@ -54,12 +54,12 @@ QQuickCheckablePrivate::QQuickCheckablePrivate() :
}
QQuickCheckable::QQuickCheckable(QQuickItem *parent) :
- QQuickButton(*(new QQuickCheckablePrivate), parent)
+ QQuickAbstractButton(*(new QQuickCheckablePrivate), parent)
{
}
QQuickCheckable::QQuickCheckable(QQuickCheckablePrivate &dd, QQuickItem *parent) :
- QQuickButton(dd, parent)
+ QQuickAbstractButton(dd, parent)
{
}
@@ -135,7 +135,7 @@ void QQuickCheckable::toggle()
void QQuickCheckable::keyReleaseEvent(QKeyEvent *event)
{
Q_D(QQuickCheckable);
- QQuickButton::keyReleaseEvent(event);
+ QQuickAbstractButton::keyReleaseEvent(event);
if (event->key() == Qt::Key_Space)
setChecked(d->exclusive || !d->checked);
}
@@ -143,7 +143,7 @@ void QQuickCheckable::keyReleaseEvent(QKeyEvent *event)
void QQuickCheckable::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QQuickCheckable);
- QQuickButton::mouseReleaseEvent(event);
+ QQuickAbstractButton::mouseReleaseEvent(event);
if (contains(event->pos()))
setChecked(d->exclusive || !d->checked);
}
diff --git a/src/controls/qquickcheckable_p.h b/src/controls/qquickcheckable_p.h
index 38408477..20a6f88d 100644
--- a/src/controls/qquickcheckable_p.h
+++ b/src/controls/qquickcheckable_p.h
@@ -48,13 +48,13 @@
// We mean it.
//
-#include <QtQuickControls/private/qquickbutton_p.h>
+#include <QtQuickControls/private/qquickabstractbutton_p.h>
QT_BEGIN_NAMESPACE
class QQuickCheckablePrivate;
-class Q_QUICKCONTROLS_EXPORT QQuickCheckable : public QQuickButton
+class Q_QUICKCONTROLS_EXPORT QQuickCheckable : public QQuickAbstractButton
{
Q_OBJECT
Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged FINAL)
diff --git a/src/controls/qquickcheckable_p_p.h b/src/controls/qquickcheckable_p_p.h
index d13af86b..709ee3fa 100644
--- a/src/controls/qquickcheckable_p_p.h
+++ b/src/controls/qquickcheckable_p_p.h
@@ -48,11 +48,11 @@
// We mean it.
//
-#include <QtQuickControls/private/qquickbutton_p_p.h>
+#include <QtQuickControls/private/qquickabstractbutton_p_p.h>
QT_BEGIN_NAMESPACE
-class QQuickCheckablePrivate : public QQuickButtonPrivate
+class QQuickCheckablePrivate : public QQuickAbstractButtonPrivate
{
public:
QQuickCheckablePrivate();