PDA

View Full Version : QsqlTableModel: how allow user to change font style and size of text



dtkerns
23rd April 2013, 15:30
I'm picking up maintenance of an existing QT4 app, I have a request to allow the end user to adjust the font style/size of a popup table. The table is populated via an sql query, the "last" call I see is setQuery() and the thread disappears into the Qt ether! Based on my reading of other threads I may need to re-implement QsqlTableModel and implement some additional methods. Can I get recommendations on the easiest path?

ChrisW67
23rd April 2013, 20:55
QIdentityProxyModel or QAbstractProxyModel (depending on exactly which Qt4 version) between the existing model and the view. Provide a version of data() that returns desired values for the Qt::FontRole (and perhaps others) and the default for everything else.

dtkerns
25th April 2013, 14:25
thanks for the info, hopefully I'll get back to this to try it out today, I'll be back with a "thanks" or more details!