53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#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()));
|
|
QObject::connect(this->ui->lVEvaluation,
|
|
SIGNAL(doubleClicked(const QModelIndex &)), this,
|
|
SLOT(listClick(const QModelIndex &)));
|
|
|
|
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();
|
|
model->setStringList(listOfDates);
|
|
this->ui->lVEvaluation->setModel(model);
|
|
|
|
// 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() {
|
|
delete ui;
|
|
}
|