solitare/columnslot.h
ItsDrike 883d766dc3
Register QObject classes as QML elements via macros
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.
2024-12-03 15:05:30 +01:00

33 lines
653 B
C++

#ifndef COLUMNSLOT_H
#define COLUMNSLOT_H
#include <QObject>
#include <qqmlintegration.h>
#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)
public:
explicit ColumnSlot(PlayingCard* card, bool revealed, QObject* parent = nullptr);
PlayingCard* card() const;
bool isRevealed() const;
void reveal();
signals:
void revealedChanged();
private:
PlayingCard* m_card;
bool m_revealed;
};
#endif // COLUMNSLOT_H