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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue