title: Reading a CSS file using Qt C++
body: <p>I'm trying to load in a CSS file for formatting across my entire Qt application. Currently I have my "stylesheet.css" file in the same folder as my built exe (both debug and release). However, upon running the program it produces no errors and simply outputs "test: ", so it's clearly not finding the file or perhaps I'm not reading it properly?</p>
  
  <p>Forgive me if it's a dumb mistake - I'm fairly new to both Qt and C++.</p>
  
  <pre><code>#include "mainwindow.h"
  #include "qfile.h"
  #include "qtextstream.h"
  #include &lt;QApplication&gt;
  #include &lt;iostream&gt;
  
  int main(int argc, char *argv[])
  {
      QApplication program(argc, argv);
  
      QFile styleFile("stylesheet.css");
      styleFile.open(QIODevice::ReadOnly);
      QTextStream textStream(&amp;styleFile);
      QString styleSheet = textStream.readAll();
      styleFile.close();
      program.setStyleSheet(styleSheet);
  
      std::cout &lt;&lt; "test: " &lt;&lt; styleSheet.toStdString() &lt;&lt; std::endl;
  
      MainWindow w;
      w.showMaximized();
  
      return program.exec();
  }
  </code></pre>