Qt carregamento de folha de estilo global?

Como posso carregar uma folha de estilo (recurso de estilo .qss) globalmente com o Qt?

Eu estou tentando tornar as coisas um pouco mais eficientes do que:

middleIntText -> setStyleSheet("QLineEdit {  border: 1px solid gray;
                                border-radius: 5px;padding: 0 8px;
                                selection-background-color:darkgray;
                                height:40px;font-size:15px;}");

Eu pensei que o seguinte funcionaria ao carregar o QLineEdit uma vez para todos os widgets do QLineEdit:

arquivo qss:

QLineEdit {     border: 1px solid gray;
                border-radius: 5px;
                padding: 0 8px;
                selection-background-color:darkgray;
                height:40px;
                font-size:15px;}

arquivo cpp:

QApplication a(argc, argv);
QFile stylesheet("formStyle.qss");
stylesheet.open(QFile::ReadOnly);
QString setSheet = QLatin1String(stylesheet.readAll());
a.setStyleSheet(setSheet);

Talvez isso esteja certo e eu esteja fazendo algo errado?

questionAnswers(2)

yourAnswerToTheQuestion