5 #include "scoretable.h"
6 #include "matchdaymodel.h"
8 ScoreTable::ScoreTable(MatchDayModel* model, QWidget *parent) :
15 this->setModel(model);
18 this->setSelectionMode(QAbstractItemView::NoSelection);
21 palette.setColor(QPalette::Background, QColor(0, 0, 0, 200));
23 this->verticalHeader()->hide();
24 this->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
25 this->verticalHeader()->setMinimumSectionSize(1);
26 this->horizontalHeader()->hide();
27 this->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
28 this->horizontalHeader()->setMinimumSectionSize(1);
30 this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
31 this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
33 this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
34 this->setAttribute(Qt::WA_TranslucentBackground);
35 this->viewport()->setAttribute(Qt::WA_TranslucentBackground);
37 this->setShowGrid(false);
40 QSize ScoreTable::sizeHint() const
45 for (int i = 0; i < horizontalHeader()->count(); i++) {
46 s.setWidth(s.width() + horizontalHeader()->sectionSize(i));
49 for (int i = 0; i < verticalHeader()->count(), i < maxrows; i++) {
50 s.setHeight(s.height() + verticalHeader()->sectionSize(i));
52 // add missing few pixels (from borders mabye?)
53 // TODO: find better solution!
54 s.setHeight(s.height() + 2);
59 void ScoreTable::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
61 // this will recalculate section sizes
62 QTableView::dataChanged(topLeft, bottomRight);