qskinny/examples/gallery/slider/CustomSliderSkinlet.h

49 lines
1.4 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 3-clause BSD License
*****************************************************************************/
2020-08-11 17:56:53 +02:00
#ifndef CUSTOM_SLIDER_SKINLET_H
#define CUSTOM_SLIDER_SKINLET_H
2017-07-21 18:21:34 +02:00
#include <QskSliderSkinlet.h>
class QSGTransformNode;
2020-08-11 17:56:53 +02:00
class CustomSliderSkinlet : public QskSliderSkinlet
2017-07-21 18:21:34 +02:00
{
using Inherited = QskSliderSkinlet;
2018-08-03 08:15:28 +02:00
public:
2017-07-21 18:21:34 +02:00
enum NodeRole
{
2017-10-20 20:26:39 +02:00
// we have a scale instead of a groove
2017-07-21 18:21:34 +02:00
ScaleRole = QskSliderSkinlet::HandleRole + 1,
DecorationRole
};
2020-08-11 17:56:53 +02:00
CustomSliderSkinlet();
2017-07-21 18:21:34 +02:00
2018-07-31 17:32:25 +02:00
QRectF subControlRect( const QskSkinnable*,
const QRectF&, QskAspect::Subcontrol ) const override;
2017-07-21 18:21:34 +02:00
QSizeF sizeHint( const QskSkinnable*,
Qt::SizeHint, const QSizeF& ) const override;
2018-08-03 08:15:28 +02:00
protected:
QSGNode* updateSubNode( const QskSkinnable*,
quint8 nodeRole, QSGNode* ) const override;
2017-07-21 18:21:34 +02:00
2018-08-03 08:15:28 +02:00
private:
2017-10-20 20:26:39 +02:00
QSGNode* updateScaleNode( const QskSlider*, QSGNode* ) const;
QSGNode* updateDecorationNode( const QskSlider*, QSGNode* ) const;
2017-07-21 18:21:34 +02:00
QSGNode* updateHandleNode( const QskSlider*, QSGNode* ) const;
QRectF scaleRect( const QRectF& ) const;
QRectF fillRect( const QskSlider*, const QRectF& ) const;
QRectF decorationRect( const QskSlider*, const QRectF& ) const;
QRectF handleRect( const QskSlider*, const QRectF& ) const;
2017-07-21 18:21:34 +02:00
};
#endif