View Full Version : SQL / MVC : Advice on best choice between pure SQL against QTableModel

4th June 2009, 15:56
Hi everybody,

I have actually a QStandardItemModel where I set sometimes items with a QFontRole or QDecorationRole to display an image or another (so it could be a bool in database for example).

I have not experienced so much with the 2 approachs but like the QTableModel approach. But I wonder if I will be easily able to add a QFontRole to all the columns of a row depending on the bool value.

For the ability to display an image or another on the bool column, I suppose this is do-able as I've seen the books example with the "stars rating" custom delegate.

So, I almost wonder if I could do something with QFontRole on a QTableModel or if it should be better to deal with the other approach with pure SQL then dealing with the model myself.

Thanks for your advice.

4th June 2009, 18:44
Ok, my question is perhaps totally stupid but I am quite tired and my attention is not really focussed today ;o)

Why the hell dealing with higher level stuffs like QSqlTableModel when we know all about SQL requests ;o)

But perhaps I'm wrong and if I what I would like to achieve with specific role is possible at a higher-level, it could be nice to stay on a C++ / Qt / model friendly syntax...