简体   繁体   中英

How to change group widget content background color in Qt Style CSS

I'm trying to change skin of a program that supports Qt Style CSS, but I don't have access to the source code. I need to change the background color of the groups inside a QWidget, 在此处输入图片说明

I tried with:

QWidget {
    background-color: #4d4d4d;
}

But it changes the color of the whole window, but I can still see the rectangle semi-transparent (like black 95% opacity). What class do I need to edit to change that particular box?

You are changing the style for the class QWidget which is the base for any Qt widget.

If you want to change the style for the group only, that's the QGroupBox class.

QGroupBox{
    background-color: #4d4d4d;
}

Some QSS examples in the doc : https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qgroupbox

If you want to set the style on a specific widget of the application you will need more information from the code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM