Hello,

I am developing a mobile application with Nokia Qt SDK.
I have a table in a QSqlDatabase that I feed from a rss news feed.
I want to display those news in a list but I am new to Qt so I don't know what is the best solution.

I guess I need a QListView and set its model to a QSqlTableModel bind to my QSqlDatabase table.

But then I don't know how to display items (rows) in a custom way i.e. using widgets.
I know the QItemDelegate is there for that but how can I draw my custom widget build from data in QModelIndex into the painter object of the paint method :

Qt Code:
  1. MyItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
  2. {
  3. //Retrieve data from the model (a map with the news elements)
  4. QVariantMap data = index.model()->data(index, Qt::DisplayRole);
  5.  
  6. //Construct a custom widget from data in the map
  7. QWidget *item = new Widget;
  8. QLabel *title = new QLabel(item);
  9. title->setText(data.value("title").toString());
  10.  
  11. //.... add more elements to the widget from the data ....
  12.  
  13. // now paint the item widget in the painter but how ???
  14. }
To copy to clipboard, switch view to plain text mode 

Thanks for the help