You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.0 KiB

#ifndef APPLICATIONBRIDGE_H
#define APPLICATIONBRIDGE_H
#include <QObject>
#include <QDebug>
#include <QTimer>
#include <QDateTime>
#include <QList>
class ApplicationBridge : public QObject
{
Q_OBJECT
Q_PROPERTY(QString inputForCpp READ inputForCpp WRITE setInputForCpp NOTIFY inputForCppChanged)
Q_PROPERTY(QList<QObject *> list READ list WRITE setList NOTIFY listChanged)
public:
explicit ApplicationBridge(QObject *parent = nullptr);
const QString &inputForCpp() const;
void setInputForCpp(const QString &newInputForCpp);
QString m_inputForCpp;
//Accessible function from c++
Q_INVOKABLE void action1(){
qWarning()<<"Take action 1";
}
const QList<QObject *> &list() const;
void setList(const QList<QObject *> &newList);
signals:
void inputForCppChanged();
void timeChanged(QDateTime dateFromCPP);
void listChanged();
public slots:
void timerSlot(){
emit timeChanged(QDateTime::currentDateTime());
}
private:
QList<QObject *> m_list;
};
#endif // APPLICATIONBRIDGE_H