QLabel to bring middle of a QVLayout
-
Hi All,
I have a doubt regarding aligning QLabel Widget inside a QVBoxLayout.
The outer black box is of QVBoxLayout. I have achieved this layout but the text in QLabel is left aligned. I want to make the text of the QLabel center aligned as well as modify it in terms of the style sheet. How can I do that?
-
@Swati777999 Layout haven't font setting but Any kind of Widget can be set font in Qt. For example I have QLabel type Widget
QFont customFont; customFont.setItalic(true); customFont.setBold(true); customFont.setFamily("Arial Black"); customFont.setPointSize(20); QLabel *label = new QLabel("my Label"); label->setFont(customFont);
for details font
Or use set Stylesheet of that widget -
Alignment part is solved
myLayout->setAlignment(myWidget,Qt::AlignCenter);
Now, have to deal with font size and font style.
-
@Swati777999 Layout haven't font setting but Any kind of Widget can be set font in Qt. For example I have QLabel type Widget
QFont customFont; customFont.setItalic(true); customFont.setBold(true); customFont.setFamily("Arial Black"); customFont.setPointSize(20); QLabel *label = new QLabel("my Label"); label->setFont(customFont);
for details font
Or use set Stylesheet of that widget