added basic models and controllers

This commit is contained in:
Anika Raemer 2018-10-19 14:19:19 +02:00
parent 269b48ed9d
commit e401b71788
9 changed files with 222 additions and 2 deletions

View file

@ -0,0 +1,27 @@
#include "NavigationController.h"
#include "../models/NavigationItemModel.h"
#include "../models/NavigationListModel.h"
NavigationController::NavigationController(QObject *parent) : QObject(parent),
mRootItem(new NavigationItemModel(this)),
mNavList(new NavigationListModel(this))
{
}
void NavigationController::init(const QString &rootPath)
{
}
void NavigationController::setContext(QQmlContext *context)
{
mContext = context;
setContextProperties();
}
void NavigationController::setContextProperties()
{
mContext->setContextProperty("navigationList", mNavList);
}

View file

@ -0,0 +1,29 @@
#ifndef NAVIGATIONCONTROLLER_H
#define NAVIGATIONCONTROLLER_H
#include <QObject>
#include <QQmlContext>
class NavigationItemModel;
class NavigationListModel;
class NavigationController : public QObject
{
Q_OBJECT
public:
NavigationController(QObject *parent = Q_NULLPTR);
void init(const QString & rootPath);
void setContext(QQmlContext* context);
private:
void setContextProperties();
NavigationItemModel* mRootItem;
NavigationListModel* mNavList;
QQmlContext* mContext;
};
#endif // NAVIGATIONCONTROLLER_H