Build system changed to Cmake, ORM changed to QxORM, Qt6 compatibility.
This commit is contained in:
+16
-18
@@ -8,8 +8,6 @@
|
||||
#include <QDebug>
|
||||
#include <QDecDouble.hh>
|
||||
|
||||
#include "../qdecimal/src/QDecDouble.hh"
|
||||
|
||||
#include "define.h"
|
||||
#include "core_global.h"
|
||||
#include "exprevaluator.h"
|
||||
@@ -21,25 +19,25 @@ class AutoTableModel : public ITableModel
|
||||
{
|
||||
|
||||
public:
|
||||
explicit AutoTableModel(QObject *parent = NULL)
|
||||
explicit AutoTableModel(QObject *parent = nullptr)
|
||||
:ITableModel(parent)
|
||||
{
|
||||
filtered = false;
|
||||
m_checkboxSelect = false;
|
||||
}
|
||||
|
||||
virtual ~AutoTableModel() {}
|
||||
~AutoTableModel() override = default;
|
||||
|
||||
// QAbstractItemModel interface
|
||||
public:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const
|
||||
[[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
|
||||
return m_list.size();
|
||||
}
|
||||
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const
|
||||
[[nodiscard]] int columnCount(const QModelIndex &parent = QModelIndex()) const override
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
|
||||
@@ -50,7 +48,7 @@ public:
|
||||
return colCount;
|
||||
}
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const
|
||||
[[nodiscard]] QVariant data(const QModelIndex &index, int role) const override
|
||||
{
|
||||
if (index.column() == 0 && m_checkboxSelect)
|
||||
{
|
||||
@@ -89,11 +87,11 @@ public:
|
||||
if (role == Qt::TextAlignmentRole)
|
||||
{
|
||||
if (dispData.canConvert<QDecDouble>()
|
||||
|| dispData.type() == QVariant::Date
|
||||
|| dispData.type() == QVariant::Time
|
||||
|| dispData.type() == QVariant::DateTime
|
||||
|| dispData.type() == QVariant::Int
|
||||
|| dispData.type() == QVariant::Double)
|
||||
|| dispData.typeId() == QMetaType::QDate
|
||||
|| dispData.typeId() == QMetaType::QTime
|
||||
|| dispData.typeId() == QMetaType::QDateTime
|
||||
|| dispData.typeId() == QMetaType::Int
|
||||
|| dispData.typeId() == QMetaType::Double)
|
||||
{
|
||||
return Qt::AlignRight;
|
||||
}
|
||||
@@ -105,7 +103,7 @@ public:
|
||||
return dispData;
|
||||
}
|
||||
|
||||
return QVariant::Invalid;
|
||||
return {};
|
||||
}
|
||||
|
||||
QList<QSharedPointer<T> > list()
|
||||
@@ -113,7 +111,7 @@ public:
|
||||
return m_list;
|
||||
}
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const
|
||||
[[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override
|
||||
{
|
||||
if (role != Qt::DisplayRole) {
|
||||
return QVariant();
|
||||
@@ -141,7 +139,7 @@ public:
|
||||
return QVariant(section + 1);
|
||||
}
|
||||
|
||||
virtual void sort(int column, Qt::SortOrder order) {
|
||||
void sort(int column, Qt::SortOrder order) override {
|
||||
if (m_list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -153,9 +151,9 @@ public:
|
||||
|
||||
std::sort(ALL(m_list), [prop, order](QSharedPointer<T> entA, QSharedPointer<T> entB) -> bool {
|
||||
if (order == Qt::DescendingOrder) {
|
||||
return ((QObject*)entA.data())->property(prop) < ((QObject*)entB.data())->property(prop);
|
||||
return QVariant::compare(((QObject*)entA.data())->property(prop), ((QObject*)entB.data())->property(prop)) == QPartialOrdering::Less;
|
||||
} else {
|
||||
return ((QObject*)entB.data())->property(prop) < ((QObject*)entA.data())->property(prop);
|
||||
return QVariant::compare(((QObject*)entB.data())->property(prop), ((QObject*)entA.data())->property(prop)) == QPartialOrdering::Less;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -276,7 +274,7 @@ private:
|
||||
|
||||
// QAbstractItemModel interface
|
||||
public:
|
||||
virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override
|
||||
{
|
||||
if (role == Qt::EditRole)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user