lena_pi/LenaPi/models/NavigationItemModel.h
2018-10-19 20:41:14 +02:00

49 lines
1.2 KiB
C++

#ifndef NAVIGATIONITEMMODEL_H
#define NAVIGATIONITEMMODEL_H
#include <QObject>
class NavigationItemModel : public QObject
{
Q_OBJECT
Q_PROPERTY(QString pImageSource READ getImageSource NOTIFY imageSourceChanged)
Q_PROPERTY(bool pIsCircleDelegate READ isCircleDelegate NOTIFY isCircleDelegateChanged)
signals:
void isCircleDelegateChanged();
void imageSourceChanged();
void clicked();
public:
NavigationItemModel(QObject *parent = Q_NULLPTR);
QString getImageSource() const;
QString getPath() const;
bool setPath(const QString & path);
bool isCircleDelegate() const;
void setCircleDelegate(bool value);
bool isRoot() const;
NavigationItemModel* getParentItem();
bool hasChildren() const;
QList<NavigationItemModel *> getChildren();
void appendChild(NavigationItemModel* item);
void clearChildren();
Q_INVOKABLE void onClicked();
private:
QString mPath = QString("");
QString mImageSource;
bool mIsCircleDelegate = false;
QList<NavigationItemModel*> mChildren = QList<NavigationItemModel*>();
NavigationItemModel* mParentItem = nullptr;
};
#endif // NAVIGATIONITEMMODEL_H