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");
|
c = tr("Type");
|
||||||
break;
|
break;
|
||||||
case NullCol:
|
case NullCol:
|
||||||
c = tr("Not null");
|
c = tr("N");
|
||||||
break;
|
break;
|
||||||
case DefaultCol:
|
case DefaultCol:
|
||||||
c = tr("Default");
|
c = tr("Default");
|
||||||
|
|
@ -75,6 +75,38 @@ QVariant ColumnTableModel::headerData(int section, Qt::Orientation orientation,
|
||||||
}
|
}
|
||||||
v = c;
|
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;
|
return v;
|
||||||
|
|
@ -136,7 +168,7 @@ QVariant ColumnTableModel::getData(const QModelIndex &index) const
|
||||||
s = getTypeDisplayString(*m_catalog, t.typid, t.typmod);
|
s = getTypeDisplayString(*m_catalog, t.typid, t.typmod);
|
||||||
break;
|
break;
|
||||||
case NullCol:
|
case NullCol:
|
||||||
s = QString::fromStdU16String(t.notnull ? u"\u2713" : u"");
|
s = QString::fromStdU16String(t.notnull ? u"" : u"N");
|
||||||
break;
|
break;
|
||||||
case DefaultCol:
|
case DefaultCol:
|
||||||
s = t.defaultValue;
|
s = t.defaultValue;
|
||||||
|
|
@ -186,5 +218,14 @@ QVariant ColumnTableModel::data(const QModelIndex &index, int role) const
|
||||||
}
|
}
|
||||||
return v;
|
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);
|
return BaseTableModel::data(index, role);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,14 +145,11 @@ void MainWindow::on_actionAbout_triggered()
|
||||||
" INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS "
|
" INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS "
|
||||||
"FOR A PARTICULAR PURPOSE.\n"
|
"FOR A PARTICULAR PURPOSE.\n"
|
||||||
"\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"
|
"The Qt Company Ltd. https://www.qt.io/licensing/. \n"
|
||||||
"\n"
|
"\n"
|
||||||
"Icons by fatcow http://www.fatcow.com/free-icons provided under Creative Commons "
|
"Icons by fatcow http://www.fatcow.com/free-icons provided under Creative Commons "
|
||||||
"attribution 3.0 license\n"
|
"attribution 3.0 license."
|
||||||
"\n"
|
|
||||||
"More icons by https://icons8.com/ under Creative Commons Attribution-NoDerivs 3.0 Unported "
|
|
||||||
"license."
|
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ void TablesPage::setCatalog(std::shared_ptr<PgDatabaseCatalog> cat)
|
||||||
{
|
{
|
||||||
m_catalog = cat;
|
m_catalog = cat;
|
||||||
m_tablesModel->setCatalog(cat);
|
m_tablesModel->setCatalog(cat);
|
||||||
|
ui->tableListTable->resizeColumnsToContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TablesPage::on_tableListTable_currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
void TablesPage::on_tableListTable_currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue