Build system changed to Cmake, ORM changed to QxORM, Qt6 compatibility.

This commit is contained in:
2023-04-28 22:25:29 +02:00
parent 30e6180c82
commit d699ce79f7
481 changed files with 2310 additions and 130206 deletions
+43
View File
@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.24)
project(countryregister)
include(../3rdparty/QxOrm/QxOrm.cmake)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ../plugins)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt6 COMPONENTS
Core
Gui
Widgets
REQUIRED)
add_library(countryregister SHARED
countryregister.cpp
countryregister.h
countryregister_global.h
countryregistergrid.cpp
countryregistergrid.h
data/countrydata.cpp
data/countrydata.h)
target_compile_definitions(countryregister PRIVATE -DCOUNTRYREGISTER_LIBRARY)
include_directories(../core)
target_link_libraries(countryregister
Qt::Core
Qt::Gui
Qt::Widgets
qdecimal
decnumber
QxOrm
core
)
install(TARGETS countryregister
LIBRARY DESTINATION ../plugins)
-1
View File
@@ -1,7 +1,6 @@
#include "countryregister.h"
#include "countryregistergrid.h"
#include "countryregister-odb.hxx"
CountryRegister::CountryRegister()
{
-41
View File
@@ -1,41 +0,0 @@
#-------------------------------------------------
#
# Project created by QtCreator 2017-05-03T21:05:30
#
#-------------------------------------------------
QT += widgets sql
TARGET = countryregister
TEMPLATE = lib
DEFINES += COUNTRYREGISTER_LIBRARY
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += countryregister.cpp \
countryregistergrid.cpp \
data/countrydata.cpp
HEADERS += countryregister.h\
countryregister_global.h \
countryregistergrid.h \
data/countrydata.h
include(../config_plugin.pri)
ODB_FILES = countryregister/data/countrydata.h
H_DIR = $$PWD/data/*.h
include(../odb.pri)
DISTFILES += \
countryregister.json
+8
View File
@@ -9,4 +9,12 @@
# define COUNTRYREGISTERSHARED_EXPORT Q_DECL_IMPORT
#endif
#ifdef COUNTRYREGISTER_LIBRARY
#define QX_REGISTER_HPP_COUNTRY QX_REGISTER_HPP_EXPORT_DLL
#define QX_REGISTER_CPP_COUNTRY QX_REGISTER_CPP_EXPORT_DLL
#else // COUNTRYREGISTER_LIBRARY
#define QX_REGISTER_HPP_COUNTRY QX_REGISTER_HPP_IMPORT_DLL
#define QX_REGISTER_CPP_COUNTRY QX_REGISTER_CPP_IMPORT_DLL
#endif
#endif // COUNTRYREGISTER_GLOBAL_H
-1
View File
@@ -1,5 +1,4 @@
#include "countryregistergrid.h"
#include "countryregister-odb.hxx"
CountryRegisterGrid::CountryRegisterGrid(QWidget *parent) : GridForm<CountryData>(parent)
{
+18 -4
View File
@@ -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;
}
+12 -18
View File
@@ -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