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.

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

Member Function Documentation

◆ point()

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

Definition at line 55 of file qpointfjs.cpp.

56{
57 return m_pointf;
58}

References m_pointf.

◆ registerJsConstructor()

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

Definition at line 69 of file qpointfjs.cpp.

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}

◆ setPointF()

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

Definition at line 61 of file qpointfjs.cpp.

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

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

◆ setX()

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

Definition at line 22 of file qpointfjs.cpp.

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

References m_pointf, x, and xChanged().

◆ setY()

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

Definition at line 39 of file qpointfjs.cpp.

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

References m_pointf, y, and yChanged().

◆ x()

double pappso::QPointFJs::x ( ) const

Definition at line 32 of file qpointfjs.cpp.

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

References m_pointf.

◆ xChanged

void pappso::QPointFJs::xChanged ( )
signal

Referenced by setPointF(), and setX().

◆ y()

double pappso::QPointFJs::y ( ) const

Definition at line 49 of file qpointfjs.cpp.

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

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: