Routing the received biddings to the model. Just debug outputs there yet.
This commit is contained in:
@ -1,16 +1,17 @@
|
||||
#include "tablemodel.h"
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "../formats/jsonparser.h"
|
||||
#include "../structs.h"
|
||||
#include "commands/edititemcommand.h"
|
||||
#include "commands/insertrowscommand.h"
|
||||
#include "commands/removerowscommand.h"
|
||||
#include "metadata.h"
|
||||
#include "modelitem.h"
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
|
||||
QByteArray TableModel::generateExampleItems() {
|
||||
QJsonDocument doc = QJsonDocument();
|
||||
QJsonObject rootObject;
|
||||
@ -238,6 +239,20 @@ void TableModel::setOnlineCredentials(const QString& mail,
|
||||
setItemData(itemIndex, {{OnlineIdRole, uuid}, {AccessCodeRole, token}});
|
||||
}
|
||||
|
||||
void TableModel::updateBiddings(const QList<bidding> biddings) {
|
||||
int round = biddings.first().biddingRound;
|
||||
qInfo() << "Updating bidding for round:" << round << "...";
|
||||
QListIterator<bidding> i(biddings);
|
||||
while (i.hasNext()) {
|
||||
const bidding localBidding = i.next();
|
||||
qWarning() << "Processing bidding:";
|
||||
qInfo() << "localBidding.userId:" << localBidding.userId;
|
||||
qDebug() << "localBidding.biddingRound:" << localBidding.biddingRound;
|
||||
qDebug() << "localBidding.amount:" << localBidding.amount;
|
||||
qDebug() << "localBidding.depotWishOne:" << localBidding.depotWishOne;
|
||||
qDebug() << "localBidding.depotWishTwo:" << localBidding.depotWishTwo;
|
||||
}
|
||||
}
|
||||
|
||||
bool TableModel::removeRows(int firstRow, int nRows, const QModelIndex& parentIndex) {
|
||||
if (parentIndex != QModelIndex()) {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include <QAbstractTableModel>
|
||||
#include "metadata.h"
|
||||
|
||||
class bidding;
|
||||
class QUndoStack;
|
||||
class ModelItem;
|
||||
|
||||
@ -45,6 +46,8 @@ class TableModel : public QAbstractTableModel {
|
||||
bool updateItem(const ModelItemValues& itemValues);
|
||||
|
||||
void setOnlineCredentials(const QString& mail, const QString& uuid, const QString& token);
|
||||
void updateBiddings(const QList<bidding> biddings);
|
||||
|
||||
public slots:
|
||||
// bool insertRows(int position, int rows, const QModelIndex& parentIndex = QModelIndex())
|
||||
// override;
|
||||
|
||||
Reference in New Issue
Block a user