solitare/main.cpp

33 lines
1,001 B
C++
Raw Normal View History

2024-11-30 18:23:45 +00:00
#include <QGuiApplication>
#include <QQmlApplicationEngine>
2024-12-01 18:43:49 +00:00
#include <QQmlContext>
2024-12-01 21:40:42 +00:00
#include "gamestate.h"
2024-11-30 18:23:45 +00:00
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreationFailed,
&app,
[]() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
2024-12-01 18:43:49 +00:00
qmlRegisterUncreatableType<PlayingCard>("Solitare", 1, 0, "PlayingCard", "PlayingCard cannot be directly created in QML. Use C++ logic to instantiate.");
qmlRegisterUncreatableType<ColumnSlot>("Solitare", 1, 0, "ColumnSlot", "ColumnSlot cannot be directly created in QML. Use C++ logic to instantiate.");
2024-12-01 18:43:49 +00:00
2024-12-01 21:40:42 +00:00
GameState gameState;
gameState.dealCards();
gameState.drawNextCard();
gameState.drawNextCard();
gameState.drawNextCard();
2024-12-01 21:40:42 +00:00
engine.rootContext()->setContextProperty("gameState", &gameState);
2024-12-01 18:43:49 +00:00
2024-11-30 18:23:45 +00:00
engine.loadFromModule("Solitare", "Main");
return app.exec();
}