16,213
社区成员
发帖
与我相关
我的任务
分享
void foo() {
QWidget *w = new QWidget();
QLineEdit *edit1 = new QLineEdit();
QLineEdit *edit2 = new QLineEdit();
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(edit1);
layout->addWidget(edit2);
w->setLayout(layout);
QString style("QLineEdit{border: 3px solid black;}"
"QLineEdit:focus{border: 3px solid red;}");
w->setStyleSheet(style);
w->show();
}