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)
17 : QObject(parent), m_pointf(pointf)
18{
19}
20
21void
23{
24 if(m_pointf.x()!= x)
25 {
26 m_pointf.rx()= x;
27 emit xChanged();
28 }
29}
30
31double
33{
34 return m_pointf.x();
35}
36
37
38void
40{
41 if(m_pointf.y()!= y)
42 {
43 m_pointf.ry()= y;
44 emit yChanged();
45 }
46}
47
48double
50{
51 return m_pointf.y();
52}
53
54const QPointF &
56{
57 return m_pointf;
58}
59
60void
61QPointFJs::setPointF(const QPointF &pointf)
62{
63 m_pointf = pointf;
64 emit xChanged();
65 emit yChanged();
66}
67
68void
70{
71 if(!engine)
72 {
73 qWarning() << "Cannot register class: engine is null";
74 return;
75 }
76
77 // Register the meta object as a constructor
78 QJSValue jsMetaObject = engine->newQMetaObject(&QPointFJs::staticMetaObject);
79 engine->globalObject().setProperty("QPointF", jsMetaObject);
80}
81
82} // namespace pappso
void setPointF(const QPointF &pointf)
Definition qpointfjs.cpp:61
Q_INVOKABLE void setX(double x)
Definition qpointfjs.cpp:22
Q_INVOKABLE void setY(double y)
Definition qpointfjs.cpp:39
Q_INVOKABLE QPointFJs(QObject *parent=nullptr)
Definition qpointfjs.cpp:8
const QPointF & point() const
Definition qpointfjs.cpp:55
static void registerJsConstructor(QJSEngine *engine)
Definition qpointfjs.cpp:69
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39