Results 1 to 2 of 2

Thread: QSlider custom handle image not displayed

  1. #1
    Join Date
    Mar 2008
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QSlider custom handle image not displayed

    Hi,

    I'm trying set a custom image for a QSlider handle. I am able to see the handle in designer but when I build the application, the handle is not shown. The resource file seems ok because I can show all pixmap in a QLabel...

    Vertical Slider Style Sheet
    Qt Code:
    1. QSlider::groove:vertical {
    2. border: 1px solid #999999;
    3. width: 4px;
    4. background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);
    5. margin-top: 2px;
    6. margin-bottom: 2px;
    7. }
    8. QSlider::handle:vertical {
    9. image: url(:/GenericWidget/Ressources/vcursor.png) 1;
    10. height: 14px;
    11. margin-left: -6px;
    12. margin-right: -6px;
    13. }
    To copy to clipboard, switch view to plain text mode 

    Horizontal Slider Style Sheet:
    Qt Code:
    1. QSlider::groove:horizontal {
    2. border: 1px solid #999999;
    3. height: 4px;
    4. background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);
    5. margin-left: 2px;
    6. margin-right: 2px;
    7. }
    8. QSlider::handle:horizontal {
    9. image: url(:/GenericWidget/Ressources/hcursor.png);
    10. width: 14px;
    11. margin-top: -6px;
    12. margin-bottom: -6px;
    13. }
    To copy to clipboard, switch view to plain text mode 

    In Designer:


    In the application:
    Attached Images Attached Images

  2. #2
    Join Date
    Mar 2008
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSlider custom handle image not displayed

    The solution for me was not to use designer and set the style sheet directly in the code with the method setStyleSheet...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.