[app] Access to BooksShelf storage object from QML

This commit is contained in:
Slava Monich 2015-07-12 15:57:42 +03:00
parent d677a150dc
commit c47ab22077
2 changed files with 4 additions and 0 deletions

View file

@ -59,6 +59,7 @@ class BooksShelf: public QAbstractListModel, public BooksItem
Q_PROPERTY(bool hasDummyItem READ hasDummyItem WRITE setHasDummyItem NOTIFY hasDummyItemChanged) Q_PROPERTY(bool hasDummyItem READ hasDummyItem WRITE setHasDummyItem NOTIFY hasDummyItemChanged)
Q_PROPERTY(int dummyItemIndex READ dummyItemIndex WRITE setDummyItemIndex NOTIFY dummyItemIndexChanged) Q_PROPERTY(int dummyItemIndex READ dummyItemIndex WRITE setDummyItemIndex NOTIFY dummyItemIndexChanged)
Q_PROPERTY(BooksBook* book READ book CONSTANT) Q_PROPERTY(BooksBook* book READ book CONSTANT)
Q_PROPERTY(QObject* storage READ storage CONSTANT)
public: public:
explicit BooksShelf(QObject* aParent = NULL); explicit BooksShelf(QObject* aParent = NULL);
@ -80,6 +81,7 @@ public:
QString relativePath() const { return iRelativePath; } QString relativePath() const { return iRelativePath; }
void setRelativePath(QString aPath); void setRelativePath(QString aPath);
BooksBook* bookAt(int aIndex) const; BooksBook* bookAt(int aIndex) const;
QObject* storage() { return &iStorage; }
bool editMode() const { return iEditMode; } bool editMode() const { return iEditMode; }
void setEditMode(bool aEditMode); void setEditMode(bool aEditMode);

View file

@ -44,6 +44,8 @@ class BooksStorage: public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString root READ root CONSTANT) Q_PROPERTY(QString root READ root CONSTANT)
Q_PROPERTY(bool internal READ isInternal CONSTANT)
Q_PROPERTY(bool valid READ isValid CONSTANT)
public: public:
BooksStorage(); BooksStorage();