From a24c010be1e491265a645002ae48feef9e1cc204 Mon Sep 17 00:00:00 2001 From: laserpants Date: Sun, 20 Mar 2016 11:56:51 +0300 Subject: [PATCH] implement basic Table component --- components/table.cpp | 18 ++++++++++++++++++ components/table.h | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/components/table.cpp b/components/table.cpp index e89d72a..8074e54 100644 --- a/components/table.cpp +++ b/components/table.cpp @@ -1 +1,19 @@ #include "table.h" + +Table::Table(QWidget *parent) + : QTableWidget(parent) +{ + setShowGrid(false); + setSelectionMode(QAbstractItemView::SingleSelection); + setSelectionBehavior(QAbstractItemView::SelectRows); + setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); +} + +Table::~Table() +{ +} + +bool Table::eventFilter(QObject *obj, QEvent *event) +{ + return QTableWidget::eventFilter(obj, event); +} diff --git a/components/table.h b/components/table.h index e69de29..21cf59d 100644 --- a/components/table.h +++ b/components/table.h @@ -0,0 +1,18 @@ +#ifndef TABLE_H +#define TABLE_H + +#include + +class Table : public QTableWidget +{ + Q_OBJECT + +public: + explicit Table(QWidget *parent = 0); + ~Table(); + +protected: + bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE; +}; + +#endif // TABLE_H