Cosmetic improvements.
This commit is contained in:
parent
c324daa75b
commit
23840ce7c5
3 changed files with 46 additions and 7 deletions
|
|
@ -63,7 +63,7 @@ QVariant ColumnTableModel::headerData(int section, Qt::Orientation orientation,
|
|||
c = tr("Type");
|
||||
break;
|
||||
case NullCol:
|
||||
c = tr("Not null");
|
||||
c = tr("N");
|
||||
break;
|
||||
case DefaultCol:
|
||||
c = tr("Default");
|
||||
|
|
@ -75,6 +75,38 @@ QVariant ColumnTableModel::headerData(int section, Qt::Orientation orientation,
|
|||
}
|
||||
v = c;
|
||||
}
|
||||
else if (role == Qt::ToolTipRole) {
|
||||
if (section >= colCount) {
|
||||
const auto &tbl_idx = m_indexes[section - colCount];
|
||||
if (tbl_idx.isprimary)
|
||||
v = tr("Primary key");
|
||||
else if (tbl_idx.isunique)
|
||||
v = tr("Unique index");
|
||||
else
|
||||
v = tr("Index");
|
||||
}
|
||||
else {
|
||||
switch (section) {
|
||||
// case NameCol:
|
||||
// c = tr("Name");
|
||||
// break;
|
||||
// case TypeCol:
|
||||
// c = tr("Type");
|
||||
// break;
|
||||
case NullCol:
|
||||
v = tr("N = Column is nullable");
|
||||
break;
|
||||
case DefaultCol:
|
||||
v = tr("Default value for the columns");
|
||||
break;
|
||||
// case CollationCol:
|
||||
// c = tr("Collation");
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
|
|
@ -136,7 +168,7 @@ QVariant ColumnTableModel::getData(const QModelIndex &index) const
|
|||
s = getTypeDisplayString(*m_catalog, t.typid, t.typmod);
|
||||
break;
|
||||
case NullCol:
|
||||
s = QString::fromStdU16String(t.notnull ? u"\u2713" : u"");
|
||||
s = QString::fromStdU16String(t.notnull ? u"" : u"N");
|
||||
break;
|
||||
case DefaultCol:
|
||||
s = t.defaultValue;
|
||||
|
|
@ -186,5 +218,14 @@ QVariant ColumnTableModel::data(const QModelIndex &index, int role) const
|
|||
}
|
||||
return v;
|
||||
}
|
||||
if (role == Qt::TextAlignmentRole) {
|
||||
QVariant v;
|
||||
int col = index.column();
|
||||
if (col == NullCol || col >= colCount)
|
||||
v = Qt::AlignCenter + Qt::AlignVCenter;
|
||||
else
|
||||
v = Qt::AlignLeft + Qt::AlignVCenter;
|
||||
return v;
|
||||
}
|
||||
return BaseTableModel::data(index, role);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,14 +145,11 @@ void MainWindow::on_actionAbout_triggered()
|
|||
" INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS "
|
||||
"FOR A PARTICULAR PURPOSE.\n"
|
||||
"\n"
|
||||
"This program is dynamically linked with Qt 5.8 Copyright (C) 2016 "
|
||||
"This program is dynamically linked with Qt 5.9 Copyright (C) 2017 "
|
||||
"The Qt Company Ltd. https://www.qt.io/licensing/. \n"
|
||||
"\n"
|
||||
"Icons by fatcow http://www.fatcow.com/free-icons provided under Creative Commons "
|
||||
"attribution 3.0 license\n"
|
||||
"\n"
|
||||
"More icons by https://icons8.com/ under Creative Commons Attribution-NoDerivs 3.0 Unported "
|
||||
"license."
|
||||
"attribution 3.0 license."
|
||||
));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ void TablesPage::setCatalog(std::shared_ptr<PgDatabaseCatalog> cat)
|
|||
{
|
||||
m_catalog = cat;
|
||||
m_tablesModel->setCatalog(cat);
|
||||
ui->tableListTable->resizeColumnsToContents();
|
||||
}
|
||||
|
||||
void TablesPage::on_tableListTable_currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue