#include <QtGui>
-#include <QDirModel>
-#include <QListView>
-#include <QStandardItemModel>
#include "main-window.h"
#include "score-dialog.h"
#include "course-dialog.h"
-#include "xml-parser.h"
+#include "stat-model.h"
#include "xml-dom-parser.h"
QString appName("scorecard");
// Sort the scores based on dates
qSort(scoreList.begin(), scoreList.end(), dateLessThan);
-
createActions();
createMenus();
table->showGrid();
table->setModel(scoreTableModel);
- QItemSelectionModel selectionModel();
table->setSelectionMode(QAbstractItemView::NoSelection);
scoreTableModel->setScore(scoreList);
void MainWindow::viewStatistics()
{
- QMainWindow *statWindow = new QMainWindow(this);
+ QMainWindow *win = new QMainWindow(this);
+ QString title = "Statistics";
+ win->setWindowTitle(title);
- //QWidget *centralWidget = new QWidget(statWindow);
+ StatModel *statModel = new StatModel(clubList, scoreList);
- //setCentralWidget(centralWidget);
+ QTableView *table = new QTableView;
+ table->showGrid();
+ table->setSelectionMode(QAbstractItemView::NoSelection);
+ table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
+ table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
+ table->verticalHeader()->setAutoFillBackground(true);
+ table->setModel(statModel);
+ QWidget *central = new QWidget(win);
+ win->setCentralWidget(central);
- QString foo = "some longer text is needed here : 17";
- QTextEdit *textEdit = new QTextEdit(foo);
-
- QLabel *label = new QLabel;
- label->setScaledContents(true);
+ QPushButton *b1 = new QPushButton("Graphs");
- QString text = "foo : bar";
+ QVBoxLayout *buttonLayout = new QVBoxLayout;
+ buttonLayout->addWidget(b1);
- text.append("Scores: 17");
+ QTextEdit *textEdit = new QTextEdit;
+ //getStat(textEdit);
- label->setAlignment(Qt::AlignCenter);
- label->setText(text);
+ textEdit->setReadOnly(true);
- QString title = "Statistics";
- statWindow->setWindowTitle(title);
+ QVBoxLayout *infoLayout = new QVBoxLayout;
+ infoLayout->addWidget(table);
- QVBoxLayout *layout = new QVBoxLayout;
- //layout->addWidget(label);
- layout->addWidget(textEdit);
+ QHBoxLayout *mainLayout = new QHBoxLayout(central);
+ mainLayout->addLayout(infoLayout);
+ mainLayout->addLayout(buttonLayout);
- //statWindow->setLayout(layout);
+ central->setLayout(mainLayout);
- //setCentralWidget(statWindow);
- statWindow->show();
+ win->show();
}
void MainWindow::loadScoreFile(QString &fileName, QList<Score *> &list)