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. How do i add The value of the Silder over the Handle of the QSlider?
Qt 6.11 is out! See what's new in the release blog

How do i add The value of the Silder over the Handle of the QSlider?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.7k 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.
  • S Offline
    S Offline
    Smaranil
    wrote on last edited by Smaranil
    #1

    how do i show the Value on which the handle it is holding.

    alt text

    I would prefer Less Coding, Only designer way . If it is only Possible by adding codes then Please Explain it in a elaborate way

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Your slider doesn't look native, what platform are you on ?

      In any case, there's no way to do it in Designer. You'll likely have to do some custom painting.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • S Offline
        S Offline
        Smaranil
        wrote on last edited by Smaranil
        #3

        it is the native slider with some stylesheet work

        stylesheet of the Sliderbelow

        QSlider::groove:horizontal {
        border: 1px solid #bbb;
        background: white;
        height: 10px;
        
        }
        
        QSlider::sub-page:horizontal {
        background:rgb(0, 0, 0) ;
        background: ;
        border: 1px solid #777;
        height: 10px;
        
        }
        
        QSlider::add-page:horizontal {
        background: #fff;
        border: 1px solid #777;
        height: 10px;
        
        }
        
        QSlider::handle:horizontal {
        background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
            stop:0 #eee, stop:1 #ccc);
        border: 1px solid #777;
        width: 20px;
        
        
        
        }
        
        QSlider::handle:horizontal:hover {
        background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
            stop:0 #fff, stop:1 #ddd);
        border: 1px solid #444;
        
        }
        
        QSlider::sub-page:horizontal:disabled {
        background: #bbb;
        border-color: #999;
        }
        
        QSlider::add-page:horizontal:disabled {
        background: #eee;
        border-color: #999;
        }
        
        QSlider::handle:horizontal:disabled {
        background: #eee;
        border: 1px solid #aaa;
        
        }
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then you should rather start from a QAbstractSlider and do the painting by hand like suggested before.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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