1

I'm a beginner with QT/PyQt4, and I'm trying to make a QListView display custom objects.

It should :

  1. Have custom row widgets that display more than one line of text, possibly images
  2. Trigger a modal dialog instead of the inline edit field whenever I double-click on an item

A QItemDelegate seems like the right choice, but I can't figure out how to use it properly for either #1 or #2. Any ideas?

F.X.
  • 6,809
  • 3
  • 49
  • 71
  • Will the images be placed within text or into a separate column? – AlexVhr Aug 30 '13 at 13:19
  • No separate columns. I just want to display additional information within the same row, without making it a full table view. A little like Android's Preference screens or, for example, the Transmission UI (http://www.johnoriordan.ie/wp-content/uploads/2013/04/Transmission_web_interface.png). – F.X. Aug 30 '13 at 14:07
  • Multiple types of data in a single "cell"... Maybe HTML is the answer? In that case this link could be useful: http://stackoverflow.com/questions/1956542/how-to-make-item-view-render-rich-html-text-in-qt - look for the answer which describes doing it in PyQt – AlexVhr Aug 30 '13 at 14:10
  • You mean [this](http://harmattan-dev.nokia.com/docs/library/html/qt4/richtext-html-subset.html)? So I could just write something like `My Title
    Additional information` and it would render correctly in the `QListView`? Damn, that's pretty sweet, I'll give it a try and let you know if it worked!
    – F.X. Aug 30 '13 at 14:14
  • Yes, that's exactly what I mean. Good luck! – AlexVhr Aug 30 '13 at 14:17
  • QStyledItemDelegate cannot display HTML. You need to create or use a custom delegate, like that: http://stackoverflow.com/questions/1956542/how-to-make-item-view-render-rich-html-text-in-qt – Dimitry Ernot Aug 30 '13 at 15:06
  • I think that's exactly what @AlexVhr linked to earlier, but thanks ;) – F.X. Aug 30 '13 at 15:18

0 Answers0