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. Widget in place of an icon in QTreeView?
Forum Updated to NodeBB v4.3 + New Features

Widget in place of an icon in QTreeView?

Scheduled Pinned Locked Moved General and Desktop
10 Posts 2 Posters 2.1k Views 2 Watching
  • 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.
  • V Offline
    V Offline
    Violet Giraffe
    wrote on last edited by
    #1

    I want to display a small widget instead of an icon in QTreeView, can this be done?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I'd say: probably yes. But it might be hurting performances. What should that widget do ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Violet Giraffe
        wrote on last edited by Violet Giraffe
        #3

        It's sort of an indefinite progress indicator to indicate that a lengthy operation is running on this list item. There can be at most one such indicator, so performance shouldn't be an issue.
        I could implement it by switching the icon on timer but that's really ugly.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then why not put a progress bar over the cell where the operation is currently going on ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • V Offline
            V Offline
            Violet Giraffe
            wrote on last edited by
            #5

            Hmm, it didn't occur to me. Thanks for the idea. I guess with careful positioning I can overlay it just right. Not sure if I can get the coordinates I need from the tree view, though.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              visualRect comes to mind for that

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • V Offline
                V Offline
                Violet Giraffe
                wrote on last edited by
                #7

                Now that I'm trying it out, it doesn't seem feasible. For instance, how am I going to handle scrolling the list while the progress bar is on screen.
                Do you have any other idea on how to implement it? I'm thinking of calling setIcon() a couple times a second, will that be smooth enough?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  What about writing your own delegate ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • V Offline
                    V Offline
                    Violet Giraffe
                    wrote on last edited by
                    #9

                    Does QTreeView work with delegates? I thought only widget does, but not the view. Thanks, I'll look into it.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Sure it does, the base delegate handling comes from QAbstractItemView

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      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