pgLab/pglab/ResultTableModelUtil.h

54 lines
1.5 KiB
C
Raw Normal View History

#pragma once
#include "Pgsql_oids.h"
#include <QAbstractTableModel>
#include <QColor>
#include <util/Colors.h>
2018-01-15 13:32:18 +01:00
Qt::Alignment GetDefaultAlignmentForType(Oid oid);
// inline QColor GetDefaultColorForType(Oid oid)
// {
// using namespace Pgsql;
// const ColorTheme &theme = GetColorTheme();
// QColor c;
// switch (oid) {
// case int2_oid:
// case int4_oid:
// case int8_oid:
// c = theme.integerColor;
// break;
// case float4_oid:
// case float8_oid:
// c = theme.floatColor;
// break;
// case numeric_oid:
// c = theme.numericColor;
// break;
// case oid_oid:
// case bool_oid:
// default:
// c = Qt::black;
// }
// return c;
// }
2019-01-06 21:37:57 +01:00
inline Qt::Alignment GetDefaultAlignment() { return Qt::AlignLeft | Qt::AlignVCenter; }
inline Qt::Alignment GetDefaultBoolAlignment() { return Qt::AlignCenter | Qt::AlignVCenter; }
inline Qt::Alignment GetDefaultNumberAlignment() { return Qt::AlignRight | Qt::AlignVCenter; }
inline QColor GetDefaultBoolColor(bool v)
{
const ColorTheme& colorTheme = GetColorTheme();
return v ? colorTheme.booleanTrue : colorTheme.booleanFalse;
}
// inline QColor GetDefaultIntegerColor() { return Qt::darkBlue; }
// inline QColor GetDefaultFloatColor() { return Qt::darkCyan; }
// inline QColor GetDefaultNumericColor() { return Qt::darkGreen; }
// inline QColor GetDefaultNullColor() { return Qt::gray; }
QString FormatBoolForDisplay(bool v);
class QTableView;
void SetTableViewDefault(QTableView *tv);