#include "ResultsDialog.h" #include #include #include ResultsDialog::ResultsDialog(qreal thresh1, qreal thresh2, int tp, int fp, int fn, int tn, qreal precision, qreal recall, qreal fScore, qreal accuracy, QWidget *parent) : QDialog(parent) { setWindowTitle("Thresholds: " + QString::number(thresh1) + " - " + QString::number(thresh2)); QLabel *refText = new QLabel("Ref."); QLabel *hypText = new QLabel("Hyp."); QLabel *yes1 = new QLabel("yes"); QLabel *no1 = new QLabel("no"); QLabel *yes2 = new QLabel("yes"); QLabel *no2 = new QLabel("no"); QLabel *tpLab = new QLabel(QString::number(tp)); QLabel *fpLab = new QLabel(QString::number(fp)); QLabel *fnLab = new QLabel(QString::number(fn)); QLabel *tnLab = new QLabel(QString::number(tn)); QLabel *precLab = new QLabel("Precision:"); QLabel *recLab = new QLabel("Recall:"); QLabel *fScLab = new QLabel("F-Score:"); QLabel *accLab = new QLabel("Accuracy:"); QLabel *prec = new QLabel(QString::number(precision, 'g', 3)); QLabel *rec = new QLabel(QString::number(recall, 'g', 3)); QLabel *fSc = new QLabel("" + QString::number(fScore, 'g', 3) + ""); QLabel *acc = new QLabel(QString::number(accuracy, 'g', 3)); QGridLayout *layout = new QGridLayout; layout->setColumnMinimumWidth(2, 50); layout->setColumnMinimumWidth(3, 50); layout->addWidget(refText, 0, 2, 1, 2, Qt::AlignHCenter); layout->addWidget(hypText, 2, 0, 2, 1, Qt::AlignVCenter); layout->addWidget(yes1, 1, 2, Qt::AlignHCenter); layout->addWidget(no1, 1, 3, Qt::AlignHCenter); layout->addWidget(yes2, 2, 1, Qt::AlignHCenter); layout->addWidget(no2, 3, 1, Qt::AlignHCenter); layout->addWidget(tpLab, 2, 2, Qt::AlignHCenter); layout->addWidget(fpLab, 2, 3, Qt::AlignHCenter); layout->addWidget(fnLab, 3, 2, Qt::AlignHCenter); layout->addWidget(tnLab, 3, 3, Qt::AlignHCenter); layout->addWidget(precLab, 4, 0, 1, 2); layout->addWidget(prec, 4, 2, 1, 2, Qt::AlignRight); layout->addWidget(recLab, 5, 0, 1, 2); layout->addWidget(rec, 5, 2, 1, 2, Qt::AlignRight); layout->addWidget(fScLab, 6, 0, 1, 2); layout->addWidget(fSc, 6, 2, 1, 2, Qt::AlignRight); layout->addWidget(accLab, 7, 0, 1, 2); layout->addWidget(acc, 7, 2, 1, 2, Qt::AlignRight); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); layout->addWidget(buttonBox, 8, 0, 1, 4, Qt::AlignHCenter); setLayout(layout); connect(buttonBox, SIGNAL(accepted()), SLOT(accept())); }