LMMS
Loading...
Searching...
No Matches
LcdFloatSpinBox.h
Go to the documentation of this file.
1/*
2 * LcdFloatSpinBox.h - class LcdFloatSpinBox (LcdSpinBox for floats)
3 *
4 * Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
5 * Copyright (c) 2020 Martin Pavelek <he29.HS/at/gmail.com>
6 *
7 * This file is part of LMMS - https://lmms.io
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program (see COPYING); if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301 USA.
23 *
24 */
25
26#ifndef LMMS_GUI_LCD_FLOATSPINBOX_H
27#define LMMS_GUI_LCD_FLOATSPINBOX_H
28
29#include <QString>
30
31#include "LcdWidget.h"
33
34namespace lmms::gui
35{
36
37
38class LMMS_EXPORT LcdFloatSpinBox : public QWidget, public FloatModelView
39{
40 Q_OBJECT
41public:
42 LcdFloatSpinBox(int numWhole, int numFrac, const QString& name = QString(), QWidget* parent = nullptr);
43 LcdFloatSpinBox(int numWhole, int numFrac, const QString& style, const QString& name, QWidget* parent = nullptr);
44
45 void modelChanged() override
46 {
48 update();
49 }
50
51 void setLabel(const QString &label) { m_label = label; }
52
53 void setSeamless(bool left, bool right)
54 {
55 m_wholeDisplay.setSeamless(left, true);
56 m_fractionDisplay.setSeamless(true, right);
57 }
58
59public slots:
60 virtual void update();
61
62protected:
63 void contextMenuEvent(QContextMenuEvent *me) override;
64 void mousePressEvent(QMouseEvent *me) override;
65 void mouseMoveEvent(QMouseEvent *me) override;
66 void mouseReleaseEvent(QMouseEvent *me) override;
67 void wheelEvent(QWheelEvent *we) override;
68 void mouseDoubleClickEvent(QMouseEvent *me) override;
69 void paintEvent(QPaintEvent *pe) override;
70
71private:
72 void layoutSetup(const QString &style = QString("19green"));
73 void enterValue();
74 float getStep() const;
75
82 QString m_label;
83
84signals:
86
87};
88
90
91} // namespace lmms::gui
92
93#endif // LMMS_GUI_LCD_FLOATSPINBOX_H
Definition AutomatableModel.h:463
bool m_mouseMoving
Definition LcdFloatSpinBox.h:78
virtual void update()
Definition LcdFloatSpinBox.cpp:112
LcdWidget m_wholeDisplay
Definition LcdFloatSpinBox.h:76
LcdFloatSpinBox(int numWhole, int numFrac, const QString &name=QString(), QWidget *parent=nullptr)
Definition LcdFloatSpinBox.cpp:53
int m_displayOffset
Definition LcdFloatSpinBox.h:81
LcdWidget m_fractionDisplay
Definition LcdFloatSpinBox.h:77
bool m_intStep
Definition LcdFloatSpinBox.h:79
QPoint m_origMousePos
Definition LcdFloatSpinBox.h:80
QString m_label
Definition LcdFloatSpinBox.h:82
void setSeamless(bool left, bool right)
Definition LcdFloatSpinBox.h:53
void setLabel(const QString &label)
Definition LcdFloatSpinBox.h:51
void modelChanged() override
Definition LcdFloatSpinBox.h:45
Definition LcdWidget.h:37
virtual void modelChanged()
Definition ModelView.h:68
struct @113205115357366127300225113341150224053346037032::@137033172036070230260373056156374243321245367362 left
struct @113205115357366127300225113341150224053346037032::@137033172036070230260373056156374243321245367362 right
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
FloatModel LcdFloatSpinBoxModel
Definition LcdFloatSpinBox.h:89
TypedModelView< FloatModel > FloatModelView
Definition AutomatableModelView.h:131