#include <qlayout.h>
#include <qframe.h>
#include <qlabel.h>
#include <qfont.h>
QVBoxLayout *vBox = new QVBoxLayout(this);
vBox->addWidget(new QLabel("<font size='+1'><b><p align='center'>标题</p></b></font>", this));
vBox->addWidget(new QLabel("<hr>", this, "hr"));
//或是用下面的方法
QFrame *lbHr = new QFrame( this, "line4" );
lbHr->setGeometry( QRect( 1, 20, width()-2, 16 ) );
//lbHr->setPaletteBackgroundColor( QColor( 222, 199, 241 ) );
lbHr->setFrameShape( QFrame::HLine );
lbHr->setFrameShadow( QFrame::Sunken );
lbHr->setFrameShape( QFrame::HLine );
vBox->addWidget(lbHr);//横线
*/
vBox->addStretch(1);
vBox->addWidget(new QLabel("<u>带下划线的label</u>", this));
QLabel *label = new QLabel("设置字体:<font color='#5500ff' size='+1' face='Sans'>被设置了字体</font>", this);
QFont font = label->font();
font.setBold(true);
label->setFont(font);
vBox->addWidget(label);
QLabel *label2 = new QLabel("设置字体未加粗:<font color='#5500ff' size='+1' face='Sans'>被设置了字体</font>", this);
vBox->addWidget(label2);