2

I have a Group Box as follows:

enter image description here

QGroupBox{
    background-color: #000044;
    font: 12px consolas;
    color: cyan;
}

I wish the border to be more bluish, and then I get:

enter image description here

QGroupBox{
    border: 1px solid cyan;
    background-color: #000044;
    font: 12px consolas;
    color: cyan;
}

The title is not centered with the top border of the Group Box and I do not know how to do it.

EDITED:

The possible solution proposed by ekhumoro does not work. I miss the upper-left corner.

enter image description here

QGroupBox{
    border: 1px solid cyan;
    background-color: #000044;
    font: 12px consolas;
    color: cyan;
    margin-top: 0.5em;
}

QGroupBox::title {
    padding-top: -16px;
    padding-left: 8px;
}

enter image description here

QGroupBox{
    border: 1px solid cyan;
    background-color: #000044;
    font: 12px consolas;
    color: cyan;
    margin-top: 0.5em;
}

QGroupBox::title {
    background-color: transparent;
    padding-top: -16px;
    padding-left: 8px;
}
4

1 回答 1

4

Thanks for the tip ekhumoro. Now it works.

enter image description here

QGroupBox{
    border: 1px solid cyan;
    margin-top: 0.5em;
    background-color: #000044;
    font: 12px consolas;
    color: cyan;
}

QGroupBox::title {
    top: -6px;
    left: 10px;
}
于 2017-02-14T06:24:31.940 回答