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
This commit is contained in:
eelke 2019-02-09 14:59:33 +01:00
parent 3fb88edab2
commit 3fdd42ffb2
13 changed files with 56 additions and 41 deletions

View file

@ -15,12 +15,15 @@
#include <QApplication>
#include <QStringBuilder>
#include <QSortFilterProxyModel>
#include <QTableWidget>
CatalogTablesPage::CatalogTablesPage(QWidget *parent)
: QSplitter(Qt::Horizontal, parent)
{
m_tableView = new PgLabTableView(this);
m_tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
m_tableView->setSelectionMode(QAbstractItemView::SingleSelection);
m_detailsTabs = new QTabWidget(this);
// Populate splitter
@ -29,7 +32,10 @@ CatalogTablesPage::CatalogTablesPage(QWidget *parent)
// Setup model(s)
m_tablesModel = new TablesTableModel(this);
m_tableView->setModel(m_tablesModel);
m_tablesSortFilter = new QSortFilterProxyModel(this);
m_tablesSortFilter->setSourceModel(m_tablesModel);
m_tableView->setModel(m_tablesSortFilter);
m_tableView->setSortingEnabled(true);
// - Columns page
m_columnsPage = new ColumnPage(this);
@ -70,7 +76,7 @@ CatalogTablesPage::CatalogTablesPage(QWidget *parent)
this, &CatalogTablesPage::tableListTable_layoutChanged);
}
void CatalogTablesPage::retranslateUi(bool all)
void CatalogTablesPage::retranslateUi(bool /*all*/)
{
auto set_tabtext = [this] (QWidget *widget, QString translation) {
m_detailsTabs->setTabText(m_detailsTabs->indexOf(widget), translation);