title: Qt global style sheet loading?
body: <p>How can I load a style sheet (.qss style resource) globally with Qt? </p>
  
  <p>I am trying to make things a bit more efficient than:</p>
  
  <pre><code>middleIntText -&gt; setStyleSheet("QLineEdit {  border: 1px solid gray;
                                  border-radius: 5px;padding: 0 8px;
                                  selection-background-color:darkgray;
                                  height:40px;font-size:15px;}");
  </code></pre>
  
  <p>I thought the following would work at loading QLineEdit the one time for all QLineEdit widgets:</p>
  
  <p><em>qss file:</em></p>
  
  <pre><code>QLineEdit {     border: 1px solid gray;
                  border-radius: 5px;
                  padding: 0 8px;
                  selection-background-color:darkgray;
                  height:40px;
                  font-size:15px;}
  </code></pre>
  
  <p><em>cpp file:</em></p>
  
  <pre><code>QApplication a(argc, argv);
  QFile stylesheet("formStyle.qss");
  stylesheet.open(QFile::ReadOnly);
  QString setSheet = QLatin1String(stylesheet.readAll());
  a.setStyleSheet(setSheet);
  </code></pre>
  
  <p>Perhaps this is right and I am doing something else wrong?</p>