[solved] Groupbox title alignment vertically
-
Hello,
when I make a groupbox the title is always below the border line of the groupbox. Is there any way to align the title centered vertically to the border line? It should look like this http://doc.qt.digia.com/2.3/qgrpbox-w.png, but for me the title Group Box is always much below the line.
Thanks for any help! -
When asking about styles it's always a good idea to state your OS, system style, Qt version and tech (QML or Widgets) and any other info you think might be useful. Styles can be wildly different with these.
For example on my setup the text is centered.
Here's an example how you can cutomize the look by using "stylesheets":http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qgroupbox -
Hi, I am using Windows 7 and also Linux xUbuntu. This occurs on both OS.
My Style looks like this:
QGroupBox
{
padding: 5 5px;
font: 14pt "Segoe UI";
border: 1px solid rgb(194,213,221);
border-radius: 2px;
}A Groupbox looks for example like this
QGroupBox* BarcodeBox = new QGroupBox("Barcode",BarcodeFrame);
with
QFrame* BarcodeFrame = new QFrame(this);Is there no style command to move the title vertically?
-
It's right in the link I gave you. You can control the title sub-control with QGroupBox::title
@
QGroupBox
{
padding: 5px;
font: 14pt "Segoe UI";
border: 1px solid rgb(194,213,221);
border-radius: 2px;
margin-top: 8px;
}
QGroupBox::title {
top: -12px;
left: 10px;
}
@
Notice that I also added a margin to the QGroupBox to provide space for the negative sub-control position.Btw. Is "Sagoe UI" even available on Linux?