pgLab/pglab/PgLabTableView.cpp
eelke 3fdd42ffb2 Collection of small fixes and improvements
- Selections stay clearly visible when focus changes to other widget
- Autoresize columns
- Table properties view now correctly allows selection in both columns and draws selection correctly
- Tables can be sorted again and now by any column
2019-02-09 14:59:33 +01:00

22 lines
693 B
C++

#include "PgLabTableView.h"
#include "PgLabItemDelegate.h"
#include <QHeaderView>
#include <QSortFilterProxyModel>
PgLabTableView::PgLabTableView(QWidget *parent)
: QTableView(parent)
{
setAlternatingRowColors(true);
setItemDelegate(new PgLabItemDelegate(this));
setWordWrap(false);
auto pal = palette();
pal.setColor(QPalette::Inactive, QPalette::Highlight, pal.color(QPalette::Active, QPalette::Highlight));
pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Active, QPalette::HighlightedText));
setPalette(pal);
auto vertical_header = verticalHeader();
vertical_header->setMinimumSectionSize(16);
vertical_header->setDefaultSectionSize(20);
}