solitare/main.cpp

27 lines
739 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>
#include "playingcard.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.");
PlayingCard myCard("clubs", "ace");
engine.rootContext()->setContextProperty("myCard", &myCard);
2024-11-30 18:23:45 +00:00
engine.loadFromModule("Solitare", "Main");
return app.exec();
}