qskinny/src/controls/QskSlider.h

68 lines
1.8 KiB
C
Raw Normal View History

2017-07-21 18:21:34 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#ifndef QSK_SLIDER_H
#define QSK_SLIDER_H
#include "QskRangeControl.h"
class QSGNode;
class QskSkin;
class QSK_EXPORT QskSlider : public QskRangeControl
{
Q_OBJECT
Q_PROPERTY( bool isPressed READ isPressed NOTIFY pressedChanged )
Q_PROPERTY( Qt::Orientation orientation READ orientation
WRITE setOrientation NOTIFY orientationChanged )
Q_PROPERTY( bool tracking READ isTracking WRITE setTracking NOTIFY trackingChanged )
using Inherited = QskRangeControl;
2018-08-03 08:15:28 +02:00
public:
2017-07-21 18:21:34 +02:00
QSK_SUBCONTROLS( Panel, Groove, Fill, Scale, Handle )
QSK_STATES( Pressed, Minimum, Maximum )
explicit QskSlider( QQuickItem* parent = nullptr );
explicit QskSlider( Qt::Orientation, QQuickItem* parent = nullptr );
2018-07-31 17:32:25 +02:00
~QskSlider() override;
2017-07-21 18:21:34 +02:00
bool isPressed() const;
void setOrientation( Qt::Orientation );
Qt::Orientation orientation() const;
void setTracking( bool );
bool isTracking() const;
2018-07-31 17:32:25 +02:00
QSizeF contentsSizeHint() const override;
QskAspect::Placement effectivePlacement() const override;
2017-07-21 18:21:34 +02:00
2018-08-03 08:15:28 +02:00
Q_SIGNALS:
2017-07-21 18:21:34 +02:00
void pressedChanged( bool );
void orientationChanged( Qt::Orientation );
void trackingChanged( bool );
2018-08-03 08:15:28 +02:00
protected:
2018-07-31 17:32:25 +02:00
void mousePressEvent( QMouseEvent* e ) override;
void mouseMoveEvent( QMouseEvent* e ) override;
void mouseReleaseEvent( QMouseEvent* e ) override;
2017-07-21 18:21:34 +02:00
QSizeF handleSize() const;
QRectF handleRect() const;
2018-08-03 08:15:28 +02:00
private:
2017-07-21 18:21:34 +02:00
void updatePosition();
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
#endif