Results 1 to 2 of 2

Thread: QTslider vertical handle customization problem - CSS

  1. #1
    Join Date
    Sep 2015
    Posts
    6
    Qt products
    Qt5
    Platforms
    Windows

    Default QTslider vertical handle customization problem - CSS

    Hey guys, I'm a QT newbie and UI designer.

    I'm experiencing a problem editing the slider handle in CSS. Basically I can't create a rounded handle for the vertical slider, but it works for the horizontal. I have no clue what I should do.

    Here's a screenshot:

    http://i.snag.gy/F9BPh.jpg
    Note: I'm using the app plugin QSS Editor 0.5.6 to do my code.

    I would like to avoid uploading an image for the handle if possible.

    Here's my code:

    /******** Qslider Horizontal ********/

    QSlider::groove:horizontal {
    border: 1px solid #bbb;
    background: grey;
    height: 6px;
    border-radius: 4px;
    }

    QSlider::sub-page:horizontal {
    background: #5bbdea;
    border: 1px solid #777;
    height: 10px;
    border-radius: 4px;
    }

    QSlider::add-page:horizontal {
    background: 474b59;
    border: 1px solid #777;
    height: 10px;
    border-radius: 4px;
    }

    QSlider::handle:horizontal {
    background: #ced7d9;
    border: 1px solid #777;
    width: 13px;
    margin-top: -5px;
    margin-bottom: -3px;
    border-radius: 7px;
    }

    QSlider::handle:horizontal:hover {
    background: white;
    border: 1px solid #444;
    border-radius: 50%;
    width: 13px;
    margin-top: -5px;
    margin-bottom: -3px;
    border-radius: 7px;
    }

    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;
    border-radius: 4px;
    }

    /******** Qslider Vertical ********/

    QSlider::groove:vertical {
    border: 1px solid #bbb;
    background: grey;
    width: 6px;
    border-radius: 2px;
    }

    QSlider::sub-page:vertical {
    background: #5bbdea;
    border: 1px solid #777;
    width:: 10px;
    border-radius: 4px;
    }

    QSlider::add-page:vertical {
    background: 474b59;
    border: 1px solid #777;
    width: 10px;
    border-radius: 4px;
    }

    QSlider::handle:vertical {
    background: #ced7d9;
    border: 1px solid #777;
    height: 10px;
    margin-right: -5px;
    margin-left: -5px;
    margin-top: -1px;
    border-radius: -5px;
    }

    QSlider::handle:vertical:hover {
    background: white;
    border: 1px solid #444;
    border-radius: 50%;
    width: 13px;
    margin-top: -5px;
    margin-bottom: -3px;
    border-radius: 7px;
    }

    QSlider::sub-page:vertical:disabled {
    background: #bbb;
    border-color: #999;
    }

    QSlider::add-page:vertical:disabled {
    background: #eee;
    border-color: #999;
    }

    QSlider::handle:vertical:disabled {
    background: #eee;
    border: 1px solid #aaa;
    border-radius: 4px;
    }

  2. #2
    Join Date
    Sep 2015
    Posts
    6
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QTslider vertical handle customization problem - CSS

    This was solved:

    I used an image for the handle.
    For me it makes no sense to use margins to make the handle circular, what is the logic?


    new code

    /******** Qslider Horizontal ********/

    QSlider::groove:horizontal {
    border: none;
    height: 6px;
    background: grey;
    margin: 1px;
    border-radius: 2px;
    }

    QSlider::sub-page:horizontal {
    background: #5bbdea;
    height: 6px;
    border-radius: 4px;
    }

    QSlider::add-page:horizontal {
    background: #474b59;
    height: 10px;
    border-radius: 4px;
    }

    QSlider::handle:horizontal {
    image : url(/Controls/slider_handle2.png);
    width: 22px;
    margin: -10px;
    }


    /******** Qslider Vertical ********/
    QSlider::groove:vertical {
    border: none;
    width: 6px;
    background: grey;
    margin: 1px;
    border-radius: 2px;
    }

    QSlider::sub-page:vertical {
    background: #5bbdea;
    height: 6px;
    border-radius: 4px;
    }

    QSlider::add-page:vertical {
    background: #474b59;
    height: 10px;
    border-radius: 4px;
    }

    QSlider::handle:vertical {
    image : url(:/Controls/slider_handle2.png);
    height: 22px;
    margin: -10px;
    }

Similar Threads

  1. Replies: 8
    Last Post: 2nd June 2014, 12:58
  2. MAC ONLY- Vertical Scroll problem with QTableWidget
    By user_mail07 in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2013, 10:42
  3. Replies: 0
    Last Post: 8th March 2013, 02:40
  4. Replies: 0
    Last Post: 17th December 2010, 17:08
  5. problem with qfiledialog customization (Qt4.5.2) ........
    By netfanatic in forum Qt Programming
    Replies: 0
    Last Post: 9th March 2010, 05:58

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.