Polygons stop drawing on QSlider
-
Hello, I have a Qt/MFC hybrid app running on Windows 7, Visual Studio 2015. I have a QSlider and have overridden paintEvent, mousePressEvent, mouseMoveEvent, mouseReleaseEvent, etc. On each click, I draw a polygon onto the QSlider object. After some polygons have been added (number is not consistent, anywhere from 4 to 100) additional polygons do not draw when I click. When I click on other controls, the missing polygons draw and everything goes back to normal. Not clear any connection between the other controls and the slider.
I would appreciate any ideas.
-
Looks like we may have fixed this. Haven't seen it since the fix, anyway. We were directly calling the update method of the slider from another class, i.e.:
myDialog->mySliderWidget->update();
Changed to send a signal:
myDialog->emitSliderUpdateSignal();
Thanks for your help.
Ron -
hi
It sounds like the event loop might be disabled/hanged/interrupted and it miss an paintEvent or something like that.I would try to make a button for test
and after slider do not show the last added, i would
say
ui->slider->update()
in button click to see if its just an update issue or something more involved. -
I will try that, mrjj. Should paintEvent on the QSlider call update()?
Ron -
@Psychotron
Nope, update() calls paint event. So if you call update() inside paint, then you get recursive crash :)
button simply calls update() on the the slider and see if it then redraws as it should. -
Looks like we may have fixed this. Haven't seen it since the fix, anyway. We were directly calling the update method of the slider from another class, i.e.:
myDialog->mySliderWidget->update();
Changed to send a signal:
myDialog->emitSliderUpdateSignal();
Thanks for your help.
Ron