Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Displaying an image in a QTableView
Forum Update on Monday, May 27th 2025

[Solved] Displaying an image in a QTableView

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 5.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    scarleton
    wrote on 11 Aug 2011, 02:33 last edited by
    #1

    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

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on 15 Aug 2011, 16:55 last edited by
      #2

      What model are you using for your view?

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • S Offline
        S Offline
        scarleton
        wrote on 15 Aug 2011, 16:58 last edited by
        #3

        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

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on 15 Aug 2011, 17:02 last edited by
          #4

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

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0

          1/4

          11 Aug 2011, 02:33

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved