Improvement to the ServerWindow
- sorting of Roles - resizeColumns voor zowel databases als roles - boolean columns now display check mark and cross
This commit is contained in:
parent
a3ba4d7c98
commit
9c9e78c54b
8 changed files with 71 additions and 44 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "BaseTableModel.h"
|
||||
#include "CustomDataRole.h"
|
||||
#include "ResultTableModelUtil.h"
|
||||
#include <QBrush>
|
||||
#include "Pgsql_oids.h"
|
||||
|
|
@ -11,23 +12,17 @@ QVariant BaseTableModel::data(const QModelIndex &index, int role) const
|
|||
Oid oid = getType(index.column());
|
||||
if (role == Qt::DisplayRole) {
|
||||
v = getData(index);
|
||||
if (oid == bool_oid) {
|
||||
v = FormatBoolForDisplay(v.toBool());
|
||||
}
|
||||
}
|
||||
else if (role == Qt::TextAlignmentRole) {
|
||||
v = (int)GetDefaultAlignmentForType(oid);
|
||||
}
|
||||
else if (role == Qt::ForegroundRole) {
|
||||
if (oid == bool_oid) {
|
||||
QVariant d = getData(index);
|
||||
if (d.type() == QVariant::Bool) {
|
||||
v = QBrush(GetDefaultBoolColor(d.toBool()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
v = QBrush(GetDefaultColorForType(oid));
|
||||
}
|
||||
}
|
||||
return v;
|
||||
else if (role == CustomDataTypeRole) {
|
||||
v = oid;
|
||||
}
|
||||
else if (role == CustomDataMeaningRole) {
|
||||
v = getDataMeaning(index);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
QVariant BaseTableModel::getDataMeaning(const QModelIndex &index) const
|
||||
{
|
||||
return static_cast<int>(DataMeaningNormal);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue