feat: 添加ElaWidgetTool库
This commit is contained in:
45
ElaWidgetTools/ElaEventBus.h
Normal file
45
ElaWidgetTools/ElaEventBus.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef ELAEVENTBUS_H
|
||||
#define ELAEVENTBUS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
#include "ElaDef.h"
|
||||
#include "ElaProperty.h"
|
||||
#include "ElaSingleton.h"
|
||||
class ElaEventPrivate;
|
||||
class ELA_EXPORT ElaEvent : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaEvent)
|
||||
Q_PROPERTY_CREATE_Q_H(QString, EventName);
|
||||
Q_PROPERTY_CREATE_Q_H(QString, FunctionName);
|
||||
Q_PROPERTY_CREATE_Q_H(Qt::ConnectionType, ConnectionType);
|
||||
|
||||
public:
|
||||
explicit ElaEvent(QObject* parent = nullptr);
|
||||
explicit ElaEvent(QString eventName, QString functionName, QObject* parent = nullptr);
|
||||
~ElaEvent() override;
|
||||
ElaEventBusType::EventBusReturnType registerAndInit();
|
||||
};
|
||||
|
||||
class ElaEventBusPrivate;
|
||||
class ELA_EXPORT ElaEventBus : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_Q_CREATE(ElaEventBus)
|
||||
Q_SINGLETON_CREATE_H(ElaEventBus);
|
||||
|
||||
private:
|
||||
explicit ElaEventBus(QObject* parent = nullptr);
|
||||
~ElaEventBus() override;
|
||||
|
||||
public:
|
||||
ElaEventBusType::EventBusReturnType post(const QString& eventName, const QVariantMap& data = {});
|
||||
QStringList getRegisteredEventsName() const;
|
||||
|
||||
private:
|
||||
friend class ElaEvent;
|
||||
};
|
||||
|
||||
#endif // ELAEVENTBUS_H
|
||||
Reference in New Issue
Block a user