Messy commit. Testing suff and some improvements to how data is shown.
This commit is contained in:
parent
bebb3391c3
commit
3a13b7ffb4
59 changed files with 2045 additions and 716 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "QueryResultModel.h"
|
||||
#include "ResultTableModelUtil.h"
|
||||
#include "Pgsql_declare.h"
|
||||
#include <QBrush>
|
||||
#include <QColor>
|
||||
|
|
@ -36,7 +37,7 @@ QVariant QueryResultModel::data(const QModelIndex &index, int role) const
|
|||
Oid o = result->type(col);
|
||||
QString s(result->val(col, rij));
|
||||
switch (o) {
|
||||
case oid_bool:
|
||||
case BOOLOID:
|
||||
s = (s == "t") ? "TRUE" : "FALSE";
|
||||
// intentional fall through
|
||||
default:
|
||||
|
|
@ -50,23 +51,7 @@ QVariant QueryResultModel::data(const QModelIndex &index, int role) const
|
|||
}
|
||||
}
|
||||
else if (role == Qt::TextAlignmentRole) {
|
||||
Oid o = result->type(col);
|
||||
switch (o) {
|
||||
case oid_int2:
|
||||
case oid_int4:
|
||||
case oid_int8:
|
||||
case oid_float4:
|
||||
case oid_float8:
|
||||
case oid_numeric:
|
||||
case oid_oid:
|
||||
r = Qt::AlignRight + Qt::AlignVCenter;
|
||||
break;
|
||||
case oid_bool:
|
||||
r = Qt::AlignCenter;
|
||||
break;
|
||||
default:
|
||||
r = Qt::AlignLeft + Qt::AlignVCenter;
|
||||
}
|
||||
r = GetDefaultAlignmentForType(result->type(col));
|
||||
}
|
||||
else if (role == Qt::ForegroundRole) {
|
||||
if (result->null(col, rij)) {
|
||||
|
|
@ -75,19 +60,19 @@ QVariant QueryResultModel::data(const QModelIndex &index, int role) const
|
|||
else {
|
||||
Oid o = result->type(col);
|
||||
switch (o) {
|
||||
case oid_int2:
|
||||
case oid_int4:
|
||||
case oid_int8:
|
||||
case INT2OID:
|
||||
case INT4OID:
|
||||
case INT8OID:
|
||||
r = QBrush(Qt::darkBlue);
|
||||
break;
|
||||
case oid_float4:
|
||||
case oid_float8:
|
||||
case FLOAT4OID:
|
||||
case FLOAT8OID:
|
||||
r = QBrush(Qt::darkCyan);
|
||||
break;
|
||||
case oid_numeric:
|
||||
case NUMERICOID:
|
||||
r = QBrush(Qt::darkGreen);
|
||||
break;
|
||||
case oid_bool:
|
||||
case BOOLOID:
|
||||
if (strcmp(result->val(col, rij), "t") == 0) {
|
||||
r = QBrush(Qt::darkGreen);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue