Files
pokerth/src/gui/qml/cpp/qmlwrapper.cpp
T
Felix Hammer bb441b565c New Blinds Raise Interval Selector Component for ListViews
Outsourced Styles for RadioButton and TextField
2015-08-17 14:52:46 +02:00

42 lines
1022 B
C++

#include <QtCore>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <configfile.h>
#include <boost/shared_ptr.hpp>
#include "qmlconfig.h"
#include "qmlwrapper.h"
#include "startviewimpl.h"
#include "createlocalgameviewimpl.h"
QmlWrapper::QmlWrapper(boost::shared_ptr<ConfigFile> c)
:QObject(), myConfig(c)
{
myEngine.reset(new QQmlApplicationEngine);
myQmlConfig = new QmlConfig(myConfig); //need to be a default pointer because QML doesnt support shared_ptr()
//TODO create Session and Log here
myStartViewImpl = new StartViewImpl(this);
myCreateLocalGameViewImpl = new CreateLocalGameViewImpl(this);
//Add c++ content to QML here
myEngine->rootContext()->setContextProperty("Config", myQmlConfig);
myEngine->rootContext()->setContextProperty("StartViewImpl", myStartViewImpl);
myEngine->load(QUrl(QStringLiteral("qrc:/main.qml")));
}
QmlWrapper::~QmlWrapper()
{
myEngine->deleteLater();
}
QmlWrapper::QmlWrapper(const QmlWrapper&)
:QObject()
{
}