Fix compile with cmake (#132)
* fix workflow on push * Change qt versions * add PhraseData::DatePartDayOfWeek * Ready for Qt 6.4.2
This commit is contained in:
parent
8ee381d991
commit
087d24e7b6
|
|
@ -1 +1 @@
|
||||||
set(QT_REPO_MODULE_VERSION "0.7.0")
|
set(QT_REPO_MODULE_VERSION "6.4.2")
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ cmake_minimum_required(VERSION 3.16)
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
|
||||||
include(.cmake.conf)
|
include(.cmake.conf)
|
||||||
project(Nut
|
project(QtNut
|
||||||
VERSION "0.7.0"
|
VERSION "${QT_REPO_MODULE_VERSION}"
|
||||||
DESCRIPTION "Nut"
|
DESCRIPTION "Qt orm library"
|
||||||
HOMEPAGE_URL "https://github.com/HamedMasafi/Nut"
|
HOMEPAGE_URL "https://github.com/HamedMasafi/Nut"
|
||||||
LANGUAGES CXX C
|
LANGUAGES CXX C
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ qt_internal_add_module(Nut
|
||||||
NUT_SHARED_POINTER
|
NUT_SHARED_POINTER
|
||||||
QT_DEPRECATED_WARNINGS
|
QT_DEPRECATED_WARNINGS
|
||||||
INCLUDE_DIRECTORIES
|
INCLUDE_DIRECTORIES
|
||||||
|
.
|
||||||
config
|
config
|
||||||
core
|
core
|
||||||
generators
|
generators
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
|
#include <QList>
|
||||||
|
#include <QMutableListIterator>
|
||||||
|
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
|
|
@ -57,19 +59,16 @@ int AbstractTableSet::save(Database *db)
|
||||||
masterModel = db->model().tableByClassName(
|
masterModel = db->model().tableByClassName(
|
||||||
QString::fromUtf8(data->table->metaObject()->className()));
|
QString::fromUtf8(data->table->metaObject()->className()));
|
||||||
|
|
||||||
QMutableListIterator<QWeakPointer<Table>> weaks(data->weakChildren);
|
//TODO: find a better replacement for QMutableListIterator
|
||||||
while (weaks.hasNext()) {
|
auto tmp = data->weakChildren;
|
||||||
auto &row = weaks.next();
|
data->weakChildren.clear();
|
||||||
|
for (auto &w: tmp) {
|
||||||
|
|
||||||
if (!row) {
|
if (!w)
|
||||||
weaks.remove();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
auto t = w.lock();
|
||||||
auto t = row.lock();
|
if (t.isNull())
|
||||||
if (t.isNull()) {
|
|
||||||
weaks.remove();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (data->table)
|
if (data->table)
|
||||||
t->setParentTable(data->table,
|
t->setParentTable(data->table,
|
||||||
|
|
@ -81,16 +80,15 @@ int AbstractTableSet::save(Database *db)
|
||||||
|| t->status() == Table::Deleted) {
|
|| t->status() == Table::Deleted) {
|
||||||
rowsAffected += t->save(db);
|
rowsAffected += t->save(db);
|
||||||
}
|
}
|
||||||
|
data->weakChildren << w;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMutableListIterator<QSharedPointer<Table>> childs(data->children);
|
auto tmp2 = data->children;
|
||||||
|
data->children.clear();
|
||||||
|
|
||||||
while (childs.hasNext()) {
|
for (auto &row : tmp2) {
|
||||||
auto &row = childs.next();
|
if (!row)
|
||||||
if (!row) {
|
|
||||||
childs.remove();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (data->table)
|
if (data->table)
|
||||||
row->setParentTable(data->table,
|
row->setParentTable(data->table,
|
||||||
|
|
@ -103,9 +101,9 @@ int AbstractTableSet::save(Database *db)
|
||||||
rowsAffected += row->save(db);
|
rowsAffected += row->save(db);
|
||||||
data->weakChildren.append(row.toWeakRef());
|
data->weakChildren.append(row.toWeakRef());
|
||||||
|
|
||||||
childs.remove();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
data->children << row;
|
||||||
}
|
}
|
||||||
|
|
||||||
// data->children.clear();
|
// data->children.clear();
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
#include <QtSql/QSqlError>
|
#include <QtSql/QSqlError>
|
||||||
#include <QtSql/QSqlQueryModel>
|
#include <QtSql/QSqlQueryModel>
|
||||||
#include <QtSql/QSqlQuery>
|
#include <QtSql/QSqlQuery>
|
||||||
|
#include <QHashIterator>
|
||||||
|
|
||||||
#ifndef NUT_RAW_POINTER
|
#ifndef NUT_RAW_POINTER
|
||||||
#include <QtCore/QSharedPointer>
|
#include <QtCore/QSharedPointer>
|
||||||
|
|
@ -293,10 +294,7 @@ Q_OUTOFLINE_TEMPLATE RowList<T> Query<T>::toList(int count)
|
||||||
for (int j = 0; j < levels.count(); ++j) {
|
for (int j = 0; j < levels.count(); ++j) {
|
||||||
LevelData &dt = levels[j];
|
LevelData &dt = levels[j];
|
||||||
|
|
||||||
QHashIterator<QString, QString> it(masters);
|
for (auto it = masters.constBegin(); it != masters.constEnd(); ++it) {
|
||||||
while (it.hasNext()) {
|
|
||||||
it.next();
|
|
||||||
|
|
||||||
if (dt.table->name() == it.key()) {
|
if (dt.table->name() == it.key()) {
|
||||||
data.masters.append(j);
|
data.masters.append(j);
|
||||||
data.masterFields.append(it.value());
|
data.masterFields.append(it.value());
|
||||||
|
|
|
||||||
|
|
@ -227,12 +227,13 @@ DatabaseModel *DatabaseModel::modelByName(const QString &name)
|
||||||
|
|
||||||
void DatabaseModel::deleteAllModels()
|
void DatabaseModel::deleteAllModels()
|
||||||
{
|
{
|
||||||
QMapIterator<QString, DatabaseModel*> i(_models);
|
//TODO: recheck this
|
||||||
while (i.hasNext()) {
|
// QMapIterator<QString, DatabaseModel*> i(_models);
|
||||||
i.next();
|
// while (i.hasNext()) {
|
||||||
// cout << i.key() << ": " << i.value() << endl;
|
// i.next();
|
||||||
// qDeleteAll(i.value());
|
//// cout << i.key() << ": " << i.value() << endl;
|
||||||
}
|
//// qDeleteAll(i.value());
|
||||||
|
// }
|
||||||
// qDeleteAll(_models.values());
|
// qDeleteAll(_models.values());
|
||||||
_models.clear();
|
_models.clear();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,8 @@ public:
|
||||||
DatePartHour,
|
DatePartHour,
|
||||||
DatePartMinute,
|
DatePartMinute,
|
||||||
DatePartSecond,
|
DatePartSecond,
|
||||||
DatePartMilisecond
|
DatePartMilisecond,
|
||||||
|
DatePartDayOfWeek
|
||||||
// // special types
|
// // special types
|
||||||
// Distance
|
// Distance
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue