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) {
|
else if (role == Qt::TextAlignmentRole) {
|
||||||
v = GetDefaultAlignmentForType(oid);
|
v = (int)GetDefaultAlignmentForType(oid);
|
||||||
}
|
}
|
||||||
else if (role == Qt::ForegroundRole) {
|
else if (role == Qt::ForegroundRole) {
|
||||||
if (oid == BOOLOID) {
|
if (oid == BOOLOID) {
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,6 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "GlobalIoService.h"
|
#include "GlobalIoService.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QueryTab::QueryTab(MainWindow *win, QWidget *parent) :
|
QueryTab::QueryTab(MainWindow *win, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::QueryTab),
|
ui(new Ui::QueryTab),
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,25 @@
|
||||||
#include "ResultTableModelUtil.h"
|
#include "ResultTableModelUtil.h"
|
||||||
|
#include "Pgsql_oids.h"
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
|
||||||
using namespace Pgsql;
|
using namespace Pgsql;
|
||||||
|
|
||||||
int GetDefaultAlignmentForType(Oid o)
|
Qt::Alignment GetDefaultAlignmentForType(Oid o)
|
||||||
{
|
{
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
switch (o) {
|
switch (o) {
|
||||||
case INT2OID:
|
case int2_oid:
|
||||||
case INT4OID:
|
case int4_oid:
|
||||||
case INT8OID:
|
case int8_oid:
|
||||||
case FLOAT4OID:
|
case float4_oid:
|
||||||
case FLOAT8OID:
|
case float8_oid:
|
||||||
case NUMERICOID:
|
case numeric_oid:
|
||||||
case OIDOID:
|
case oid_oid:
|
||||||
r = GetDefaultNumberAlignment();
|
r = GetDefaultNumberAlignment();
|
||||||
break;
|
break;
|
||||||
case BOOLOID:
|
case bool_oid:
|
||||||
r = GetDefaultBoolAlignment(); // Qt::AlignCenter;
|
r = GetDefaultBoolAlignment(); // Qt::AlignCenter;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -31,21 +32,20 @@ QColor GetDefaultColorForType(Oid o)
|
||||||
{
|
{
|
||||||
QColor c;
|
QColor c;
|
||||||
switch (o) {
|
switch (o) {
|
||||||
case INT2OID:
|
case int2_oid:
|
||||||
case INT4OID:
|
case int4_oid:
|
||||||
case INT8OID:
|
case int8_oid:
|
||||||
c = GetDefaultIntegerColor();
|
c = GetDefaultIntegerColor();
|
||||||
break;
|
break;
|
||||||
case FLOAT4OID:
|
case float4_oid:
|
||||||
case FLOAT8OID:
|
case float8_oid:
|
||||||
c = GetDefaultFloatColor();
|
c = GetDefaultFloatColor();
|
||||||
break;
|
break;
|
||||||
case NUMERICOID:
|
case numeric_oid:
|
||||||
c = GetDefaultNumericColor();
|
c = GetDefaultNumericColor();
|
||||||
break;
|
break;
|
||||||
|
case oid_oid:
|
||||||
case OIDOID:
|
case bool_oid:
|
||||||
case BOOLOID:
|
|
||||||
default:
|
default:
|
||||||
c = Qt::black;
|
c = Qt::black;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
|
||||||
int GetDefaultAlignmentForType(Oid oid);
|
Qt::Alignment GetDefaultAlignmentForType(Oid oid);
|
||||||
QColor GetDefaultColorForType(Oid oid);
|
QColor GetDefaultColorForType(Oid oid);
|
||||||
|
|
||||||
inline int GetDefaultAlignment() { return Qt::AlignLeft + Qt::AlignVCenter; }
|
inline Qt::Alignment GetDefaultAlignment() { return Qt::AlignLeft + Qt::AlignVCenter; }
|
||||||
inline int GetDefaultBoolAlignment() { return Qt::AlignCenter + Qt::AlignVCenter; }
|
inline Qt::Alignment GetDefaultBoolAlignment() { return Qt::AlignCenter + Qt::AlignVCenter; }
|
||||||
inline int GetDefaultNumberAlignment() { return Qt::AlignRight + Qt::AlignVCenter; }
|
inline Qt::Alignment GetDefaultNumberAlignment() { return Qt::AlignRight + Qt::AlignVCenter; }
|
||||||
|
|
||||||
inline QColor GetDefaultBoolColor(bool v)
|
inline QColor GetDefaultBoolColor(bool v)
|
||||||
{
|
{
|
||||||
|
|
@ -18,6 +18,7 @@ inline QColor GetDefaultBoolColor(bool v)
|
||||||
inline QColor GetDefaultIntegerColor() { return Qt::darkBlue; }
|
inline QColor GetDefaultIntegerColor() { return Qt::darkBlue; }
|
||||||
inline QColor GetDefaultFloatColor() { return Qt::darkCyan; }
|
inline QColor GetDefaultFloatColor() { return Qt::darkCyan; }
|
||||||
inline QColor GetDefaultNumericColor() { return Qt::darkGreen; }
|
inline QColor GetDefaultNumericColor() { return Qt::darkGreen; }
|
||||||
|
inline QColor GetDefaultNullColor() { return Qt::gray; }
|
||||||
|
|
||||||
QString FormatBoolForDisplay(bool v);
|
QString FormatBoolForDisplay(bool v);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,8 @@ SOURCES += main.cpp\
|
||||||
IconColumnDelegate.cpp \
|
IconColumnDelegate.cpp \
|
||||||
IndexModel.cpp \
|
IndexModel.cpp \
|
||||||
CrudTab.cpp \
|
CrudTab.cpp \
|
||||||
CrudModel.cpp
|
CrudModel.cpp \
|
||||||
|
PgLabItemDelegate.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
QueryResultModel.h \
|
QueryResultModel.h \
|
||||||
|
|
@ -108,7 +109,8 @@ HEADERS += \
|
||||||
IconColumnDelegate.h \
|
IconColumnDelegate.h \
|
||||||
IndexModel.h \
|
IndexModel.h \
|
||||||
CrudTab.h \
|
CrudTab.h \
|
||||||
CrudModel.h
|
CrudModel.h \
|
||||||
|
PgLabItemDelegate.h
|
||||||
|
|
||||||
FORMS += mainwindow.ui \
|
FORMS += mainwindow.ui \
|
||||||
ConnectionManagerWindow.ui \
|
ConnectionManagerWindow.ui \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue