Logo Search packages:      
Sourcecode: kbruch version File versions  Download package

StatisticsView::StatisticsView ( QWidget *  parent = 0 )

constructor

Definition at line 40 of file statisticsview.cpp.

References calc(), and resetStatistics().

                                                :
    QFrame (parent), m_count (0), m_correct (0)
{
#ifdef DEBUG
    kDebug() << "constructor StatisticsView()";
#endif
    // load statistics from config file
    m_count = SettingsClass::count();
    m_correct = SettingsClass::correct();
    m_skipped = SettingsClass::skipped();

    defaultFont = SettingsClass::taskFont();
    defaultFont.setBold (true);
    defaultFont.setPointSize (28);

    QPalette pal;

    /* create a grid to show the labels */
    labelGrid = new QGridLayout();
    setLayout (labelGrid);

    labelGrid->setColumnStretch (0, 1);
    labelGrid->setColumnStretch (6, 1);

    labelGrid->setColumnMinimumWidth (5, 220);
    labelGrid->setColumnMinimumWidth (2, 30);

    result1Label = new QLabel (this);
    labelGrid->addWidget (result1Label, 1, 1, 2, 1);
    result1Label->setFont (defaultFont);
    result1Label->setAlignment (Qt::AlignCenter);
    result1Label->setToolTip (
        i18n ("This is the current total number of solved tasks."));

    defaultFont.setBold (false);
    defaultFont.setPointSize (10);

    info1Label = new QLabel (this);
    info1Label->setText (i18n ("Questions:"));
    info1Label->setFont (defaultFont);
    info1Label->setAlignment (Qt::AlignCenter);
    labelGrid->addWidget (info1Label, 0, 1);

    info2Label = new QLabel (this);
    info2Label->setText (i18nc ("@info:status the number of correct answers", "Correct:"));
    info2Label->setFont (defaultFont);
    info2Label->setAlignment (Qt::AlignVCenter | Qt::AlignRight);
    labelGrid->addWidget (info2Label, 0, 3);

    info4Label = new QLabel (this);
    info4Label->setText (i18nc ("@info:status the number of incorrect answers", "Incorrect:"));
    info4Label->setFont (defaultFont);
    info4Label->setAlignment (Qt::AlignVCenter | Qt::AlignRight);
    labelGrid->addWidget (info4Label, 1, 3);

    info3Label = new QLabel (this);
    info3Label->setText (i18nc ("@info:status the number of skipped answers", "Skipped:"));
    info3Label->setFont (defaultFont);
    info3Label->setAlignment (Qt::AlignVCenter | Qt::AlignRight);
    labelGrid->addWidget (info3Label, 2, 3);

    defaultFont.setBold (true);

    result2Label = new QLabel (this);
    labelGrid->addWidget (result2Label, 0, 4);
    result2Label->setFont (defaultFont);
    result2Label->setToolTip (
        i18n ("This is the current total number of correctly solved tasks."));

    result4Label = new QLabel (this);
    labelGrid->addWidget (result4Label, 1, 4);
    result4Label->setFont (defaultFont);
    result4Label->setToolTip (
        i18n ("This is the current total number of unsolved tasks."));

    result3Label = new QLabel (this);
    labelGrid->addWidget (result3Label, 2, 4);
    result3Label->setFont (defaultFont);
    result3Label->setToolTip (
        i18n ("This is the current total number of skipped tasks."));

    // add tooltip and qwhatsthis help to the widget
    setToolTip (i18n ("This part of the window shows the statistics."));
    setWhatsThis (i18n ("This part of the window shows the statistics.  Each exercise you do is counted. You can reset the statistics by clicking on the 'New' button in the toolbar or by selecting 'New' from the 'File' menu"));

    QBoxLayout * cLayout = new QBoxLayout (QBoxLayout::LeftToRight);

    statisticsBar = new StatisticsBarWidget (this);
    labelGrid->addWidget (statisticsBar, 0, 5, 3, 1);
    labelGrid->addLayout (cLayout, 0, 5, Qt::AlignCenter);

    // add reset button and connect
    resetButton = new QPushButton (this);
    resetButton->setObjectName ("resetButton");
    resetButton->setText (i18n ("&Reset"));
    resetButton->setToolTip (i18n ("Click this button to reset the statistics."));
    resetButton->setFont (defaultFont);
    QObject::connect (resetButton, SIGNAL (clicked()), this, SLOT (resetStatistics()));
    labelGrid->addWidget (resetButton, 5, 5, Qt::AlignRight);

    /* calculate the statistics */
    (void) calc();
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index