Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Polygons stop drawing on QSlider
Qt 6.12 LTS is out! See what's new in the release blog

Polygons stop drawing on QSlider

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 1.5k 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.
  • PsychotronP Offline
    PsychotronP Offline
    Psychotron
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • PsychotronP Offline
      PsychotronP Offline
      Psychotron
      wrote on last edited by
      #6

      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

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

        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.

        1 Reply Last reply
        1
        • PsychotronP Offline
          PsychotronP Offline
          Psychotron
          wrote on last edited by
          #3

          I will try that, mrjj. Should paintEvent on the QSlider call update()?
          Ron

          mrjjM 1 Reply Last reply
          0
          • PsychotronP Psychotron

            I will try that, mrjj. Should paintEvent on the QSlider call update()?
            Ron

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #4

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

            PsychotronP 1 Reply Last reply
            0
            • mrjjM mrjj

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

              PsychotronP Offline
              PsychotronP Offline
              Psychotron
              wrote on last edited by
              #5

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

              1 Reply Last reply
              0
              • PsychotronP Offline
                PsychotronP Offline
                Psychotron
                wrote on last edited by
                #6

                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

                1 Reply Last reply
                1

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt
                • Unsolved