libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
qpointfjs.cpp
Go to the documentation of this file.
1#include "qpointfjs.h"
2#include "jsclassregistrar.h"
3
4
5namespace pappso
6{
7
8QPointFJs::QPointFJs(QObject *parent) : QObject(parent), m_pointf()
9{
10}
11
12QPointFJs::QPointFJs(double x, double y, QObject *parent) : QObject(parent), m_pointf(x, y)
13{
14}
15
16QPointFJs::QPointFJs(const QPointF &pointf, QObject *parent) : QObject(parent), m_pointf(pointf)
17{
18}
19
20void
22{
23 if(m_pointf.x() != x)
24 {
25 m_pointf.rx() = x;
26 emit xChanged();
27 }
28}
29
30double
32{
33 return m_pointf.x();
34}
35
36
37void
39{
40 if(m_pointf.y() != y)
41 {
42 m_pointf.ry() = y;
43 emit yChanged();
44 }
45}
46
47double
49{
50 return m_pointf.y();
51}
52
53const QPointF &
55{
56 return m_pointf;
57}
58
59void
60QPointFJs::setPointF(const QPointF &pointf)
61{
62 m_pointf = pointf;
63 emit xChanged();
64 emit yChanged();
65}
66
67void
69{
70 if(!engine)
71 {
72 qWarning() << "Cannot register class: engine is null";
73 return;
74 }
75
76 // Register the meta object as a constructor
77 QJSValue jsMetaObject = engine->newQMetaObject(&QPointFJs::staticMetaObject);
78 engine->globalObject().setProperty("QPointF", jsMetaObject);
79}
80
81} // namespace pappso
void setPointF(const QPointF &pointf)
Definition qpointfjs.cpp:60
Q_INVOKABLE void setX(double x)
Definition qpointfjs.cpp:21
Q_INVOKABLE void setY(double y)
Definition qpointfjs.cpp:38
Q_INVOKABLE QPointFJs(QObject *parent=nullptr)
Definition qpointfjs.cpp:8
const QPointF & point() const
Definition qpointfjs.cpp:54
static void registerJsConstructor(QJSEngine *engine)
Definition qpointfjs.cpp:68
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39