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



  • 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


  • Lifetime Qt Champion

    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.



  • 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;
    
    }
    

  • Lifetime Qt Champion

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.