2015-01-30 19:57:40 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2017-01-09 16:13:48 +00:00
|
|
|
** Copyright (C) 2017 The Qt Company Ltd.
|
2015-01-30 19:57:40 +00:00
|
|
|
** Contact: http://www.qt.io/licensing/
|
|
|
|
**
|
2016-04-14 05:57:25 +00:00
|
|
|
** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
|
2015-01-30 19:57:40 +00:00
|
|
|
**
|
|
|
|
** $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$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-04-10 12:54:34 +00:00
|
|
|
#ifndef QQUICKSLIDER_P_H
|
|
|
|
#define QQUICKSLIDER_P_H
|
2015-01-30 19:57:40 +00:00
|
|
|
|
2015-03-02 14:03:34 +00:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
|
2016-04-13 13:59:53 +00:00
|
|
|
#include <QtQuickTemplates2/private/qquickcontrol_p.h>
|
2015-01-30 19:57:40 +00:00
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
2015-04-10 12:54:34 +00:00
|
|
|
class QQuickSliderPrivate;
|
2015-01-30 19:57:40 +00:00
|
|
|
|
2016-04-27 12:38:39 +00:00
|
|
|
class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSlider : public QQuickControl
|
2015-01-30 19:57:40 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2015-06-10 22:16:44 +00:00
|
|
|
Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
|
|
|
|
Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
|
2015-01-30 19:57:40 +00:00
|
|
|
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
|
|
|
|
Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
|
|
|
|
Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
|
|
|
|
Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
|
|
|
|
Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
|
2016-10-04 19:39:57 +00:00
|
|
|
Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION 2)
|
2015-01-30 19:57:40 +00:00
|
|
|
Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
|
|
|
|
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
|
|
|
|
Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
|
|
|
|
|
|
|
|
public:
|
2016-01-20 16:31:18 +00:00
|
|
|
explicit QQuickSlider(QQuickItem *parent = nullptr);
|
2015-01-30 19:57:40 +00:00
|
|
|
|
2015-06-10 22:16:44 +00:00
|
|
|
qreal from() const;
|
|
|
|
void setFrom(qreal from);
|
|
|
|
|
|
|
|
qreal to() const;
|
|
|
|
void setTo(qreal to);
|
|
|
|
|
2015-01-30 19:57:40 +00:00
|
|
|
qreal value() const;
|
|
|
|
void setValue(qreal value);
|
|
|
|
|
|
|
|
qreal position() const;
|
|
|
|
qreal visualPosition() const;
|
|
|
|
|
|
|
|
qreal stepSize() const;
|
|
|
|
void setStepSize(qreal step);
|
|
|
|
|
|
|
|
enum SnapMode {
|
|
|
|
NoSnap,
|
|
|
|
SnapAlways,
|
|
|
|
SnapOnRelease
|
|
|
|
};
|
2015-02-08 11:05:56 +00:00
|
|
|
Q_ENUM(SnapMode)
|
2015-01-30 19:57:40 +00:00
|
|
|
|
|
|
|
SnapMode snapMode() const;
|
|
|
|
void setSnapMode(SnapMode mode);
|
|
|
|
|
2016-10-04 19:39:57 +00:00
|
|
|
bool live() const;
|
|
|
|
void setLive(bool live);
|
|
|
|
|
2015-01-30 19:57:40 +00:00
|
|
|
bool isPressed() const;
|
|
|
|
void setPressed(bool pressed);
|
|
|
|
|
|
|
|
Qt::Orientation orientation() const;
|
|
|
|
void setOrientation(Qt::Orientation orientation);
|
|
|
|
|
|
|
|
QQuickItem *handle() const;
|
|
|
|
void setHandle(QQuickItem *handle);
|
|
|
|
|
2016-06-12 19:48:33 +00:00
|
|
|
Q_REVISION(1) Q_INVOKABLE qreal valueAt(qreal position) const;
|
|
|
|
|
2015-01-30 19:57:40 +00:00
|
|
|
public Q_SLOTS:
|
|
|
|
void increase();
|
|
|
|
void decrease();
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
2015-06-10 22:16:44 +00:00
|
|
|
void fromChanged();
|
|
|
|
void toChanged();
|
2015-01-30 19:57:40 +00:00
|
|
|
void valueChanged();
|
|
|
|
void positionChanged();
|
|
|
|
void visualPositionChanged();
|
|
|
|
void stepSizeChanged();
|
|
|
|
void snapModeChanged();
|
2016-10-04 19:39:57 +00:00
|
|
|
Q_REVISION(2) void liveChanged();
|
2015-01-30 19:57:40 +00:00
|
|
|
void pressedChanged();
|
|
|
|
void orientationChanged();
|
|
|
|
void handleChanged();
|
2016-11-29 10:32:34 +00:00
|
|
|
Q_REVISION(2) void moved();
|
2015-01-30 19:57:40 +00:00
|
|
|
|
|
|
|
protected:
|
2016-01-20 16:31:18 +00:00
|
|
|
void keyPressEvent(QKeyEvent *event) override;
|
|
|
|
void keyReleaseEvent(QKeyEvent *event) override;
|
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
|
|
void mouseUngrabEvent() override;
|
2017-01-02 16:39:44 +00:00
|
|
|
void touchEvent(QTouchEvent *event) override;
|
|
|
|
void touchUngrabEvent() override;
|
2016-02-23 14:29:05 +00:00
|
|
|
void wheelEvent(QWheelEvent *event) override;
|
|
|
|
|
2016-01-20 16:31:18 +00:00
|
|
|
void mirrorChange() override;
|
|
|
|
void componentComplete() override;
|
2015-01-30 19:57:40 +00:00
|
|
|
|
2015-10-20 10:41:55 +00:00
|
|
|
#ifndef QT_NO_ACCESSIBILITY
|
2016-01-20 16:31:18 +00:00
|
|
|
void accessibilityActiveChanged(bool active) override;
|
|
|
|
QAccessible::Role accessibleRole() const override;
|
2015-10-20 10:41:55 +00:00
|
|
|
#endif
|
|
|
|
|
2015-01-30 19:57:40 +00:00
|
|
|
private:
|
2015-04-10 12:54:34 +00:00
|
|
|
Q_DISABLE_COPY(QQuickSlider)
|
|
|
|
Q_DECLARE_PRIVATE(QQuickSlider)
|
2015-01-30 19:57:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2015-12-20 18:58:55 +00:00
|
|
|
QML_DECLARE_TYPE(QQuickSlider)
|
|
|
|
|
2015-04-10 12:54:34 +00:00
|
|
|
#endif // QQUICKSLIDER_P_H
|