MuseScore Plugins
3.2.3
Plugins API for MuseScore
mscore
plugin
api
fraction.h
1
//=============================================================================
2
// MuseScore
3
// Music Composition & Notation
4
//
5
// Copyright (C) 2009 Werner Schweer
6
//
7
// This program is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License version 2
9
// as published by the Free Software Foundation and appearing in
10
// the file LICENCE.GPL
11
//=============================================================================
12
13
#ifndef __PLUGIN_API_FRACTION_H__
14
#define __PLUGIN_API_FRACTION_H__
15
16
#include "libmscore/fraction.h"
17
18
namespace
Ms
{
19
namespace
PluginAPI {
20
21
//---------------------------------------------------------
22
// FractionWrapper
30
//---------------------------------------------------------
31
32
class
FractionWrapper
:
public
QObject {
33
Q_OBJECT
35
Q_PROPERTY(
int
numerator
READ
numerator
)
37
Q_PROPERTY(
int
denominator
READ
denominator
)
42
Q_PROPERTY(
int
ticks
READ
ticks
)
// FIXME: fraction transition
44
Q_PROPERTY(QString
str
READ toString)
45
46
Ms::Fraction f;
47
49
public
slots:
50
void
setFraction(Fraction _f) { f = _f; }
51
52
public
:
53
FractionWrapper
() =
default
;
54
FractionWrapper
(
const
Ms::Fraction& _f) : f(_f) {}
55
56
Ms::Fraction fraction()
const
{
return
f; }
57
int
numerator
()
const
{
return
f.numerator(); }
58
int
denominator
()
const
{
return
f.denominator(); }
59
int
ticks
()
const
{
return
f.ticks(); }
60
QString toString()
const
{
return
f.toString(); }
62
};
63
64
//---------------------------------------------------------
65
// wrap
68
//---------------------------------------------------------
69
70
inline
FractionWrapper
* wrap(Ms::Fraction f)
71
{
72
FractionWrapper
* w =
new
FractionWrapper
(f);
73
// All wrapper objects should belong to JavaScript code.
74
QQmlEngine::setObjectOwnership(w, QQmlEngine::JavaScriptOwnership);
75
return
w;
76
}
77
78
}
// namespace PluginAPI
79
}
// namespace Ms
80
81
#endif
Ms::PluginAPI::FractionWrapper::str
QString str
String representation of this fraction.
Definition:
fraction.h:44
Ms::PluginAPI::FractionWrapper::ticks
int ticks
MIDI ticks number equal to the number of the whole notes represented by this fraction.
Definition:
fraction.h:42
Ms::PluginAPI::FractionWrapper
Fraction object available to QML plugins.
Definition:
fraction.h:32
Ms::PluginAPI::FractionWrapper::numerator
int numerator
Fraction numerator.
Definition:
fraction.h:35
Ms::PluginAPI::FractionWrapper::denominator
int denominator
Fraction denominator.
Definition:
fraction.h:37
Ms
Definition:
cursor.cpp:29
Generated by
1.8.18