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. Change the size of QSlider::handle not working

Change the size of QSlider::handle not working

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 4.6k Views 1 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.
  • J Offline
    J Offline
    joshua-anderson
    wrote on last edited by
    #1

    Hello! I am trying to use a custom style sheet styled QSlider. I would like a aspect ratio on the handle different than the one provided by default. However, the height and width attributes in the style sheet don't work, probably because they might be overridden when I resize my slider in the resize event. I specifically would like the slider short but wide. Does anyone have any advice on how to do this? Thanks!

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hi,
      Not really sure what you want, but do you need a fixed size QSlider? When the properties for height and width are set to fixed size, the resize event will not overwrite them. If you really want control how your slider is displayed you could create your own and use the paintevent to draw the widget the way you want it to look.

      Greetz, Jeroen

      1 Reply Last reply
      0
      • raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        you can give QProxyStyle a shot and overload "QProxyStyle::pixelMetric()":http://qt-project.org/doc/qt-4.8/qproxystyle.html#pixelMetric and return the desired size for QStyle::PM_SliderControlThickness.
        There are some examples of QProxyStyle usage on the web, or read the example of the "docs":http://qt-project.org/doc/qt-4.8/qproxystyle.html#details.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • J Offline
          J Offline
          joshua-anderson
          wrote on last edited by
          #4

          i would like to change the aspect ratio of the slider handle, right now it is tall but not wide, I would like it wide but not tall. but the height attributes have no effect

          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