2023-02-17 12:01:56 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* Copyright (C) 2023 Edelhirsch Software GmbH
|
|
|
|
* This file may be used under the terms of the 3-clause BSD License
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QskControl.h>
|
|
|
|
#include <QskPushButton.h>
|
|
|
|
#include <QskBoundedInput.h>
|
|
|
|
|
|
|
|
class QSK_EXPORT QskSpinBox : public QskBoundedInput
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
using Inherited = QskBoundedInput;
|
|
|
|
public:
|
2023-02-17 13:30:39 +01:00
|
|
|
enum FocusIndeces : int { Decrement = 0, Textbox = 1, Increment = 2, None = 3 };
|
|
|
|
Q_ENUM(FocusIndeces)
|
|
|
|
|
2023-02-17 12:01:56 +01:00
|
|
|
Q_PROPERTY(qreal value READ value NOTIFY valueChanged)
|
2023-02-17 13:30:39 +01:00
|
|
|
Q_PROPERTY(FocusIndeces focusIndex READ focusIndex NOTIFY focusIndexChanged)
|
|
|
|
QSK_SUBCONTROLS(IncrementPanel, DecrementPanel, IncrementText, DecrementText, TextPanel, Text, Layout)
|
2023-02-17 12:01:56 +01:00
|
|
|
QSK_STATES( Pressed )
|
|
|
|
|
|
|
|
explicit QskSpinBox( QQuickItem* parent = nullptr );
|
|
|
|
~QskSpinBox() override;
|
|
|
|
|
|
|
|
void increment( qreal offset ) override;
|
|
|
|
qreal value() const;
|
|
|
|
|
2023-02-17 13:30:39 +01:00
|
|
|
FocusIndeces focusIndex() const;
|
|
|
|
|
2023-02-17 12:01:56 +01:00
|
|
|
Q_SIGNALS:
|
|
|
|
void valueChanged(qreal value);
|
2023-02-17 13:30:39 +01:00
|
|
|
void focusIndexChanged(int index);
|
2023-02-17 12:01:56 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void hoverEnterEvent( QHoverEvent* event) override;
|
|
|
|
void hoverLeaveEvent( QHoverEvent* event) override;
|
|
|
|
void hoverMoveEvent( QHoverEvent* event) override;
|
|
|
|
|
|
|
|
void mouseReleaseEvent(QMouseEvent* event) override;
|
|
|
|
void mousePressEvent(QMouseEvent* event) override;
|
|
|
|
|
|
|
|
void keyPressEvent( QKeyEvent* event ) override;
|
|
|
|
void keyReleaseEvent( QKeyEvent* event ) override;
|
|
|
|
|
|
|
|
void focusInEvent(QFocusEvent* event) override;
|
|
|
|
QRectF focusIndicatorRect() const override;
|
|
|
|
|
|
|
|
class PrivateData;
|
|
|
|
std::unique_ptr<PrivateData> m_data;
|
|
|
|
};
|