[Qt-interest] Display price in QTableView?
Israel Brewster
israel at frontierflying.com
Tue Jan 13 21:01:44 CET 2009
I am looking for a good solution to display a price in a QTableView.
Just using widgets this is easy: I simply use a QDoubleSpinBox, set
the prefix to $, and set it to display two decimals. I'm looking for
something like the createEditor function of QItemDelegate, but that
doesn't appear to exist. I looked at the paint() function, but the
example I found used QStyleOptions, the closest of which was just a
SpinBox (not DoubleSpinBox), had no way to set a prefix that could
find, and didn't work for me anyway. I also considered re-implementing
the data function of the underlying QSqlTableModel, but then it would
have to return a string to get the "$", which would make editing it
more difficult, if not impossible. Is there a better way of doing this
that I am missing here? Thanks.
-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------
More information about the Qt-interest-old
mailing list