cssqtstylesheet

QT Stylesheet for HLine/VLine color


I'm pretty new to this Qt thing and its whole stylesheet system. My background of HTML/CSS helps a little to understand the system, but a lot of things just happens for no apparent reason....or don't happen.

Anyway, the mystery of the HLINE and the VLINE and how to change the lines' color is just a mystery for me. I learned from other questions and various fora that it's linked to the QFrame elements. And I can change the color of the line if I just use something like

QFrame
{
color: red;
}

But this of course changes the color of tons of other things that uses a QFrame as well. I could of course go into the HLINE element and put color: red; in there and that works fine, but my app requires that I put everything in a single stylesheet that gets loaded into the app. So styling individual elements is not an option.

A solution would look something like

QFrame HLine, QFrame VLine
{
color: red;
}

Solution

  • QFrame[frameShape="4"] /* QFrame::HLine == 0x0004 */
    {
        color: red;
    }
    
    QFrame[frameShape="5"] /* QFrame::VLine == 0x0005 */
    {
        color: green;
    }