pgLab/pglab/PropertiesPage.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

35 lines
888 B
C++

#include "PropertiesPage.h"
#include "PgLabItemDelegate.h"
#include "PropertyProxyModel.h"
#include "ResultTableModelUtil.h"
#include "SqlCodePreview.h"
#include "PgLabTableView.h"
PropertiesPage::PropertiesPage(QWidget *parent) : QSplitter(parent)
{
m_tableView = new PgLabTableView(this);
addWidget(m_tableView);
SetTableViewDefault(m_tableView);
m_propertyProxyModel = new PropertyProxyModel(this);
m_tableView->setModel(m_propertyProxyModel);
auto item_delegate = new PgLabItemDelegate(this);
m_tableView->setItemDelegate(item_delegate);
m_tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
}
void PropertiesPage::setSourceModel(QAbstractItemModel *model)
{
m_propertyProxyModel->setSourceModel(model);
}
void PropertiesPage::setActiveRow(const QModelIndex &row)
{
m_propertyProxyModel->setActiveRow(row);
m_tableView->resizeColumnsToContents();
}