Build system changed to Cmake, ORM changed to QxORM, Qt6 compatibility.
This commit is contained in:
@@ -1,5 +1,20 @@
|
||||
#include "postdata.h"
|
||||
|
||||
QX_REGISTER_CPP_POST(PostData)
|
||||
|
||||
namespace qx {
|
||||
template<> void register_class(QxClass<PostData>& t) {
|
||||
t.setName("PostData");
|
||||
t.id(&PostData::m_id, "id");
|
||||
t.data(&PostData::m_town, "town");
|
||||
t.data(&PostData::m_townPart, "townPart");
|
||||
t.data(&PostData::m_township, "township");
|
||||
t.data(&PostData::m_zipCode, "zipCode");
|
||||
t.data(&PostData::m_postName, "postName");
|
||||
t.data(&PostData::m_code, "code");
|
||||
}
|
||||
}
|
||||
|
||||
PostData::PostData(QObject *parent)
|
||||
:QObject(parent)
|
||||
{
|
||||
@@ -15,12 +30,12 @@ void PostData::setTownPart(const QString &townPart)
|
||||
m_townPart = townPart;
|
||||
}
|
||||
|
||||
int PostData::id() const
|
||||
long PostData::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void PostData::setId(int id)
|
||||
void PostData::setId(long id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
@@ -3,20 +3,16 @@
|
||||
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
#include <odb/core.hxx>
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QxOrm.h>
|
||||
|
||||
#if defined(POSTREGISTER_LIBRARY)
|
||||
# define POSTREGISTERSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define POSTREGISTERSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
#include "../postregister_global.h"
|
||||
|
||||
#pragma db object
|
||||
class POSTREGISTERSHARED_EXPORT PostData : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(PostData)
|
||||
Q_PROPERTY(QString townPart READ townPart WRITE setTownPart)
|
||||
Q_PROPERTY(QString zipCode READ zipCode WRITE setZipCode)
|
||||
Q_PROPERTY(QString postName READ postName WRITE setPostName)
|
||||
@@ -25,13 +21,13 @@ class POSTREGISTERSHARED_EXPORT PostData : public QObject
|
||||
Q_PROPERTY(QString town READ town WRITE setTown)
|
||||
|
||||
public:
|
||||
Q_INVOKABLE explicit PostData(QObject *parent = NULL);
|
||||
Q_INVOKABLE explicit PostData(QObject *parent = nullptr);
|
||||
|
||||
QString townPart() const;
|
||||
void setTownPart(const QString &townPart);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
long id() const;
|
||||
void setId(long id);
|
||||
|
||||
QString zipCode() const;
|
||||
void setZipCode(const QString &zipCode);
|
||||
@@ -49,9 +45,7 @@ public:
|
||||
void setTown(const QString &town);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
long m_id{0};
|
||||
QString m_townPart;
|
||||
QString m_zipCode;
|
||||
QString m_postName;
|
||||
@@ -60,4 +54,6 @@ private:
|
||||
QString m_town;
|
||||
};
|
||||
|
||||
QX_REGISTER_HPP_POST(PostData, QObject, 0)
|
||||
|
||||
#endif // POSTDATA_H
|
||||
|
||||
Reference in New Issue
Block a user