qskinny/examples/iotdashboard/LightDisplay.h

38 lines
1.0 KiB
C
Raw Normal View History

/******************************************************************************
* Copyright (C) 2021 Edelhirsch Software GmbH
2023-04-06 10:15:03 +02:00
* SPDX-License-Identifier: BSD-3-Clause
*****************************************************************************/
#pragma once
#include <QskBoundedValueInput.h>
#include <QskShadowMetrics.h>
class LightDisplay : public QskBoundedValueInput
{
Q_OBJECT
2024-11-28 15:47:20 +01:00
using Inherited = QskBoundedValueInput;
public:
2024-11-28 15:47:20 +01:00
QSK_SUBCONTROLS( Panel, Groove, ColdAndWarmArc, Tickmarks,
ValueText, LeftLabel, RightLabel, Handle )
QSK_STATES( Pressed )
LightDisplay( QQuickItem* parent = nullptr );
bool isPressed() const;
protected:
2024-11-28 15:47:20 +01:00
void mousePressEvent( QMouseEvent* ) override;
void mouseMoveEvent( QMouseEvent* ) override;
void mouseReleaseEvent( QMouseEvent* ) override;
void keyPressEvent( QKeyEvent* ) override;
private:
qreal angleFromPoint( const QRectF&, const QPointF& ) const;
bool arcContainsPoint( const QRectF&, const QPointF& ) const;
};