Build system changed to Cmake, ORM changed to QxORM, Qt6 compatibility.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(postregister)
|
||||
|
||||
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(postregister SHARED
|
||||
postregister.cpp
|
||||
postregister.h
|
||||
postregister_global.h
|
||||
postregistergrid.cpp
|
||||
postregistergrid.h
|
||||
data/postdata.cpp
|
||||
data/postdata.h)
|
||||
|
||||
target_compile_definitions(postregister PRIVATE -DPOSTREGISTER_LIBRARY)
|
||||
|
||||
include_directories(../core)
|
||||
|
||||
target_link_libraries(postregister
|
||||
Qt::Core
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
qdecimal
|
||||
decnumber
|
||||
QxOrm
|
||||
core
|
||||
)
|
||||
@@ -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
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
#include "postregister.h"
|
||||
|
||||
#include "postregistergrid.h"
|
||||
#include "postregister-odb.hxx"
|
||||
|
||||
PostRegister::PostRegister()
|
||||
{
|
||||
}
|
||||
|
||||
void PostRegister::initServiceUi()
|
||||
{
|
||||
|
||||
@@ -12,15 +12,15 @@ class POSTREGISTERSHARED_EXPORT PostRegister : public QObject, IMetaDataPlugin
|
||||
Q_PLUGIN_METADATA(IID PluginInterface_iid FILE "postregister.json")
|
||||
Q_INTERFACES(IPlugin)
|
||||
public:
|
||||
PostRegister();
|
||||
PostRegister() = default;
|
||||
|
||||
// IMetaDataPlugin interface
|
||||
protected:
|
||||
void initServiceUi();
|
||||
void initServiceUi() override;
|
||||
|
||||
// IPlugin interface
|
||||
public:
|
||||
bool showIcon();
|
||||
bool showIcon() override;
|
||||
};
|
||||
|
||||
#endif // POSTREGISTER_H
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2017-04-21T08:14:36
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += widgets sql
|
||||
|
||||
TARGET = postregister
|
||||
TEMPLATE = lib
|
||||
|
||||
DEFINES += POSTREGISTER_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 += postregister.cpp \
|
||||
data/postdata.cpp \
|
||||
postregistergrid.cpp
|
||||
|
||||
HEADERS += postregister.h\
|
||||
postregister_global.h \
|
||||
data/postdata.h \
|
||||
postregistergrid.h
|
||||
|
||||
include(../config_plugin.pri)
|
||||
|
||||
ODB_FILES = postregister/data/postdata.h
|
||||
H_DIR = $$PWD/data/*.h
|
||||
include(../odb.pri)
|
||||
|
||||
DISTFILES += \
|
||||
postregister.json
|
||||
|
||||
FORMS +=
|
||||
|
||||
RESOURCES +=
|
||||
@@ -9,4 +9,12 @@
|
||||
# define POSTREGISTERSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#ifdef POSTREGISTER_LIBRARY
|
||||
#define QX_REGISTER_HPP_POST QX_REGISTER_HPP_EXPORT_DLL
|
||||
#define QX_REGISTER_CPP_POST QX_REGISTER_CPP_EXPORT_DLL
|
||||
#else // POSTREGISTER_LIBRARY
|
||||
#define QX_REGISTER_HPP_POST QX_REGISTER_HPP_IMPORT_DLL
|
||||
#define QX_REGISTER_CPP_POST QX_REGISTER_CPP_IMPORT_DLL
|
||||
#endif
|
||||
|
||||
#endif // POSTREGISTER_GLOBAL_H
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QToolButton>
|
||||
|
||||
#include "postregister-odb.hxx"
|
||||
|
||||
PostRegisterGrid::PostRegisterGrid(QWidget *parent)
|
||||
:GridForm<PostData>(parent)
|
||||
{
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
class PostRegisterGrid : public GridForm<PostData>
|
||||
{
|
||||
public:
|
||||
PostRegisterGrid(QWidget *parent = NULL);
|
||||
PostRegisterGrid(QWidget *parent = nullptr);
|
||||
|
||||
// IGridForm interface
|
||||
protected:
|
||||
bool canAddRecord();
|
||||
bool canEditRecord();
|
||||
bool canDeleteRecord();
|
||||
bool canAddRecord() override;
|
||||
bool canEditRecord() override;
|
||||
bool canDeleteRecord() override;
|
||||
};
|
||||
|
||||
#endif // POSTREGISTERGRID_H
|
||||
|
||||
Reference in New Issue
Block a user