qt-material-widgets/components/table.cpp

31 lines
669 B
C++
Raw Normal View History

2016-06-19 14:27:21 +00:00
#include "table.h"
2016-03-20 09:17:59 +00:00
#include <QDebug>
#include <QEvent>
#include <QHeaderView>
2016-04-30 09:53:58 +00:00
#include "lib/style.h"
2016-03-20 08:56:51 +00:00
Table::Table(QWidget *parent)
: QTableWidget(parent)
{
setShowGrid(false);
setSelectionMode(QAbstractItemView::SingleSelection);
setSelectionBehavior(QAbstractItemView::SelectRows);
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
2016-03-20 16:43:05 +00:00
setStyle(&Style::instance());
2016-03-20 08:56:51 +00:00
}
Table::~Table()
{
}
2016-03-20 09:17:59 +00:00
void Table::paintEvent(QPaintEvent *event)
2016-03-20 08:56:51 +00:00
{
2016-03-20 09:17:59 +00:00
QHeaderView *header = horizontalHeader();
for (int i = 0; i < header->count(); ++i) {
header->setSectionResizeMode(i, QHeaderView::Stretch);
}
QTableWidget::paintEvent(event);
2016-03-20 08:56:51 +00:00
}