ItsDrike
883d766dc3
Using manual registration with qmlRegisterType (or qmlRegisterUncreatableType) isn't ideal, because Qt Creator can't pick up on it. When using the macros, autocompletion & unknown type warnings in the code disappear.
30 lines
687 B
C++
30 lines
687 B
C++
#include <QGuiApplication>
|
|
#include <QQmlApplicationEngine>
|
|
#include <QQmlContext>
|
|
#include "gamestate.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QGuiApplication app(argc, argv);
|
|
|
|
QQmlApplicationEngine engine;
|
|
QObject::connect(
|
|
&engine,
|
|
&QQmlApplicationEngine::objectCreationFailed,
|
|
&app,
|
|
[]() { QCoreApplication::exit(-1); },
|
|
Qt::QueuedConnection);
|
|
|
|
GameState gameState;
|
|
gameState.dealCards();
|
|
gameState.drawNextCard();
|
|
gameState.drawNextCard();
|
|
gameState.drawNextCard();
|
|
|
|
engine.rootContext()->setContextProperty("gameState", &gameState);
|
|
|
|
engine.loadFromModule("Solitare", "Main");
|
|
|
|
return app.exec();
|
|
}
|