Couple of minor changes.

This commit is contained in:
eelke 2018-01-15 13:32:18 +01:00
parent e1405d5370
commit 3fb32f1200
5 changed files with 28 additions and 28 deletions

View file

@ -15,7 +15,7 @@ QVariant BaseTableModel::data(const QModelIndex &index, int role) const
}
}
else if (role == Qt::TextAlignmentRole) {
v = GetDefaultAlignmentForType(oid);
v = (int)GetDefaultAlignmentForType(oid);
}
else if (role == Qt::ForegroundRole) {
if (oid == BOOLOID) {

View file

@ -21,9 +21,6 @@
#include "util.h"
#include "GlobalIoService.h"
QueryTab::QueryTab(MainWindow *win, QWidget *parent) :
QWidget(parent),
ui(new Ui::QueryTab),

View file

@ -1,24 +1,25 @@
#include "ResultTableModelUtil.h"
#include "Pgsql_oids.h"
#include <QTableView>
#include <QHeaderView>
using namespace Pgsql;
int GetDefaultAlignmentForType(Oid o)
Qt::Alignment GetDefaultAlignmentForType(Oid o)
{
int r;
switch (o) {
case INT2OID:
case INT4OID:
case INT8OID:
case FLOAT4OID:
case FLOAT8OID:
case NUMERICOID:
case OIDOID:
case int2_oid:
case int4_oid:
case int8_oid:
case float4_oid:
case float8_oid:
case numeric_oid:
case oid_oid:
r = GetDefaultNumberAlignment();
break;
case BOOLOID:
case bool_oid:
r = GetDefaultBoolAlignment(); // Qt::AlignCenter;
break;
default:
@ -31,21 +32,20 @@ QColor GetDefaultColorForType(Oid o)
{
QColor c;
switch (o) {
case INT2OID:
case INT4OID:
case INT8OID:
case int2_oid:
case int4_oid:
case int8_oid:
c = GetDefaultIntegerColor();
break;
case FLOAT4OID:
case FLOAT8OID:
case float4_oid:
case float8_oid:
c = GetDefaultFloatColor();
break;
case NUMERICOID:
case numeric_oid:
c = GetDefaultNumericColor();
break;
case OIDOID:
case BOOLOID:
case oid_oid:
case bool_oid:
default:
c = Qt::black;
}

View file

@ -3,12 +3,12 @@
#include <QAbstractTableModel>
#include <QColor>
int GetDefaultAlignmentForType(Oid oid);
Qt::Alignment GetDefaultAlignmentForType(Oid oid);
QColor GetDefaultColorForType(Oid oid);
inline int GetDefaultAlignment() { return Qt::AlignLeft + Qt::AlignVCenter; }
inline int GetDefaultBoolAlignment() { return Qt::AlignCenter + Qt::AlignVCenter; }
inline int GetDefaultNumberAlignment() { return Qt::AlignRight + Qt::AlignVCenter; }
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)
{
@ -18,6 +18,7 @@ inline QColor GetDefaultBoolColor(bool v)
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);

View file

@ -68,7 +68,8 @@ SOURCES += main.cpp\
IconColumnDelegate.cpp \
IndexModel.cpp \
CrudTab.cpp \
CrudModel.cpp
CrudModel.cpp \
PgLabItemDelegate.cpp
HEADERS += \
QueryResultModel.h \
@ -108,7 +109,8 @@ HEADERS += \
IconColumnDelegate.h \
IndexModel.h \
CrudTab.h \
CrudModel.h
CrudModel.h \
PgLabItemDelegate.h
FORMS += mainwindow.ui \
ConnectionManagerWindow.ui \