I have a class which derived QObject.
class SerialPortWidgetBackend : public QObject
{
Q_OBJECT
public:
SerialPortWidgetBackend();
QSerialPort *sp;
Q_INVOKABLE QStringList refreshPorts(void);
Q_INVOKABLE bool openPort(QString portName,QString baudRate);
Q_INVOKABLE bool closePort();
};
In QML file define object like this.
SerialPortWidgetBackend{
id: backend
}
The QML file actually implements for search availible comports , cofigure it and open it. This works fine but i want access sp object. The qml registeration is below
qmlRegisterType<SerialPortWidgetBackend>("com.company.serialportwidgetbackend",1,0,"SerialPortWidgetBackend");
The registered object private. How can access it?
QSerialPortfrom QML.