Loading...
Searching...
No Matches
qpointfjs.cpp
Go to the documentation of this file.
#include "qpointfjs.h"
#include "jsclassregistrar.h"
namespace pappso
{
QPointFJs::QPointFJs(QObject *parent) : QObject(parent), m_pointf()
{
}
QPointFJs::QPointFJs(double x, double y, QObject *parent) : QObject(parent), m_pointf(x, y)
{
}
QPointFJs::QPointFJs(const QPointF &pointf, QObject *parent) : QObject(parent), m_pointf(pointf)
{
}
void
QPointFJs::setX(double x)
{
if(m_pointf.x() != x)
{
m_pointf.rx() = x;
emit xChanged();
}
}
double
QPointFJs::x() const
{
return m_pointf.x();
}
void
QPointFJs::setY(double y)
{
if(m_pointf.y() != y)
{
m_pointf.ry() = y;
emit yChanged();
}
}
double
QPointFJs::y() const
{
return m_pointf.y();
}
const QPointF &
QPointFJs::point() const
{
return m_pointf;
}
void
QPointFJs::setPointF(const QPointF &pointf)
{
m_pointf = pointf;
emit xChanged();
emit yChanged();
}
void
QPointFJs::registerJsConstructor(QJSEngine *engine)
{
if(!engine)
{
qWarning() << "Cannot register class: engine is null";
return;
}
// Register the meta object as a constructor
QJSValue jsMetaObject = engine->newQMetaObject(&QPointFJs::staticMetaObject);
engine->globalObject().setProperty("QPointF", jsMetaObject);
}
} // namespace pappso
pappso::QPointFJs::setPointF
void setPointF(const QPointF &pointf)
Definition qpointfjs.cpp:60
pappso::QPointFJs::x
double x
Definition qpointfjs.h:27
pappso::QPointFJs::setX
Q_INVOKABLE void setX(double x)
Definition qpointfjs.cpp:21
pappso::QPointFJs::setY
Q_INVOKABLE void setY(double y)
Definition qpointfjs.cpp:38
pappso::QPointFJs::y
double y
Definition qpointfjs.h:28
pappso::QPointFJs::xChanged
void xChanged()
pappso::QPointFJs::QPointFJs
Q_INVOKABLE QPointFJs(QObject *parent=nullptr)
Definition qpointfjs.cpp:8
pappso::QPointFJs::yChanged
void yChanged()
pappso::QPointFJs::m_pointf
QPointF m_pointf
Definition qpointfjs.h:52
pappso::QPointFJs::point
const QPointF & point() const
Definition qpointfjs.cpp:54
pappso::QPointFJs::registerJsConstructor
static void registerJsConstructor(QJSEngine *engine)
Definition qpointfjs.cpp:68
jsclassregistrar.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
qpointfjs.h