Hi,
Imagine i have a Dialog (myDialog) with 3 QLineEdit objects: lineEdit1, lineEdit2, lineEdit3. I am using QtDesiner so i have 4 files:
  • main.cpp
  • myDialog.h
  • myDialog.cpp
  • myDialog.ui


If i want to apply a red color to the background off all lineEdits in the application e use, in main.cpp the following:
Qt Code:
  1. app.setStyleSheet("QLineEdit { background-color: red }");
To copy to clipboard, switch view to plain text mode 

Now supose i want to apply other stylesheet color as the Dialog level. Where showld i place the code:
Qt Code:
  1. myDialog->setStyleSheet("QLineEdit { background-color: yellow }");
To copy to clipboard, switch view to plain text mode 
?
Thanks