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. Pixmap in QTreeWidget
Qt 6.11 is out! See what's new in the release blog

Pixmap in QTreeWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 713 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.
  • K Offline
    K Offline
    klausix
    wrote on last edited by
    #1

    Hi!
    I simply want to palce a pixmap into a QTreeWidgetItem instead of text.
    Like implementing a function "setPixmap()" instead of setText().
    But where to start?

    Thanks a lot,
    Klaus!

    J.HilkJ jsulmJ 2 Replies Last reply
    0
    • K klausix

      Hi!
      I simply want to palce a pixmap into a QTreeWidgetItem instead of text.
      Like implementing a function "setPixmap()" instead of setText().
      But where to start?

      Thanks a lot,
      Klaus!

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      hi @klausix and welcome

      ok, what I think you're doing is using the QTreeWidget and you want to populate it with custom TreeWidget items.

      It is possible, but not trivial, and therefore I would suggest to take the extra time, and understand/learn Qt's model/view approach with delegates. And start using QTreeView.

      It will be more setup but it will run smoother and more reliable

      Take a look at this example
      https://doc.qt.io/qt-5/qtwidgets-itemviews-editabletreemodel-example.html


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      2
      • K klausix

        Hi!
        I simply want to palce a pixmap into a QTreeWidgetItem instead of text.
        Like implementing a function "setPixmap()" instead of setText().
        But where to start?

        Thanks a lot,
        Klaus!

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @klausix You can set an icon. Do you really need a pixmap?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        K 1 Reply Last reply
        2
        • jsulmJ jsulm

          @klausix You can set an icon. Do you really need a pixmap?

          K Offline
          K Offline
          klausix
          wrote on last edited by
          #4

          @jsulm well, think I also could live with an icon!
          I just didn’t notice this function in the class-reference.
          Thanks for the hint, gonna try!

          1 Reply Last reply
          0

          • Login

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