Solved QWidget update() / repaint() has no effect
-
Hi,
I habe a QTreeView that I want to update when some Icons have changed.
When i call
tree->update();
ortree->repaint();
nothing happens.
When I instead calltree->hide(); tree->show();
The Icons are updated as they should. What am I missing?
-
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.
-
@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 -
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) ?
-
Also with the correct index? Can you provide a small example? Does it update when you move the mouse over the modified item?
-
Problem solved, the index when emmiting dataChanged() was wrong.
Thanks for the hint