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. QWidget update() / repaint() has no effect

QWidget update() / repaint() has no effect

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 1.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.
  • gde23G Offline
    gde23G Offline
    gde23
    wrote on last edited by
    #1

    Hi,

    I habe a QTreeView that I want to update when some Icons have changed.

    When i call tree->update(); or tree->repaint();nothing happens.
    When I instead call

    tree->hide();
    tree->show();
    

    The Icons are updated as they should. What am I missing?

    1 Reply Last reply
    1
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Most probably your view does not know that anything has changed, so when your call update() it does nothing,

      Make sure your underlying model emits dataChanged() when icon changes.

      (Z(:^

      1 Reply Last reply
      5
      • gde23G Offline
        gde23G Offline
        gde23
        wrote on last edited by gde23
        #3

        @sierdzio
        dataChanged() is emmited after the Icon change.
        However for some reason it needs an additional update here.

        I also think that it already worked with an older Qt Version, or I haven't noticed the problem yet.
        Currently I am using 5.11

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

          Hi,

          Since the LTS Qt 5.9.7 just got released, you can test against that one.

          Might be a silly question but did you check whether you are emitting dataChanged for the wrong indexe(s) ?

          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
          3
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Also with the correct index? Can you provide a small example? Does it update when you move the mouse over the modified item?

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            3
            • gde23G Offline
              gde23G Offline
              gde23
              wrote on last edited by
              #6

              Problem solved, the index when emmiting dataChanged() was wrong.
              Thanks for the hint

              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