title: can't load qrc files in Qt C++ program
body: <p>I am trying load css file to the program using qrc . But at run time at get following error:-</p>
  
  <pre><code>QIODevice::read (QFile, ":/css/stylesheet.qss"): device not open
  </code></pre>
  
  <p>I am using Cmake . here is my project's structure:-</p>
  
  <pre><code>.
  ├── calculator.cpp
  ├── calculator.h
  ├── calculator.ui
  ├── CMakeLists.txt
  ├── CMakeLists.txt.user
  ├── css
  │   └── stylesheet.qss
  ├── main.cpp
  └── resources.qrc
  </code></pre>
  
  <p>cmake file:-</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.9)
  
  project(Calculator)
  
  set(CMAKE_VERBOSE_MAKEFILE ON)
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -Wall -Wpedantic -Wextra -std=gnu++14")
  
  find_package(Qt5Widgets REQUIRED)
  
  set(CMAKE_AUTOMOC ON)
  set(CMAKE_AUTOUIC ON)
  set(CMAKE_AUTORCC ON)
  
  
  add_executable(${PROJECT_NAME} main.cpp calculator.cpp )
  target_link_libraries(Calculator Qt5::Widgets)
  </code></pre>
  
  <p>and here is the main.cpp file which uses the qrc file:-</p>
  
  <pre><code>#include &lt;QApplication&gt;
  #include &lt;QFile&gt;
  #include "calculator.h"
  #include &lt;QtDebug&gt;
  
  int main(int argc,char **argv)
  {
      QApplication *app= new QApplication(argc,argv);
  //  Q_INIT_RESOURCE(resources);
  
      QFile css(":/css/stylesheet.qss");
      if(css.open(QIODevice::ReadOnly ))
      {
          app-&gt;setStyleSheet(css.readAll());
          css.close();
      }else
      {
          qDebug("Failed") ;
          qDebug(css.readAll());
      }
  
      Calculator *cal = new Calculator(nullptr);
      cal-&gt;show();
  
      return  app-&gt;exec();
  
  }
  </code></pre>
  
  <p>and here is the resources.qrc file:-</p>
  
  <pre><code>&lt;RCC&gt;
      &lt;qresource prefix="/"&gt;
          &lt;file&gt;css/stylesheet.qss&lt;/file&gt;
      &lt;/qresource&gt;
  &lt;/RCC&gt;
  </code></pre>
  
  <p>when ever I try to run I get this output:-</p>
  
  <pre><code>qt5ct: using qt5ct plugin
  Failed
  QIODevice::read (QFile, ":/css/stylesheet.qss"): device not open
  </code></pre>
  
  <p>I am using Arch linux and gcc (GCC) 7.3.1 with QtCreator. I am, new to cmake and Qt.</p>