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.


  • Qt Champions 2017

    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


  • Qt Champions 2017

    @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.



  • @mrjj When I added the button then problem went away, so not able to test this. It is very intermittent.



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.