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)
|
||||
|
||||
include(.cmake.conf)
|
||||
project(Nut
|
||||
VERSION "0.7.0"
|
||||
DESCRIPTION "Nut"
|
||||
project(QtNut
|
||||
VERSION "${QT_REPO_MODULE_VERSION}"
|
||||
DESCRIPTION "Qt orm library"
|
||||
HOMEPAGE_URL "https://github.com/HamedMasafi/Nut"
|
||||
LANGUAGES CXX C
|
||||
)
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ qt_internal_add_module(Nut
|
|||
NUT_SHARED_POINTER
|
||||
QT_DEPRECATED_WARNINGS
|
||||
INCLUDE_DIRECTORIES
|
||||
.
|
||||
config
|
||||
core
|
||||
generators
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
**************************************************************************/
|
||||
|
||||
#include <QWeakPointer>
|
||||
#include <QList>
|
||||
#include <QMutableListIterator>
|
||||
|
||||
#include "table.h"
|
||||
#include "database.h"
|
||||
|
|
@ -57,19 +59,16 @@ int AbstractTableSet::save(Database *db)
|
|||
masterModel = db->model().tableByClassName(
|
||||
QString::fromUtf8(data->table->metaObject()->className()));
|
||||
|
||||
QMutableListIterator<QWeakPointer<Table>> weaks(data->weakChildren);
|
||||
while (weaks.hasNext()) {
|
||||
auto &row = weaks.next();
|
||||
//TODO: find a better replacement for QMutableListIterator
|
||||
auto tmp = data->weakChildren;
|
||||
data->weakChildren.clear();
|
||||
for (auto &w: tmp) {
|
||||
|
||||
if (!row) {
|
||||
weaks.remove();
|
||||
if (!w)
|
||||
continue;
|
||||
}
|
||||
auto t = row.lock();
|
||||
if (t.isNull()) {
|
||||
weaks.remove();
|
||||
auto t = w.lock();
|
||||
if (t.isNull())
|
||||
continue;
|
||||
}
|
||||
|
||||
if (data->table)
|
||||
t->setParentTable(data->table,
|
||||
|
|
@ -81,16 +80,15 @@ int AbstractTableSet::save(Database *db)
|
|||
|| t->status() == Table::Deleted) {
|
||||
rowsAffected += t->save(db);
|
||||
}
|
||||
data->weakChildren << w;
|
||||
}
|
||||
|
||||
QMutableListIterator<QSharedPointer<Table>> childs(data->children);
|
||||
auto tmp2 = data->children;
|
||||
data->children.clear();
|
||||
|
||||
while (childs.hasNext()) {
|
||||
auto &row = childs.next();
|
||||
if (!row) {
|
||||
childs.remove();
|
||||
for (auto &row : tmp2) {
|
||||
if (!row)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (data->table)
|
||||
row->setParentTable(data->table,
|
||||
|
|
@ -103,9 +101,9 @@ int AbstractTableSet::save(Database *db)
|
|||
rowsAffected += row->save(db);
|
||||
data->weakChildren.append(row.toWeakRef());
|
||||
|
||||
childs.remove();
|
||||
continue;
|
||||
}
|
||||
data->children << row;
|
||||
}
|
||||
|
||||
// data->children.clear();
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <QtSql/QSqlError>
|
||||
#include <QtSql/QSqlQueryModel>
|
||||
#include <QtSql/QSqlQuery>
|
||||
#include <QHashIterator>
|
||||
|
||||
#ifndef NUT_RAW_POINTER
|
||||
#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) {
|
||||
LevelData &dt = levels[j];
|
||||
|
||||
QHashIterator<QString, QString> it(masters);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
|
||||
for (auto it = masters.constBegin(); it != masters.constEnd(); ++it) {
|
||||
if (dt.table->name() == it.key()) {
|
||||
data.masters.append(j);
|
||||
data.masterFields.append(it.value());
|
||||
|
|
|
|||
|
|
@ -227,12 +227,13 @@ DatabaseModel *DatabaseModel::modelByName(const QString &name)
|
|||
|
||||
void DatabaseModel::deleteAllModels()
|
||||
{
|
||||
QMapIterator<QString, DatabaseModel*> i(_models);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
// cout << i.key() << ": " << i.value() << endl;
|
||||
// qDeleteAll(i.value());
|
||||
}
|
||||
//TODO: recheck this
|
||||
// QMapIterator<QString, DatabaseModel*> i(_models);
|
||||
// while (i.hasNext()) {
|
||||
// i.next();
|
||||
//// cout << i.key() << ": " << i.value() << endl;
|
||||
//// qDeleteAll(i.value());
|
||||
// }
|
||||
// qDeleteAll(_models.values());
|
||||
_models.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,8 @@ public:
|
|||
DatePartHour,
|
||||
DatePartMinute,
|
||||
DatePartSecond,
|
||||
DatePartMilisecond
|
||||
DatePartMilisecond,
|
||||
DatePartDayOfWeek
|
||||
// // special types
|
||||
// Distance
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue