libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::QPointFJs Class Reference

#include <qpointfjs.h>

Inheritance diagram for pappso::QPointFJs:

Signals

void xChanged ()
 
void yChanged ()
 

Public Member Functions

Q_INVOKABLE QPointFJs (QObject *parent=nullptr)
 
Q_INVOKABLE QPointFJs (double x, double y, QObject *parent=nullptr)
 
Q_INVOKABLE QPointFJs (const QPointF &pointf, QObject *parent=nullptr)
 
Q_INVOKABLE double x () const
 
Q_INVOKABLE void setX (double x)
 
Q_INVOKABLE double y () const
 
Q_INVOKABLE void setY (double y)
 
const QPointF & point () const
 
void setPointF (const QPointF &pointf)
 

Static Public Member Functions

static void registerJsConstructor (QJSEngine *engine)
 

Properties

double x
 
double y
 

Private Attributes

QPointF m_pointf
 

Detailed Description

Definition at line 24 of file qpointfjs.h.

Constructor & Destructor Documentation

◆ QPointFJs() [1/3]

pappso::QPointFJs::QPointFJs ( QObject *  parent = nullptr)
explicit

Definition at line 8 of file qpointfjs.cpp.

8 : QObject(parent), m_pointf()
9{
10}

◆ QPointFJs() [2/3]

pappso::QPointFJs::QPointFJs ( double  x,
double  y,
QObject *  parent = nullptr 
)
explicit

Definition at line 12 of file qpointfjs.cpp.

12 : QObject(parent), m_pointf(x, y)
13{
14}

◆ QPointFJs() [3/3]

pappso::QPointFJs::QPointFJs ( const QPointF &  pointf,
QObject *  parent = nullptr 
)
explicit

Definition at line 16 of file qpointfjs.cpp.

16 : QObject(parent), m_pointf(pointf)
17{
18}

Member Function Documentation

◆ point()

const QPointF & pappso::QPointFJs::point ( ) const

Definition at line 54 of file qpointfjs.cpp.

55{
56 return m_pointf;
57}

References m_pointf.

◆ registerJsConstructor()

void pappso::QPointFJs::registerJsConstructor ( QJSEngine *  engine)
static

Definition at line 68 of file qpointfjs.cpp.

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}

◆ setPointF()

void pappso::QPointFJs::setPointF ( const QPointF &  pointf)

Definition at line 60 of file qpointfjs.cpp.

61{
62 m_pointf = pointf;
63 emit xChanged();
64 emit yChanged();
65}

References m_pointf, xChanged(), and yChanged().

◆ setX()

void pappso::QPointFJs::setX ( double  x)

Definition at line 21 of file qpointfjs.cpp.

22{
23 if(m_pointf.x() != x)
24 {
25 m_pointf.rx() = x;
26 emit xChanged();
27 }
28}

References m_pointf, x, and xChanged().

◆ setY()

void pappso::QPointFJs::setY ( double  y)

Definition at line 38 of file qpointfjs.cpp.

39{
40 if(m_pointf.y() != y)
41 {
42 m_pointf.ry() = y;
43 emit yChanged();
44 }
45}

References m_pointf, y, and yChanged().

◆ x()

double pappso::QPointFJs::x ( ) const

Definition at line 31 of file qpointfjs.cpp.

32{
33 return m_pointf.x();
34}

References m_pointf.

◆ xChanged

void pappso::QPointFJs::xChanged ( )
signal

Referenced by setPointF(), and setX().

◆ y()

double pappso::QPointFJs::y ( ) const

Definition at line 48 of file qpointfjs.cpp.

49{
50 return m_pointf.y();
51}

References m_pointf.

◆ yChanged

void pappso::QPointFJs::yChanged ( )
signal

Referenced by setPointF(), and setY().

Member Data Documentation

◆ m_pointf

QPointF pappso::QPointFJs::m_pointf
private

Definition at line 52 of file qpointfjs.h.

Referenced by point(), setPointF(), setX(), setY(), x(), and y().

Property Documentation

◆ x

double pappso::QPointFJs::x
readwrite

Definition at line 27 of file qpointfjs.h.

Referenced by setX().

◆ y

double pappso::QPointFJs::y
readwrite

Definition at line 28 of file qpointfjs.h.

Referenced by setY().


The documentation for this class was generated from the following files: