Items are loaded from default JSON file in standard location at startup. If no items are found in file, example items are generated.

This commit is contained in:
2025-12-23 13:40:33 +01:00
parent 0e1a0d4959
commit 1fc1b1715d
7 changed files with 100 additions and 31 deletions

View File

@ -19,6 +19,7 @@ class TableModel : public QAbstractTableModel {
enum UserRoles { NameRole = Qt::UserRole + 1, DescriptionRole, InfoRole, AmountRole, FactorRole };
static QHash<int, QByteArray> ROLE_NAMES;
static QList<QString> intColumns;
static QByteArray generateExampleItems();
explicit TableModel(QUndoStack* undoStack, QObject* parent = nullptr);
@ -41,7 +42,9 @@ class TableModel : public QAbstractTableModel {
// override;
bool removeRows(int firstRow, int nRows, const QModelIndex& parentIndex = QModelIndex()) override;
void appendItems(const QByteArray& jsonDoc);
void insertItems(int startPosition, const QByteArray& jsonDoc, const QModelIndex& parentIndex);
void insertItems(int startPosition,
const QByteArray& jsonDoc,
const QModelIndex& parentIndex = QModelIndex());
private:
/// *** members ***