1 #include "mywidget.h"
2 #include "ui_mywidget.h"
3 #include
4
5 MyWidget::MyWidget(QWidget *parent) :
6 QWidget(parent),
7 ui(new Ui::MyWidget)
8 {
9 ui->setupUi(this);
10 this->setWindowTitle("样式表的使用");
11 QLabel *lbl = new QLabel(this);
12 lbl->setText(" 彩笔描空,笔不落色,而空亦不受染;"13 "利刀割水,刀不损锷,而水亦不留痕 。"14 "得此意以持身涉世,感与应俱适,心与境两忘矣。");
15
16 lbl->move(65, 70);
17 lbl->setMaximumWidth(260);
18 lbl->setWordWrap(true);
19 lbl->setStyleSheet("QLabel{font-family:微软雅黑; font-size:16pt; "20 "color:green; background-color:yellow}");
21
22 }
23
24 MyWidget::~MyWidget()
25 {
26 delete ui;
27 }