From: Sakari Poussa Date: Tue, 3 Nov 2009 23:35:32 +0000 (+0200) Subject: Initial stat view attempt X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;ds=sidebyside;h=84c91b37d6d39aba4710d584232ea8e514df5d55;p=scorecard Initial stat view attempt --- diff --git a/src/main-window.cpp b/src/main-window.cpp index e81997a..1fa5527 100644 --- a/src/main-window.cpp +++ b/src/main-window.cpp @@ -32,7 +32,7 @@ MainWindow::MainWindow(QMainWindow *parent): QMainWindow(parent) loadSettings(); - QWidget *centralWidget = new QWidget(this); + centralWidget = new QWidget(this); setCentralWidget(centralWidget); @@ -170,11 +170,11 @@ void MainWindow::createActions() viewCourseAct = new QAction(tr("&View Courses"), this); connect(viewCourseAct, SIGNAL(triggered()), this, SLOT(viewCourse())); - - viewStatisticAct = new QAction(tr("&View Statistics"), this); - connect(viewStatisticAct, SIGNAL(triggered()), this, SLOT(viewStatistic())); #endif + statAct = new QAction(tr("Statistics"), this); + connect(statAct, SIGNAL(triggered()), this, SLOT(viewStatistics())); + nextAct = new QAction(tr( " Next "), this); connect(nextAct, SIGNAL(triggered()), this, SLOT(nextButtonClicked())); @@ -200,6 +200,7 @@ void MainWindow::createMenus() menu->addAction(newCourseAct); menu->addAction(editScoreAct); menu->addAction(editCourseAct); + menu->addAction(statAct); } void MainWindow::updateStatusBar() @@ -413,6 +414,41 @@ void MainWindow::editScore() } } +void MainWindow::viewStatistics() +{ + QMainWindow *statWindow = new QMainWindow(this); + + //QWidget *centralWidget = new QWidget(statWindow); + + //setCentralWidget(centralWidget); + + + QString foo = "some longer text is needed here : 17"; + QTextEdit *textEdit = new QTextEdit(foo); + + QLabel *label = new QLabel; + label->setScaledContents(true); + + QString text = "foo : bar"; + + text.append("Scores: 17"); + + label->setAlignment(Qt::AlignCenter); + label->setText(text); + + QString title = "Statistics"; + statWindow->setWindowTitle(title); + + QVBoxLayout *layout = new QVBoxLayout; + //layout->addWidget(label); + layout->addWidget(textEdit); + + //statWindow->setLayout(layout); + + //setCentralWidget(statWindow); + statWindow->show(); +} + void MainWindow::loadScoreFile(QString &fileName, QList &list) { ScoreXmlHandler handler(list); diff --git a/src/main-window.h b/src/main-window.h index abcaef7..753a131 100644 --- a/src/main-window.h +++ b/src/main-window.h @@ -39,6 +39,7 @@ private slots: void editScore(); void newCourse(); void editCourse(); + void viewStatistics(); private: @@ -58,6 +59,7 @@ private: // Layouts QVBoxLayout *tableLayout; QVBoxLayout *buttonLayout; + QWidget *centralWidget; // Menus QMenu *menu; @@ -76,6 +78,7 @@ private: QAction *editScoreAct; QAction *newCourseAct; QAction *editCourseAct; + QAction *statAct; QAction *firstAct; QAction *lastAct; QAction *nextAct; @@ -83,7 +86,6 @@ private: QAction *viewScoreAct; QAction *viewCourseAct; - QAction *viewStatisticAct; void createMenus(); void createActions();