Build system changed to Cmake, ORM changed to QxORM, Qt6 compatibility.
This commit is contained in:
@@ -15,7 +15,9 @@ AccServiceForm::AccServiceForm(QWidget *parent) :
|
||||
registerBinding(ui->salePossible);
|
||||
registerBinding(ui->active);
|
||||
QList<ComboData> cd ;
|
||||
cd << ComboData(AccService::CAR,tr("Car")) << ComboData(AccService::TENT,tr("Tent")) << ComboData(AccService::OTHER,tr("OTHER"));
|
||||
cd << ComboData(AccService::CAR,tr("Car"))
|
||||
<< ComboData(AccService::TENT,tr("Tent"))
|
||||
<< ComboData(AccService::OTHER,tr("OTHER"));
|
||||
registerBinding(ui->serviceType,cd);
|
||||
QList<ComboData> vt ;
|
||||
vt << ComboData(Enums::NONE,tr("None"))
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <QWidget>
|
||||
#include "autoform.h"
|
||||
#include "data/accservice.h"
|
||||
#include "services-odb.hxx"
|
||||
|
||||
namespace Ui {
|
||||
class AccServiceForm;
|
||||
@@ -16,7 +15,7 @@ class AccServiceForm : public AutoForm<AccService>
|
||||
|
||||
public:
|
||||
explicit AccServiceForm(QWidget *parent = 0);
|
||||
~AccServiceForm();
|
||||
~AccServiceForm() override;
|
||||
|
||||
private:
|
||||
Ui::AccServiceForm *ui;
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <core.h>
|
||||
#include "data/accservice.h"
|
||||
#include "services-odb.hxx"
|
||||
|
||||
class AccServiceGrid : public GridForm<AccService>
|
||||
{
|
||||
|
||||
@@ -1,21 +1,37 @@
|
||||
#include "accservice.h"
|
||||
#include <define.h>
|
||||
|
||||
QX_REGISTER_CPP_SERVICE(AccService)
|
||||
|
||||
namespace qx {
|
||||
template<> void register_class(QxClass<AccService>& t) {
|
||||
t.setName("AccService");
|
||||
t.id(&AccService::m_id, "id");
|
||||
t.data(&AccService::m_accServiceName, "accServiceName");
|
||||
t.data(&AccService::m_accServiceCode, "accServiceCode");
|
||||
t.data(&AccService::m_price, "price");
|
||||
t.data(&AccService::m_active, "active");
|
||||
t.data(&AccService::m_salePossible, "salePossible");
|
||||
t.data(&AccService::m_serviceType, "serviceType");
|
||||
t.data(&AccService::m_vatType, "vatType");
|
||||
}
|
||||
}
|
||||
|
||||
AccService::AccService(QObject *parent)
|
||||
:QObject(parent)
|
||||
{
|
||||
m_price = 0;
|
||||
m_active = 1;
|
||||
}
|
||||
int AccService::id() const
|
||||
|
||||
long AccService::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void AccService::setId(int id)
|
||||
void AccService::setId(long id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
QDecDouble AccService::price() const
|
||||
{
|
||||
return QDecDouble((double)m_price / DEC_MULTIPLE);
|
||||
|
||||
+16
-25
@@ -5,42 +5,33 @@
|
||||
#include <QString>
|
||||
#include <QDecDouble.hh>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include <odb/core.hxx>
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QxOrm.h>
|
||||
|
||||
#include <enums.h>
|
||||
#include "../services_global.h"
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(SERVICES_LIBRARY)
|
||||
# define SERVICESSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define SERVICESSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#pragma db object
|
||||
class SERVICESSHARED_EXPORT AccService : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QX_REGISTER_FRIEND_CLASS(AccService)
|
||||
Q_PROPERTY(QString accServiceName READ accServiceName WRITE setAccServiceName)
|
||||
Q_PROPERTY(QString accServiceCode READ accServiceCode WRITE setAccServiceCode)
|
||||
Q_PROPERTY(QDecDouble price READ price WRITE setPrice)
|
||||
Q_PROPERTY(bool active READ active WRITE setActive)
|
||||
Q_PROPERTY(bool salePossible READ salePossible WRITE setSalePossible)
|
||||
Q_PROPERTY(ServiceType serviceType READ serviceType WRITE setServiceType)
|
||||
Q_ENUMS(ServiceType)
|
||||
Q_PROPERTY(Enums::VatType vatType READ vatType WRITE setVatType)
|
||||
|
||||
public:
|
||||
AccService(QObject *parent = 0);
|
||||
|
||||
|
||||
explicit AccService(QObject *parent = nullptr);
|
||||
|
||||
enum ServiceType { CAR,TENT,OTHER,ACCFEE };
|
||||
Q_ENUM(ServiceType)
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
long id() const;
|
||||
void setId(long id);
|
||||
|
||||
QDecDouble price() const;
|
||||
void setPrice(QDecDouble price);
|
||||
@@ -65,19 +56,19 @@ public:
|
||||
void setVatType(const Enums::VatType &vatType);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
long m_id{0};
|
||||
QString m_accServiceName;
|
||||
int m_price;
|
||||
bool m_active;
|
||||
bool m_salePossible;
|
||||
ServiceType m_serviceType;
|
||||
int m_price{0};
|
||||
bool m_active{true};
|
||||
bool m_salePossible{false};
|
||||
ServiceType m_serviceType{OTHER};
|
||||
QString m_accServiceCode;
|
||||
Enums::VatType m_vatType;
|
||||
Enums::VatType m_vatType{Enums::NONE};
|
||||
|
||||
};
|
||||
|
||||
typedef QSharedPointer<AccService> AccServicePtr;
|
||||
|
||||
QX_REGISTER_HPP_SERVICE(AccService, QObject, 0)
|
||||
|
||||
#endif // ACCSERVICE_H
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@ protected:
|
||||
|
||||
// IPlugin interface
|
||||
public:
|
||||
virtual QIcon pluginIcon();
|
||||
QTranslator *translator();
|
||||
QIcon pluginIcon() override;
|
||||
QTranslator *translator() override;
|
||||
};
|
||||
|
||||
#endif // SERVICES_H
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2016-02-04T20:14:07
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
|
||||
QT += widgets sql
|
||||
|
||||
TARGET = services
|
||||
TEMPLATE = lib
|
||||
|
||||
DEFINES += SERVICES_LIBRARY\
|
||||
_GLIBCXX_USE_CXX11_ABI=1
|
||||
|
||||
SOURCES += services.cpp \
|
||||
data/accservice.cpp \
|
||||
accserviceform.cpp \
|
||||
accservicestablemodel.cpp \
|
||||
accservicegrid.cpp
|
||||
|
||||
HEADERS += services.h\
|
||||
services_global.h \
|
||||
data/accservice.h \
|
||||
accserviceform.h \
|
||||
accservicestablemodel.h \
|
||||
accservicegrid.h
|
||||
|
||||
include(../config_plugin.pri)
|
||||
|
||||
OTHER_FILES += service.json
|
||||
|
||||
ODB_FILES = services/data/accservice.h
|
||||
H_DIR = $$PWD/data/*.h
|
||||
include(../odb.pri)
|
||||
|
||||
FORMS += \
|
||||
accserviceform.ui
|
||||
|
||||
|
||||
RESOURCES += \
|
||||
servicesrc.qrc
|
||||
TRANSLATIONS = translations/services_cs_CZ.ts
|
||||
@@ -9,4 +9,12 @@
|
||||
# define SERVICESSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#ifdef SERVICES_LIBRARY
|
||||
#define QX_REGISTER_HPP_SERVICE QX_REGISTER_HPP_EXPORT_DLL
|
||||
#define QX_REGISTER_CPP_SERVICE QX_REGISTER_CPP_EXPORT_DLL
|
||||
#else // SERVICES_LIBRARY
|
||||
#define QX_REGISTER_HPP_SERVICE QX_REGISTER_HPP_IMPORT_DLL
|
||||
#define QX_REGISTER_CPP_SERVICE QX_REGISTER_CPP_IMPORT_DLL
|
||||
#endif
|
||||
|
||||
#endif // SERVICES_GLOBAL_H
|
||||
|
||||
Reference in New Issue
Block a user