mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Add QMLManager class
Add a QMLManager class. This class will be used as a link between the C++ and QML aspects of the mobile application. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6ba5b45c00
commit
59be048549
2 changed files with 62 additions and 0 deletions
31
qt-mobile/qmlmanager.cpp
Normal file
31
qt-mobile/qmlmanager.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include "qmlmanager.h"
|
||||
|
||||
|
||||
QMLManager::QMLManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
QMLManager::~QMLManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString QMLManager::filename()
|
||||
{
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
void QMLManager::setFilename(const QString &f)
|
||||
{
|
||||
m_fileName = f;
|
||||
emit filenameChanged();
|
||||
loadFile();
|
||||
}
|
||||
|
||||
void QMLManager::loadFile()
|
||||
{
|
||||
QUrl url(m_fileName);
|
||||
QString strippedFileName = url.toLocalFile();
|
||||
}
|
31
qt-mobile/qmlmanager.h
Normal file
31
qt-mobile/qmlmanager.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
#ifndef QMLMANAGER_H
|
||||
#define QMLMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class QMLManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged)
|
||||
public:
|
||||
QMLManager();
|
||||
~QMLManager();
|
||||
|
||||
QString filename();
|
||||
|
||||
void getFile();
|
||||
|
||||
|
||||
public slots:
|
||||
void setFilename(const QString &f);
|
||||
|
||||
private:
|
||||
QString m_fileName;
|
||||
void loadFile();
|
||||
|
||||
signals:
|
||||
void filenameChanged();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue