qskinny/src/controls/QskSpinBox.h

76 lines
1.9 KiB
C
Raw Normal View History

2023-02-17 11:01:56 +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
2023-02-17 11:01:56 +00:00
*****************************************************************************/
2023-02-17 13:05:05 +00:00
#ifndef QSK_SPIN_BOX_H
#define QSK_SPIN_BOX_H
2023-02-17 11:01:56 +00:00
2023-02-17 14:22:40 +00:00
#include <QskBoundedValueInput.h>
2023-02-17 11:01:56 +00:00
class QSK_EXPORT QskSpinBox : public QskBoundedValueInput
2023-02-17 11:01:56 +00:00
{
2023-02-17 14:22:40 +00:00
Q_OBJECT
using Inherited = QskBoundedValueInput;
2023-02-23 13:37:49 +00:00
Q_PROPERTY( bool wrapping READ isWrapping
WRITE setWrapping NOTIFY wrappingChanged )
2023-02-27 08:56:41 +00:00
Q_PROPERTY( Decoration decoration READ decoration
WRITE setDecoration RESET resetDecoration NOTIFY decorationChanged )
2023-02-23 13:37:49 +00:00
public:
QSK_SUBCONTROLS( Panel, TextPanel, Text,
2023-02-23 13:37:49 +00:00
UpPanel, UpIndicator, DownPanel, DownIndicator )
2023-02-17 14:22:40 +00:00
2023-02-23 13:37:49 +00:00
QSK_STATES( Decreasing, Increasing )
2023-02-17 16:46:52 +00:00
2023-02-27 08:56:41 +00:00
enum Decoration
{
NoDecoration,
ButtonsLeftAndRight,
ButtonsRight,
2023-02-27 08:56:41 +00:00
UpDownControl
};
Q_ENUM( Decoration )
QskSpinBox( QQuickItem* parent = nullptr );
QskSpinBox( qreal min, qreal max,
qreal stepSize, QQuickItem* parent = nullptr );
2023-02-27 08:56:41 +00:00
2023-02-17 14:22:40 +00:00
~QskSpinBox() override;
2023-02-17 16:46:52 +00:00
2023-02-27 08:56:41 +00:00
void setDecoration( Decoration );
void resetDecoration();
Decoration decoration() const;
2023-02-23 13:37:49 +00:00
void setWrapping( bool );
bool isWrapping() const;
void increment( qreal ) override;
2023-02-23 13:37:49 +00:00
Q_SIGNALS:
2023-02-27 08:56:41 +00:00
void decorationChanged( Decoration );
2023-02-23 13:37:49 +00:00
void wrappingChanged( bool );
2023-02-24 07:24:32 +00:00
protected:
2023-02-23 13:37:49 +00:00
void timerEvent( QTimerEvent* ) override;
2023-02-17 14:22:40 +00:00
2023-02-23 13:37:49 +00:00
void mouseReleaseEvent( QMouseEvent* ) override;
2023-03-01 13:22:40 +00:00
void mouseMoveEvent( QMouseEvent* ) override;
2023-02-23 13:37:49 +00:00
void mousePressEvent( QMouseEvent* ) override;
2023-03-01 13:22:40 +00:00
void mouseUngrabEvent() override;
2023-02-17 14:22:40 +00:00
2024-10-21 12:22:09 +00:00
void hoverMoveEvent( QHoverEvent* ) override;
2023-02-23 13:37:49 +00:00
void keyPressEvent( QKeyEvent* ) override;
void keyReleaseEvent( QKeyEvent* ) override;
2023-02-17 14:22:40 +00:00
private:
2023-02-17 14:22:40 +00:00
class PrivateData;
std::unique_ptr< PrivateData > m_data;
2023-02-17 11:01:56 +00:00
};
2023-02-17 13:05:05 +00:00
#endif