Add a default constructor for DanbooruPost

This commit is contained in:
Luca Beltrame 2015-02-05 00:28:02 +01:00
parent 1adeaa4063
commit 4fbfdf753e
2 changed files with 21 additions and 1 deletions

View file

@ -38,6 +38,19 @@ namespace Danbooru
const QMap<QString, DanbooruPost::Rating> DanbooruPost::RATING_MAP = initRatingMap();
DanbooruPost::DanbooruPost(QObject* parent): QObject(parent)
{
m_pixmap = QPixmap();
m_tags = QSet<QString>();
m_height = 0;
m_width = 0;
m_url = QUrl();
m_thumbnailUrl = QUrl();
m_size = 0;
m_rating = Questionable;
}
DanbooruPost::DanbooruPost(QVariantMap postData, QPixmap pixmap,
QObject *parent):
QObject(parent),

View file

@ -69,7 +69,7 @@ class DanbooruPost : public QObject
Q_OBJECT
Q_PROPERTY(const QPixmap pixmap READ pixmap WRITE setPixmap)
Q_PROPERTY(const QPixmap pixmapData READ pixmap WRITE setPixmap)
Q_PROPERTY(int id READ id)
Q_PROPERTY(QUrl fileUrl READ fileUrl)
Q_PROPERTY(QSet<QString> tags READ tags)
@ -89,6 +89,8 @@ public:
Explicit = 4 /**< Explicit material **/
};
Q_DECLARE_FLAGS(Ratings, DanbooruPost::Rating)
Q_ENUMS(Rating)
private:
@ -127,9 +129,12 @@ public:
* @param parent A pointer to the parent QObject.
*
**/
explicit DanbooruPost(QVariantMap postData, QPixmap pixmap = QPixmap(),
QObject *parent = 0);
explicit DanbooruPost(QObject* parent = 0);
/**
* @brief Construct a Danbooru post from XML attributes
*
@ -217,6 +222,8 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(DanbooruPost::Ratings)
}; // namespace Danbooru
Q_DECLARE_METATYPE(Danbooru::DanbooruPost *)
Q_DECLARE_METATYPE(Danbooru::DanbooruPost::Rating)
#endif // DANBOORUPOST_H