diff --git a/columnslot.h b/columnslot.h index 3906c26..2079e8f 100644 --- a/columnslot.h +++ b/columnslot.h @@ -2,11 +2,14 @@ #define COLUMNSLOT_H #include +#include #include "playingcard.h" class ColumnSlot : public QObject { Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("Use C++ logic to instantiate") Q_PROPERTY(PlayingCard* card READ card CONSTANT) Q_PROPERTY(bool revealed READ isRevealed NOTIFY revealedChanged) diff --git a/gamestate.h b/gamestate.h index 689d955..8465373 100644 --- a/gamestate.h +++ b/gamestate.h @@ -2,12 +2,15 @@ #define GAMESTATE_H #include +#include #include "playingcard.h" #include "columnslot.h" class GameState : public QObject { Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("Use C++ logic to instantiate") Q_PROPERTY(QList drawPile READ drawPile NOTIFY drawPileChanged) Q_PROPERTY(QList throwawayPile READ throwawayPile NOTIFY throwawayPileChanged) Q_PROPERTY(QList> columns READ columns NOTIFY columnsChanged) diff --git a/main.cpp b/main.cpp index 2b3465a..1867309 100644 --- a/main.cpp +++ b/main.cpp @@ -15,9 +15,6 @@ int main(int argc, char *argv[]) []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection); - qmlRegisterUncreatableType("Solitare", 1, 0, "PlayingCard", "PlayingCard cannot be directly created in QML. Use C++ logic to instantiate."); - qmlRegisterUncreatableType("Solitare", 1, 0, "ColumnSlot", "ColumnSlot cannot be directly created in QML. Use C++ logic to instantiate."); - GameState gameState; gameState.dealCards(); gameState.drawNextCard(); diff --git a/playingcard.h b/playingcard.h index e103a6c..fc69643 100644 --- a/playingcard.h +++ b/playingcard.h @@ -2,10 +2,13 @@ #define PLAYINGCARD_H #include +#include class PlayingCard : public QObject { Q_OBJECT + QML_ELEMENT + QML_UNCREATABLE("Use C++ logic to instantiate") Q_ENUMS(Value) Q_ENUMS(Suit)