Couple of minor changes.
This commit is contained in:
parent
e1405d5370
commit
3fb32f1200
5 changed files with 28 additions and 28 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -21,9 +21,6 @@
|
|||
#include "util.h"
|
||||
#include "GlobalIoService.h"
|
||||
|
||||
|
||||
|
||||
|
||||
QueryTab::QueryTab(MainWindow *win, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::QueryTab),
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue