Blame view
ResultsDialog.cpp
2.49 KB
3f2992b2c V1.0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
#include "ResultsDialog.h" #include <QLabel> #include <QGridLayout> #include <QDialogButtonBox> 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("<b>Ref.</b>"); QLabel *hypText = new QLabel("<b>Hyp.</b>"); 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("<b>Precision:</b>"); QLabel *recLab = new QLabel("<b>Recall:</b>"); QLabel *fScLab = new QLabel("<b>F-Score:</b>"); QLabel *accLab = new QLabel("<b>Accuracy:</b>"); QLabel *prec = new QLabel(QString::number(precision, 'g', 3)); QLabel *rec = new QLabel(QString::number(recall, 'g', 3)); QLabel *fSc = new QLabel("<b>" + QString::number(fScore, 'g', 3) + "</b>"); 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())); } |