Set QLabel border-image without stylesheet.

  • Hi everyone!
    Do you know how to set QLabel border image without use SetStyleSheet ? I have use SetStyleSheet("border-image:url("://a.png"); But it affect all the childen.
    I have not found any method in QLabel class like : QLabel::SetBorderImage or others.
    Hate the StyleShit.

    Thank you.

  • Hii,
    can you show the code ?

  • Perhaps you may like the styleSheet after a while as it is a flexible way to control the design of your gui.
    I've posted some hints in "Qt Borderimage":
    If you do not want all children to be affected, you may assign a styleSheet to any child directly.

  • I have found a solution is using stylesheet with specific object-name :

    @ m_sliderLb->setObjectName(QString("SlideBar"));
    m_sliderLb->setStyleSheet("QLabel#SlideBar { border-image:url(:/images/slider_1.png);border-width:5} ");@

    It's ok. But i still think that stylesheet has poor perfomance in case so many objects use the same image file.

Log in to reply