added second part of evaluation in cpp
This commit is contained in:
@@ -1,21 +1,51 @@
|
||||
#include "evaluation.h"
|
||||
#include "result.h"
|
||||
#include "ui_evaluation.h"
|
||||
#include <QListWidget>
|
||||
#include <QListWidgetItem>
|
||||
#include <QStringListModel>
|
||||
#include <iostream>
|
||||
#include <qstring.h>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
Evaluation::Evaluation(DataBase * db, QWidget * parent)
|
||||
: QWidget(parent), ui(new Ui::Evaluation) {
|
||||
ui->setupUi(this);
|
||||
this->db = db;
|
||||
|
||||
// connectsion
|
||||
|
||||
QObject::connect(this->ui->pBClose, SIGNAL(clicked()), this, SLOT(close()));
|
||||
|
||||
this->result = this->db->getData2("select date, id from Rennen", 2);
|
||||
QStringList listOfDates;
|
||||
for (vector<QString> str : result) {
|
||||
listOfDates << str.at(0);
|
||||
// this->ui->lWEvaluation->addItem(new QListWidgetItem(str.at(0)));
|
||||
}
|
||||
|
||||
QStringListModel * model = new QStringListModel();
|
||||
QStringList list;
|
||||
list << "datum 1"
|
||||
<< "datum 2"
|
||||
<< "datum 3";
|
||||
model->setStringList(list);
|
||||
this->ui->lVEvaluation->setModel(model);
|
||||
this->interfaceResult = new Result(this->db);
|
||||
model->setStringList(listOfDates);
|
||||
this->ui->lWEvaluation->setModel(model);
|
||||
QObject::connect(this->ui->lWEvaluation,
|
||||
SIGNAL(doubleClicked(const QModelIndex &)), this,
|
||||
SLOT(listClick(const QModelIndex &)));
|
||||
|
||||
// this->interfaceResult = new Result(this->db);
|
||||
// this->interfaceResult->show();
|
||||
}
|
||||
|
||||
void Evaluation::listClick(const QModelIndex & ind) {
|
||||
cout << "list Click" << endl;
|
||||
// get id to index
|
||||
unsigned long index = static_cast<unsigned long>(ind.row());
|
||||
int id = this->result.at(index).at(1).toInt();
|
||||
|
||||
this->interfaceResult = new Result(this->db, id);
|
||||
this->interfaceResult->show();
|
||||
|
||||
}
|
||||
|
||||
Evaluation::~Evaluation() {
|
||||
|
||||
Reference in New Issue
Block a user