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. How to force repaint on QTreeView when using setIndexWidget()
Qt 6.11 is out! See what's new in the release blog

How to force repaint on QTreeView when using setIndexWidget()

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.3k Views 1 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.
  • D Offline
    D Offline
    Dariusz
    wrote on last edited by Dariusz
    #1

    Hey

    I'm having this issue ->

    2021_01_11---14-43-55_capture_1189.gif

    When I click, the selection does not appear "instantly" instead its being painted at "random". I'm left clicking, so the previous item should be deselected...

    The cause of it oculd be the fact that I use setIndexWidget() And I have a few QWidgets on each item that may conflict with some paiting logic...
    I was wondering if there is a way to set a repaint mode. I take now its "smart" and only repaints selected item - widget area, and skips the area outside the treeItem. Any way to set paint update methof on treeView from smart/partial to full tree repaint?

    TIA

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

      Hi
      How do you make the widgets be selected ?
      Some stylesheet ?
      setIndexWidget() floats the widgets on top of the cell so they normally dont react to cell being selected
      versus cell have focus.

      As far as I know, there is no repaint modes.

      D 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        How do you make the widgets be selected ?
        Some stylesheet ?
        setIndexWidget() floats the widgets on top of the cell so they normally dont react to cell being selected
        versus cell have focus.

        As far as I know, there is no repaint modes.

        D Offline
        D Offline
        Dariusz
        wrote on last edited by
        #3

        @mrjj As far as I remember, the widgets is to the right of the drop down/icon location of tree item. So I can see tree item underneath. I also made QWidget transparent using wa_transparent flag/option if I remember correctly. The are behind widget paints properly/updates. But the outer area where there is drop down icon/checkbox/icon is lagging. Its as if widgets took over the repain call & forgot to forward it to item that is replacing...

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

          Hi
          Not sure what is going on.
          Docs says autoFillBackground should be set to true as not to show both the cell and the widget floating above.
          The widget does not replace the item.

          https://doc.qt.io/qt-5/qabstractitemview.html#setIndexWidget

          So you used
          setAttribute(Qt::WA_TranslucentBackground); ?

          on the widgets ?

          D 1 Reply Last reply
          0
          • mrjjM mrjj

            Hi
            Not sure what is going on.
            Docs says autoFillBackground should be set to true as not to show both the cell and the widget floating above.
            The widget does not replace the item.

            https://doc.qt.io/qt-5/qabstractitemview.html#setIndexWidget

            So you used
            setAttribute(Qt::WA_TranslucentBackground); ?

            on the widgets ?

            D Offline
            D Offline
            Dariusz
            wrote on last edited by
            #5

            @mrjj Yup. I'll make a portable text example and post a code. Just need to get some spare time for it. brb

            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