qskinny/examples/iotdashboard/LightDisplaySkinlet.h
Peter Hartmann 927d2dd51c
Iot dashboard light intensity (#142)
* IOT dashboard: Make light dimmer use arc renderer

* use shadow

* add value text

* add warm and cold parts

* add knob

* handle input

* only move knob when drawing along the arc

* improve input handling

* add tickmarks

* add tickmarks node

* clean up a bit

* Update screenshot of IOT dashboard for github site
2021-11-19 15:02:57 +01:00

47 lines
1.1 KiB
C++

/******************************************************************************
* Copyright (C) 2021 Edelhirsch Software GmbH
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#pragma once
#include <QskSkinlet.h>
class LightDisplay;
class LightDisplaySkinlet : public QskSkinlet
{
Q_GADGET
using Inherited = QskSkinlet;
public:
enum NodeRole
{
PanelRole,
GrooveRole,
ColdAndWarmArcRole,
WarmPartRole,
TickmarksRole,
ValueTextRole,
LeftLabelRole,
RightLabelRole,
KnobRole,
RoleCount,
};
Q_INVOKABLE LightDisplaySkinlet( QskSkin* = nullptr );
~LightDisplaySkinlet() override;
QRectF subControlRect( const QskSkinnable*,
const QRectF&, QskAspect::Subcontrol ) const override;
protected:
QSGNode* updateSubNode( const QskSkinnable*,
quint8 nodeRole, QSGNode* ) const override;
private:
QSizeF textLabelsSize( const LightDisplay* display ) const;
};