PDA

View Full Version : QTableView not corectly showing empty fields



Sergey B.
14th June 2007, 13:40
Windows XP SP2, OS X 10.4.8
PostgreSQL 8.1.3
Short description:
QTableView isn't showing correctly empty fields "timestamp without time zone " type
What I did:
I have a SLOT


acceptedmodel=new QSqlQueryModel(this);
acceptedmodel->setQuery("SELECT orders.key, orders.time_order,
orders.phone, orders.address, orders.address_finished,
operators.operator_name, orders.time_driver_lock,
orders.time_driver_wait, orders.time_driver_go,
carting.carting_name, drivers.nickname FROM orders LEFT JOIN carting
ON orders.typecarting=carting.key LEFT JOIN operators ON
operators.key=orders.operator_open LEFT JOIN drivers on
orders.driver=drivers.key WHERE orders.isaccepted=TRUE ORDER BY
time_order;");
if (acceptedmodel->lastError().isValid())
{
QMessageBox::information(this, tr("Qtaxi"),
acceptedmodel->lastError().databaseText());
return;
}
acceptedmodel->setHeaderData(0, Qt::Horizontal, tr("Num"));
acceptedmodel->setHeaderData(1, Qt::Horizontal, tr("Order time"));
acceptedmodel->setHeaderData(2, Qt::Horizontal, tr("Call to"));
acceptedmodel->setHeaderData(3, Qt::Horizontal, tr("Address"));
acceptedmodel->setHeaderData(4, Qt::Horizontal, tr("Go to"));
acceptedmodel->setHeaderData(5, Qt::Horizontal, tr("Order
operator"));
acceptedmodel->setHeaderData(6, Qt::Horizontal, tr("Driver go to"));
acceptedmodel->setHeaderData(7, Qt::Horizontal, tr("Driver wait"));
acceptedmodel->setHeaderData(8, Qt::Horizontal, tr("Driver out"));
acceptedmodel->setHeaderData(9, Qt::Horizontal, tr("Carting"));
acceptedmodel->setHeaderData(10, Qt::Horizontal, tr("Nick"));
acceptedtableView->setModel(acceptedmodel);
acceptedselection=acceptedtableView->selectionModel();
connect(acceptedselection, SIGNAL(currentChanged(const QModelIndex
&, const QModelIndex &)), this, SLOT(SetAcceptedIndex(const
QModelIndex &)));
acceptedtableView->resizeColumnsToContents();
}


What I expected to see:
when I open form I see then empty fields in database ("timestamp
without time zone " type), isn't showing correctly in QTableView.
I see "01.01.-4713 0.00.00", (Russian locale, USA locale isn't showing
correctly too) :(


I have some screenshots, and I can send it to you...

Does anybody can testing this?

screenshots
http://www.axifile.com?271086
http://www.axifile.com?8974694
http://www.axifile.com?5108423

jpn
14th June 2007, 20:30
screenshots
http://www.axifile.com?271086
http://www.axifile.com?8974694
http://www.axifile.com?5108423
Could you please attach the screenshots directly on the forums?

Sergey B.
14th June 2007, 20:56
Could you please attach the screenshots directly on the forums?

Okey.
Sorry, don't see "manage attachments" :(

jpn
14th June 2007, 21:17
Hmm, I'm not sure, maybe this is a bug in psql plugin/driver? Perhaps you could try subclassing QSqlQueryModel and fixing the date time by hand (in QAbstractItemModel::data()) as a temporary workaround?

Sergey B.
15th June 2007, 08:18
It's a bug (regression)
http://trolltech.com/developer/task-tracker/index_html?id=167228&method=entry