5qApp->setStyleSheet(
"QPushButton { color: white }");
10myPushButton->setStyleSheet(
"* { color: blue }");
15myPushButton->setStyleSheet(
"color: blue");
20qApp->setStyleSheet(
"QGroupBox { color: red; } ");
24qApp->setStyleSheet(
"QGroupBox, QGroupBox * { color: red; }");
34qApp->setStyleSheet(
"MyPushButton { background: yellow; }");
46qApp->setStyleSheet(
"ns--MyPushButton { background: yellow; }");
51void CustomWidget::paintEvent(QPaintEvent *)
56 style()->drawPrimitive(QStyle::PE_Widget, &opt, &p,
this);
62qApp->setStyleSheet(
"QLineEdit { background-color: yellow }");
67myDialog->setStyleSheet(
"QLineEdit { background-color: yellow }");
72myDialog->setStyleSheet(
"QLineEdit#nameEdit { background-color: yellow }");
77nameEdit->setStyleSheet(
"background-color: yellow");
82nameEdit->setStyleSheet(
"color: blue; background-color: yellow");
87nameEdit->setStyleSheet(
"color: blue;"
88 "background-color: yellow;"
89 "selection-color: yellow;"
90 "selection-background-color: blue;");
96nameEdit->setProperty(
"mandatoryField",
true);
99emailEdit->setProperty(
"mandatoryField",
true);
102ageSpinBox->setProperty(
"mandatoryField",
true);
106QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles,
true);