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. Padding on elements without stylesheets
Forum Updated to NodeBB v4.3 + New Features

Padding on elements without stylesheets

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 757 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.
  • R Offline
    R Offline
    RuhigBrauner
    wrote on last edited by
    #1

    Hi,

    I want to create custom sliders by subclassing QSlider. However, since I don't use padding in the pressEvent or paintEvent, I can't use it to "scale" the slider inside the bounding rectangle.

    The question is what I could use to add a "padding" to the slider instead. Using layout->setContentsMargin() or something doesn't seem to help.

    Any ideas?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      What is the you would like to customize the QSlider ? You would like reduce the size of QSlider based on the available size of you bounding widget ? Some more details would help.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • R Offline
        R Offline
        RuhigBrauner
        wrote on last edited by
        #3

        Hi,

        I m working width() and height() in the paintEvent to get the size of the Slider. I would like to specify a margin between the Slider and the layout it's in to have some pixels between them.

        The problem is that the Slider uses a size policy set to prefered / prefered so it seems stuff like layout->setContentsMargin(....) didn't worked...

        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