I have QGroupBox in my UI. The basic style is 2px width border, border radius and the title being vertically centered.
I used the following style to my stylesheet (which is in a .qrc, applied in the main using app->setStylesheet):
QGroupBox {
border: 1px solid #22a4bc;
border-radius: 0px;
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top; /* position at the top center */
}
The problem is, the title is now a few pixel down, and actually over the element IN the groupbox.
I want to set it centered. I tried vertical-align, subcontrol-align, subcontrol-alignment, even top: -5px which actually centers the title, but trim the text that is higher than the border. I didn't find any answer here on SO or on the Qt forum that resolve my problem.
Does anybody know how to set the title's vertical alignment to back center? (I use C++, Qt 5.2.1 / msvc2012, Qt Creator 3.6.1 / Windows 7)