Build system changed to Cmake, ORM changed to QxORM, Qt6 compatibility.
This commit is contained in:
@@ -1,16 +1,30 @@
|
||||
#include "countrydata.h"
|
||||
|
||||
QX_REGISTER_CPP_COUNTRY(CountryData)
|
||||
|
||||
namespace qx {
|
||||
template<> void register_class(QxClass<CountryData>& t) {
|
||||
t.setName("CountryData");
|
||||
t.id(&CountryData::m_id, "id");
|
||||
t.data(&CountryData::m_code2, "code2");
|
||||
t.data(&CountryData::m_code3, "code3");
|
||||
t.data(&CountryData::m_czechFullName, "czechFullName");
|
||||
t.data(&CountryData::m_czechName, "czechName");
|
||||
t.data(&CountryData::m_englishFullName, "englishFullName");
|
||||
t.data(&CountryData::m_englishName, "englishName");
|
||||
}
|
||||
}
|
||||
|
||||
CountryData::CountryData(QObject *parent) : ComboItem(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int CountryData::id() const
|
||||
long CountryData::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void CountryData::setId(int id)
|
||||
void CountryData::setId(long id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
@@ -79,7 +93,7 @@ bool CountryData::eq(ComboItem *other)
|
||||
{
|
||||
CountryData *obj = qobject_cast<CountryData*>(other);
|
||||
|
||||
if (obj == NULL)
|
||||
if (obj == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,25 +1,19 @@
|
||||
#ifndef COUNTRYDATA_H
|
||||
#define COUNTRYDATA_H
|
||||
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
#include <odb/core.hxx>
|
||||
#include <QString>
|
||||
#include <QSharedPointer>
|
||||
#include <data/comboitem.h>
|
||||
#include "../countryregister_global.h"
|
||||
#include <QxOrm.h>
|
||||
#include <combodata.h>
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(COUNTRYREGISTER_LIBRARY)
|
||||
# define COUNTRYREGISTERSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define COUNTRYREGISTERSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
|
||||
#pragma db object
|
||||
class COUNTRYREGISTERSHARED_EXPORT CountryData : public ComboItem
|
||||
{
|
||||
Q_OBJECT
|
||||
QX_REGISTER_FRIEND_CLASS(CountryData)
|
||||
Q_PROPERTY(QString code2 READ code2 WRITE setCode2)
|
||||
Q_PROPERTY(QString code3 READ code3 WRITE setCode3)
|
||||
Q_PROPERTY(QString czechFullName READ czechFullName WRITE setCzechFullName)
|
||||
@@ -29,8 +23,8 @@ class COUNTRYREGISTERSHARED_EXPORT CountryData : public ComboItem
|
||||
public:
|
||||
Q_INVOKABLE explicit CountryData(QObject *parent = 0);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
long id() const;
|
||||
void setId(long id);
|
||||
|
||||
QString code2() const;
|
||||
void setCode2(const QString &code2);
|
||||
@@ -51,9 +45,7 @@ public:
|
||||
void setEnglishName(const QString &englishName);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
long m_id{0};
|
||||
QString m_code2;
|
||||
QString m_code3;
|
||||
QString m_czechFullName;
|
||||
@@ -64,10 +56,12 @@ private:
|
||||
|
||||
// ComboItem interface
|
||||
public:
|
||||
bool eq(ComboItem *other);
|
||||
QString toString();
|
||||
bool eq(ComboItem *other) override;
|
||||
QString toString() override;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<CountryData> CountryDataPtr;
|
||||
|
||||
QX_REGISTER_HPP_COUNTRY(CountryData, ComboItem, 0)
|
||||
|
||||
#endif // COUNTRYDATA_H
|
||||
|
||||
Reference in New Issue
Block a user