[Interest] QTableView, QSqlRelationalTableModel and QDateTimeEdit and timezones

Lisandro Damián Nicanor Pérez Meyer perezmeyer at gmail.com
Thu Apr 30 21:04:37 CEST 2020


Hi!

I have a database (PostgreSql) with a table that holds date/time in
UTC. I've read this table with the QSqlRelationalTableModel and show
the data with a QTableView and a QDateTimeEdit.

I would like both the QTableView and the QDateEdit to show the time in
local timezone, but I seem to be failing at this.

I have tried with
ui->admissionDateTimeEdit->setTimeSpec(Qt::OffsetFromUTC) and other
time specs both before and after setting the model without success
(there is a bug for that in [1])

Is there something else I am missing?

The actual code is in [2] but it's not minimal. If needed I'll try to
get a minimal example for this.

[1] <https://bugreports.qt.io/browse/QTBUG-54781>
[2] <https://gitlab.com/mosimpa/abm/-/blob/feature/manage-internments/src/internmentsform.cpp>

Thanks in advance!

-- 
Lisandro Damián Nicanor Pérez Meyer
http://perezmeyer.com.ar/
http://perezmeyer.blogspot.com/


More information about the Interest mailing list