#include "evaluation.h" #include "result.h" #include "ui_evaluation.h" #include #include #include #include #include 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 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(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; }