简体   繁体   中英

pyQt GroupBox alignment

I've got a real problem in making the alignment of the header of QGroupBox when i change the width of a border.

Initially i have something like this:

First filter

And when I change stylesheet of this groupbox

self.filter.setStyleSheet("QGroupBox {border-style: solid; border-width: 1px; border-color: black; text-align: left;}")

The header of the filter "goes down" like this:

Second one

Is there any way to set centered alignment for bold frame of the groupbox?

I had a similar problem and after a long search I came up with this, try it:

QGroupBox#nameOftheGroupBox{
    border: 1px solid rgb(13, 33, 212);
    border-radius: 8px;
    margin-top: 10px;
}

QGroupBox:title#nameOftheGroupBox{
    left: 16px;
    bottom: 7px;
}

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