From eed0d5d2282f50ae1790e7539203f13b2af46400 Mon Sep 17 00:00:00 2001 From: Jordan Aurey <aurejordan@gmail.com> Date: Mon, 25 Mar 2019 18:42:59 +0100 Subject: [PATCH] =?UTF-8?q?model=20affich=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/elementslistmodel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/elementslistmodel.cpp b/app/elementslistmodel.cpp index b206fe7..476ff16 100644 --- a/app/elementslistmodel.cpp +++ b/app/elementslistmodel.cpp @@ -1,4 +1,5 @@ #include "elementslistmodel.h" +#include <qpair.h> ElementsListModel::ElementsListModel(QObject *parent) : QAbstractListModel(parent) @@ -28,7 +29,10 @@ QVariant ElementsListModel::data(const QModelIndex &index, int role) const return QVariant(); if (role == Qt::DisplayRole){ - return QVariant::fromValue<Task>(taskVector.at(index.row())); + //Task t = QVariant::fromValue<Task>(taskVector.at(index.row())); + QString s = QString::number(taskVector.at(index.row()).getPID()) + "\t" + QString::number( taskVector.at(index.row()).getCPU() ); + return QVariant(s); + } @@ -53,7 +57,7 @@ bool ElementsListModel::removeRows(int row, int count, const QModelIndex &parent void ElementsListModel::insertTask(Task &task, int row){ beginInsertRows(QModelIndex(), row, row); - taskVector.insert(row, task); + taskVector.insert(row, task.getPID()); endInsertRows(); } -- GitLab