Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions

[Solved] Displaying an image in a QTableView



  • I have a QTableView where one column needs to contain both the image and text. What I have is a model that returns the QPixmap on the Qt::DecorationRole and the text on Qt::DisplayRole. The problem is the height of each row cuts off the image. How exactly do I get the height to adjust to that of the image?

    I tried returning the QSize of the QPixmap on the Qt::SizeHintRole, but then there is no image at all.

    What am I missing?

    SAm



  • What model are you using for your view?



  • Volker,

    I figured it out on my own. Assuming I had a bad subject I posted the Q in another thread, where I explained my solution. I thought I had posted it here, too, but I guess not.

    Here is the link:http://developer.qt.nokia.com/forums/viewthread/8738



  • No problem, I just read through a huge backlog of postings :-)
    I'm setting this to solved.


Log in to reply