Snake/src/Core/SnakeProject/icontrol.h

59 lines
1.4 KiB
C
Raw Normal View History

2021-06-11 20:49:42 +03:00
#ifndef ICONTROL_H
#define ICONTROL_H
2021-06-11 20:49:42 +03:00
#include <QObject>
#include "global.h"
2021-06-11 20:49:42 +03:00
/**
* @brief The IControl class This interface should be contains implementation of custom user interface
2021-06-12 18:20:29 +03:00
* How to use this class:
* * inherit of this class
* * add to you class neede signals
* * subscribe to your signals in your world class and your qml interface class.
* For more information see the DefaultControl class.
*
2021-06-11 20:49:42 +03:00
*/
2021-06-15 21:03:11 +03:00
class SNAKEPROJECT_EXPORT IControl : public QObject {
2021-06-11 20:49:42 +03:00
Q_OBJECT
Q_PROPERTY(QString view READ view NOTIFY viewChanged)
2021-06-11 20:49:42 +03:00
public:
IControl();
virtual ~IControl();
/**
* @brief initQmlView This method should be return path to qml view element.
* @return path to qml view.
*/
virtual QString initQmlView() const = 0;
/**
* @brief view This method retun qml view element.
* @return return path to qml view.
2021-06-11 20:49:42 +03:00
*/
const QString &view() const;
signals:
void viewChanged();
private:
/**
* @brief init This method intialize this object.
* @note do not invoke this method monualy.
* @return True if initialize finished succesfful.
2021-06-11 20:49:42 +03:00
*/
bool init();
/**
* @brief setView This method sets new value of qml view element.
2021-06-11 20:49:42 +03:00
* @param newView path to qml view.
*/
void setView(const QString &newView);
QString _view;
friend class Engine;
};
#endif // ICONTROL_H