LMMS
Loading...
Searching...
No Matches
LcdSpinBox.h
Go to the documentation of this file.
1/*
2 * LcdSpinBox.h - class LcdSpinBox, an improved QLCDNumber
3 *
4 * Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef LMMS_GUI_LCD_SPINBOX_H
26#define LMMS_GUI_LCD_SPINBOX_H
27
28#include "LcdWidget.h"
30
31namespace lmms::gui
32{
33
34class LMMS_EXPORT LcdSpinBox : public LcdWidget, public IntModelView
35{
36 Q_OBJECT
37public:
38 LcdSpinBox( int numDigits, QWidget* parent, const QString& name = QString() );
39
40 LcdSpinBox( int numDigits, const QString& style, QWidget* parent, const QString& name = QString() );
41
42 ~LcdSpinBox() override = default;
43
44 void modelChanged() override
45 {
47 update();
48 }
49
52 void setDisplayOffset( int offset )
53 {
54 m_displayOffset = offset;
55 }
56
58 int displayOffset() const
59 {
60 return m_displayOffset;
61 }
62
63
64public slots:
65 virtual void update();
66
67
68protected:
69 void contextMenuEvent( QContextMenuEvent * _me ) override;
70 void mousePressEvent( QMouseEvent * _me ) override;
71 void mouseMoveEvent( QMouseEvent * _me ) override;
72 void mouseReleaseEvent( QMouseEvent * _me ) override;
73 void wheelEvent( QWheelEvent * _we ) override;
74 void mouseDoubleClickEvent( QMouseEvent * _me ) override;
75
76private:
81 void enterValue();
82
83signals:
85
86} ;
87
89
90} // namespace lmms::gui
91
92#endif // LMMS_GUI_LCD_SPINBOX_H
Definition AutomatableModel.h:481
int m_displayOffset
Definition LcdSpinBox.h:80
int displayOffset() const
Returns internal offset for displaying values.
Definition LcdSpinBox.h:58
virtual void update()
Definition LcdSpinBox.cpp:62
void enterValue()
Definition LcdSpinBox.cpp:160
void modelChanged() override
Definition LcdSpinBox.h:44
QPoint m_lastMousePos
mouse position in last mouseMoveEvent
Definition LcdSpinBox.h:79
LcdSpinBox(int numDigits, QWidget *parent, const QString &name=QString())
Definition LcdSpinBox.cpp:39
bool m_mouseMoving
Definition LcdSpinBox.h:78
void setDisplayOffset(int offset)
Definition LcdSpinBox.h:52
float m_remainder
floating offset of spinbox in [-0.5, 0.5]
Definition LcdSpinBox.h:77
~LcdSpinBox() override=default
LcdWidget(QWidget *parent, const QString &name=QString(), bool leadingZero=false)
Definition LcdWidget.cpp:40
int numDigits
Definition LcdWidget.h:60
virtual void modelChanged()
Definition ModelView.h:68
static const char * name
Definition pugl.h:1582
static uintptr_t parent
Definition pugl.h:1644
static const SerdStyle style
Definition sratom.c:36
Definition AudioPortAudio.cpp:223
TypedModelView< IntModel > IntModelView
Definition AutomatableModelView.h:132
IntModel LcdSpinBoxModel
Definition LcdSpinBox.h:88