lmms
Cross-platform music production software
Toggle main menu visibility
Loading...
Searching...
No Matches
include
ModelView.h
Go to the documentation of this file.
1
/*
2
* ModelView.h - declaration of ModelView base class
3
*
4
* Copyright (c) 2007-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_MODEL_VIEW_H
26
#define LMMS_GUI_MODEL_VIEW_H
27
28
#include <QPointer>
29
#include "
Model.h
"
30
31
namespace
lmms::gui
32
{
33
34
class
LMMS_EXPORT
ModelView
35
{
36
public
:
37
ModelView
(
Model
*
model
, QWidget*
widget
);
38
virtual
~ModelView
();
39
40
virtual
void
setModel
(
Model
*
model
,
bool
isOldModelValid =
true
);
41
virtual
void
unsetModel
();
42
43
Model
*
model
()
44
{
45
return
m_model
;
46
}
47
48
const
Model
*
model
()
const
49
{
50
return
m_model
;
51
}
52
53
template
<
class
T>
54
T*
castModel
()
55
{
56
return
dynamic_cast<
T*
>
(
model
() );
57
}
58
59
template
<
class
T>
60
const
T*
castModel
()
const
61
{
62
return
dynamic_cast<
const
T*
>
(
model
() );
63
}
64
65
66
protected
:
67
// sub-classes can re-implement this to track model-changes
68
virtual
void
modelChanged
()
69
{
70
}
71
72
QWidget*
widget
()
73
{
74
return
m_widget
;
75
}
76
77
virtual
void
doConnections();
78
79
80
private
:
81
QWidget*
m_widget
;
82
QPointer<Model>
m_model
;
83
84
} ;
85
86
}
// namespace lmms::gui
87
88
#endif
// LMMS_GUI_MODEL_VIEW_H
Model.h
lmms::Model
Definition
Model.h:37
lmms::gui::ModelView::widget
QWidget * widget()
Definition
ModelView.h:72
lmms::gui::ModelView::model
Model * model()
Definition
ModelView.h:43
lmms::gui::ModelView::m_model
QPointer< Model > m_model
Definition
ModelView.h:82
lmms::gui::ModelView::model
const Model * model() const
Definition
ModelView.h:48
lmms::gui::ModelView::ModelView
ModelView(Model *model, QWidget *widget)
Definition
ModelView.cpp:33
lmms::gui::ModelView::unsetModel
virtual void unsetModel()
Definition
ModelView.cpp:81
lmms::gui::ModelView::castModel
const T * castModel() const
Definition
ModelView.h:60
lmms::gui::ModelView::m_widget
QWidget * m_widget
Definition
ModelView.h:81
lmms::gui::ModelView::modelChanged
virtual void modelChanged()
Definition
ModelView.h:68
lmms::gui::ModelView::setModel
virtual void setModel(Model *model, bool isOldModelValid=true)
Definition
ModelView.cpp:53
lmms::gui::ModelView::castModel
T * castModel()
Definition
ModelView.h:54
lmms::gui
Definition
AudioPortAudio.cpp:209
Generated on
for lmms by
1.18.0