qskinny/src/controls/QskSliderSkinlet.h

71 lines
2.0 KiB
C
Raw Normal View History

2017-07-21 16:21:34 +00:00
/******************************************************************************
2024-01-17 13:31:45 +00:00
* QSkinny - Copyright (C) The authors
2023-04-06 07:23:37 +00:00
* SPDX-License-Identifier: BSD-3-Clause
2017-07-21 16:21:34 +00:00
*****************************************************************************/
#ifndef QSK_SLIDER_SKINLET_H
#define QSK_SLIDER_SKINLET_H
#include "QskSkinlet.h"
class QskSlider;
class QSK_EXPORT QskSliderSkinlet : public QskSkinlet
{
Q_GADGET
using Inherited = QskSkinlet;
2018-08-03 06:15:28 +00:00
public:
2024-11-22 16:38:58 +00:00
QSK_STATES( Filled )
2017-07-21 16:21:34 +00:00
enum NodeRole
{
PanelRole,
GrooveRole,
FillRole,
2024-11-18 15:15:50 +00:00
TicksRole,
HandleRole,
RoleCount
2017-07-21 16:21:34 +00:00
};
Q_INVOKABLE QskSliderSkinlet( QskSkin* = nullptr );
2018-07-31 15:32:25 +00:00
~QskSliderSkinlet() override;
2017-07-21 16:21:34 +00:00
2018-07-31 15:32:25 +00:00
QRectF subControlRect( const QskSkinnable*,
const QRectF& rect, QskAspect::Subcontrol ) const override;
2017-07-21 16:21:34 +00:00
QSizeF sizeHint( const QskSkinnable*,
Qt::SizeHint, const QSizeF& ) const override;
2024-11-21 16:59:54 +00:00
int sampleCount( const QskSkinnable*, QskAspect::Subcontrol ) const override;
QRectF sampleRect( const QskSkinnable*,
const QRectF&, QskAspect::Subcontrol, int index ) const override;
QVariant sampleAt( const QskSkinnable*,
QskAspect::Subcontrol, int index ) const override;
2024-11-22 16:38:58 +00:00
QskAspect::States sampleStates( const QskSkinnable*,
QskAspect::Subcontrol, int ) const override;
2018-08-03 06:15:28 +00:00
protected:
2018-07-31 15:32:25 +00:00
QSGNode* updateSubNode( const QskSkinnable*,
2017-07-21 16:21:34 +00:00
quint8 nodeRole, QSGNode* ) const override;
2024-11-21 16:59:54 +00:00
QSGNode* updateSampleNode( const QskSkinnable*,
QskAspect::Subcontrol, int index, QSGNode* ) const override;
2024-11-22 16:38:58 +00:00
virtual QVector< qreal > graduation( const QskSlider* ) const;
bool hasGraduation( const QskSlider* ) const;
2024-11-22 16:38:58 +00:00
2018-08-03 06:15:28 +00:00
private:
QRectF panelRect( const QskSlider*, const QRectF& ) const;
QRectF fillRect( const QskSlider*, const QRectF& ) const;
QRectF handleRect( const QskSlider*, const QRectF& ) const;
2024-11-21 16:59:54 +00:00
QRectF tickRect( const QskSlider*, const QRectF&, int index ) const;
2017-07-21 16:21:34 +00:00
};
#endif