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. Is it possible to get the x and y of a QSlider's handle?
Forum Updated to NodeBB v4.3 + New Features

Is it possible to get the x and y of a QSlider's handle?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 128 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.
  • M Online
    M Online
    Mizmas
    wrote last edited by
    #1

    Title says it all, I can't think of anything :P

    1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote last edited by Kent-Dorfman
      #2

      not directly, but you should be able to approximate it from the slider's value() and the geometry of the slider widget.
      Keep in mind that for a horizontal slider only the X would be relevant, and for vertical only the Y would be relevant.
      Perhaps you can tell me why you need it?

      Otherwise I'd suggest you create your own custom slider to implement what you want.

      M 1 Reply Last reply
      0
      • Kent-DorfmanK Kent-Dorfman

        not directly, but you should be able to approximate it from the slider's value() and the geometry of the slider widget.
        Keep in mind that for a horizontal slider only the X would be relevant, and for vertical only the Y would be relevant.
        Perhaps you can tell me why you need it?

        Otherwise I'd suggest you create your own custom slider to implement what you want.

        M Online
        M Online
        Mizmas
        wrote last edited by
        #3

        @Kent-Dorfman I have this unfinished animation to indicate which slider settings frame you're on. I think it would look better if instead of the animation underlaying behind the entire QSlider, I could make a similar animation only focusing on the slider's handle, but I need to track the coordinates of the handle for that

        1 Reply Last reply
        0
        • Kent-DorfmanK Offline
          Kent-DorfmanK Offline
          Kent-Dorfman
          wrote last edited by
          #4

          don't try it using the canned QSliders. You will have to make your own custom slider. Even approximating the handle position will be hit or miss because different themes will hork with the slider geometry.

          Christian EhrlicherC M 2 Replies Last reply
          0
          • Kent-DorfmanK Kent-Dorfman

            don't try it using the canned QSliders. You will have to make your own custom slider. Even approximating the handle position will be hit or miss because different themes will hork with the slider geometry.

            Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote last edited by
            #5

            @Kent-Dorfman said in Is it possible to get the x and y of a QSlider's handle?:

            different themes will hork with the slider geometry.

            There QStyle::subelemtRect() can help.

            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
            1
            • Kent-DorfmanK Kent-Dorfman

              don't try it using the canned QSliders. You will have to make your own custom slider. Even approximating the handle position will be hit or miss because different themes will hork with the slider geometry.

              M Online
              M Online
              Mizmas
              wrote last edited by
              #6

              @Kent-Dorfman I'm setting the style app.setStyle(QStyleFactory.create('windowsvista')) like this, and since I'm using a Windows only audio control library, I don't really care for other OS'es

              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