update dict
[QFreeRecite.git] / src / gui / MainWidget.cpp
blobf9ff1929925b7ddee8c88916a35a85c8d1bffcea
1 #include <QHeaderView>
2 #include <QModelIndex>
3 #include <Reciter.h>
4 #include <fstream>
5 #include <set>
7 #include <Debug.h>
8 #include "MainWidget.h"
9 #include "TaskModel.h"
11 MainWidget::MainWidget(QWidget *parent)
12 : QWidget(parent),taskModel(0)
14 setupUi(this);
15 setWindowFlags(Qt::FramelessWindowHint);
16 taskModel = new TaskModel(this);
17 taskTableView->setModel(taskModel);
18 taskTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
19 taskTableView->setSelectionMode(QAbstractItemView::SingleSelection);
20 taskTableView->setShowGrid(false);
21 taskTableView->resizeColumnsToContents();
22 taskTableView->setAlternatingRowColors(true);
23 taskTableView->horizontalHeader()->setStretchLastSection(true);
24 if(taskModel->rowCount() > 0)
25 taskTableView->setCurrentIndex(taskModel->index(0,0));
28 MainWidget::~MainWidget() {
29 D_OUTPUT("~MainWidget")
32 time_t MainWidget::getCurrentTaskID() const {
33 QModelIndex currIndex = taskTableView->selectionModel()->currentIndex();
34 return taskModel->getTaskID(currIndex);
37 void MainWidget::updateMode() {
38 taskModel->updateMode();