[Qt-interest] Draw QDateTime with QAbstractItemDelegate
Israel Brewster
israel at frontierflying.com
Fri Jan 8 18:20:46 CET 2010
No one? Really? I would have thought that displaying a QDateTime in a
QTableView would be a common practice. Guess not though :-). So is
there no way to do this? I mean, I can, of course, subclass the
QTableModel itself to force it to return a QDateTime object, which
then displays correctly, but that requires yet another subclass, just
to do one little thing. It would seem to me there should be some way
to tell the Delegate to simply cast the data to a QDateTime itself,
and use the fully-functional built-in DateTime display routines. Is
subclassing the model my only option? Thanks.
On Dec 30, 2009, at 3:06 PM, Israel Brewster wrote:
> I am trying to figure out how to use a QAbstractItemDelegate to draw
> a QDateTime value in easily readable form. It would appear that I
> have to override the paint() function (which is lower level than I
> would think I should have to deal with), and then do something with
> a QStyleOptionSpinBox, but I can't figure out how to make it work.
> The example in the documentation shows using a
> QStyleOptionProgressBar, which is easy as you just have to set the
> min, max, and progress properties. however, I don't see anything
> like a text, date, or time or even value property that I can set for
> a QStyleOptionSpinBox. How can I set this to display nicely? Thanks.
> -----------------------------------------------
> Israel Brewster
> Computer Support Technician II
> Frontier Flying Service Inc.
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7250 x293
> -----------------------------------------------
>
> <Israel Brewster.vcf>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100108/1106f2b0/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Israel Brewster.vcf
Type: text/directory
Size: 417 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100108/1106f2b0/attachment.bin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100108/1106f2b0/attachment-0001.html
More information about the Qt-interest-old
mailing list