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
36
pglab/BaseTableModel.cpp
Normal file
36
pglab/BaseTableModel.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#include "BaseTableModel.h"
|
||||
#include "ResultTableModelUtil.h"
|
||||
#include <QBrush>
|
||||
|
||||
using namespace Pgsql;
|
||||
|
||||
BaseTableModel::BaseTableModel(QObject *parent)
|
||||
: QAbstractTableModel(parent)
|
||||
{}
|
||||
|
||||
QVariant BaseTableModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
QVariant v;
|
||||
Oid oid = getType(index.column());
|
||||
if (role == Qt::DisplayRole) {
|
||||
v = getData(index);
|
||||
if (oid == BOOLOID) {
|
||||
v = FormatBoolForDisplay(v.toBool());
|
||||
}
|
||||
}
|
||||
else if (role == Qt::TextAlignmentRole) {
|
||||
v = GetDefaultAlignmentForType(oid);
|
||||
}
|
||||
else if (role == Qt::ForegroundRole) {
|
||||
if (oid == BOOLOID) {
|
||||
QVariant d = getData(index);
|
||||
if (d.type() == QVariant::Bool) {
|
||||
v = QBrush(GetDefaultBoolColor(d.toBool()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
v = QBrush(GetDefaultColorForType(oid));
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue