In Qtableview convet julianday to Qdate
-
i have table in database which stores date in julianday ,
I use QSQLRelationaltablemodel for the tableview model
the table view displays the data in integer format so how i can i convert integer to Qdate in the qtableviewi can use QDate::FromJulianDay ( int jd ) but how to do it in qtableview
please reply -
-
Hi and welcome to DevNet,
One way to do that is to use a "delegate":http://qt-project.org/doc/qt-4.8/qstyleditemdelegate.html that simply translate your integer to a QDate and from the QDate to string.
Hope it helps
-
Something like "this":http://qt-project.org/doc/qt-4.8/qabstractitemview.html#setItemDelegateForColumn ?
-
"This":http://qt-project.org/forums/viewthread/7428 is the solution.
-
No it's not, it's an explanation on how to calculate a QDateTime from a Julian day, not how to show it as a QDateTime in a QTableView
-
Yes, and then show it in the table view. Other way to convert it is using SQLite's strftime.