Fix, display and rendering of booleans by QueryResultModel.
This commit is contained in:
parent
ad9ed1b698
commit
c6dbe72170
1 changed files with 12 additions and 8 deletions
|
|
@ -4,6 +4,8 @@
|
||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
|
using namespace Pgsql;
|
||||||
|
|
||||||
QueryResultModel::QueryResultModel(QObject *parent, std::shared_ptr<Pgsql::Result> r)
|
QueryResultModel::QueryResultModel(QObject *parent, std::shared_ptr<Pgsql::Result> r)
|
||||||
: BaseTableModel(parent)
|
: BaseTableModel(parent)
|
||||||
, result(std::move(r))
|
, result(std::move(r))
|
||||||
|
|
@ -36,18 +38,20 @@ QVariant QueryResultModel::getData(const QModelIndex &index) const
|
||||||
r = "null";
|
r = "null";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Oid o = result->type(col);
|
Oid o = result->type(col);
|
||||||
QString s(result->val(col, rij));
|
auto value = result->get(col, rij);
|
||||||
// switch (o) {
|
switch (o) {
|
||||||
// case BOOLOID:
|
case BOOLOID:
|
||||||
// s = (s == "t") ? "TRUE" : "FALSE";
|
r = bool(value); //s = (s == "t") ? "TRUE" : "FALSE";
|
||||||
// // intentional fall through
|
break;
|
||||||
// default:
|
default: {
|
||||||
|
QString s = value;
|
||||||
if (s.length() > 256) {
|
if (s.length() > 256) {
|
||||||
s.truncate(256);
|
s.truncate(256);
|
||||||
}
|
}
|
||||||
r = s;
|
r = s;
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue