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. QSlider styling: making space to the right
Forum Updated to NodeBB v4.3 + New Features

QSlider styling: making space to the right

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.9k 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.
  • A Offline
    A Offline
    andre
    wrote on last edited by
    #1

    I would like to add another widget to a QSlider, but I would like that class to be a subclass of QSlider itself so it becomes a drop-in replacement. I am running into a bit of a dead-end however. I tried to just reimplement the paintEvent, but the QSlider paint event relies on the internal d pointer thing for its state, so that is hard to access. I also tried to use style sheets to create some space next to slider, but the normal slider does not budge for properties like margin-right or padding-right. Only if I really modify the groove and the handle do I get some results, but that of course results in a non-standard looking slider, which is something I want to avoid.

    I don't quite get why the default slider does not work with the padding and margin style sheet properties.

    I know I can create my own QWidget derived class, which simply contains the QSlider and what I want to put next to it in a layout, but that would not make it a drop-in replacement that is completely compatible with QSlider, and it would means a lot of boilerplate code to re-implement all the QSlider methods in my API.

    Any suggestions?

    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