ItsDrike
868699979d
- Move to using enums to represent the suit & value - This changes the badly named color to more appropriate suit. - Add createDeck static method
27 lines
777 B
C++
27 lines
777 B
C++
#include <QGuiApplication>
|
|
#include <QQmlApplicationEngine>
|
|
#include <QQmlContext>
|
|
#include "playingcard.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QGuiApplication app(argc, argv);
|
|
|
|
QQmlApplicationEngine engine;
|
|
QObject::connect(
|
|
&engine,
|
|
&QQmlApplicationEngine::objectCreationFailed,
|
|
&app,
|
|
[]() { QCoreApplication::exit(-1); },
|
|
Qt::QueuedConnection);
|
|
|
|
qmlRegisterUncreatableType<PlayingCard>("Solitare", 1, 0, "PlayingCard", "PlayingCard cannot be directly created in QML. Use C++ logic to instantiate.");
|
|
|
|
PlayingCard myCard(PlayingCard::Suit::Hearts, PlayingCard::Value::Seven);
|
|
engine.rootContext()->setContextProperty("myCard", &myCard);
|
|
|
|
engine.loadFromModule("Solitare", "Main");
|
|
|
|
return app.exec();
|
|
}
|