LMMS
Loading...
Searching...
No Matches
Draggable.h
Go to the documentation of this file.
1/*
2 * Draggable.h
3 *
4 * Copyright (c) 2025 Lost Robot <r94231/at/gmail/dot/com>
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_DRAGGABLE_H
26#define LMMS_GUI_DRAGGABLE_H
27
29
30namespace lmms::gui
31{
32
36class LMMS_EXPORT Draggable : public FloatModelEditorBase
37{
38 Q_OBJECT
39
40public:
42
51 Draggable(DirectionOfManipulation directionOfManipulation,
52 FloatModel* floatModel, const QPixmap& pixmap, int pointA, int pointB, QWidget* parent = nullptr);
53
54 QSize sizeHint() const override;
55 void setPixmap(const QPixmap& pixmap);
56 void setDefaultValPixmap(const QPixmap& pixmap, float value = 0.f);
57
58protected:
59 void paintEvent(QPaintEvent* event) override;
60 void mouseMoveEvent(QMouseEvent* me) override;
61
62protected slots:
63 void handleMovement();
64
65private:
66 QPixmap m_pixmap;
68 float m_pointA;
69 float m_pointB;
72};
73
74} // namespace lmms::gui
75
76#endif // LMMS_GUI_DRAGGABLE_H
Definition AutomatableModel.h:463
T value() const
Definition AutomatableModelView.h:59
void setPixmap(const QPixmap &pixmap)
Definition Draggable.cpp:56
DirectionOfManipulation
Definition FloatModelEditorBase.h:50
void handleMovement()
Definition Draggable.cpp:115
void paintEvent(QPaintEvent *event) override
Definition Draggable.cpp:70
QPixmap m_pixmap
Definition Draggable.h:66
QSize sizeHint() const override
Definition Draggable.cpp:51
float m_defaultValue
Definition Draggable.h:70
void setDefaultValPixmap(const QPixmap &pixmap, float value=0.f)
Definition Draggable.cpp:62
float m_pointB
Definition Draggable.h:69
bool m_hasDefaultValPixmap
Definition Draggable.h:71
float m_pointA
Definition Draggable.h:68
void mouseMoveEvent(QMouseEvent *me) override
Definition Draggable.cpp:85
QPixmap m_defaultValPixmap
Definition Draggable.h:67
Draggable(DirectionOfManipulation directionOfManipulation, FloatModel *floatModel, const QPixmap &pixmap, int pointA, int pointB, QWidget *parent=nullptr)
Definition Draggable.cpp:36
DirectionOfManipulation
Definition FloatModelEditorBase.h:50
FloatModelEditorBase(DirectionOfManipulation directionOfManipulation=DirectionOfManipulation::Vertical, QWidget *_parent=nullptr, const QString &_name=QString())
default ctor
Definition FloatModelEditorBase.cpp:50
static uintptr_t parent
Definition pugl.h:1644
Definition AudioPortAudio.cpp:223