I simply want to use a style sheet.
I get this error when I want to Compile

C:\Erfan\C++\Exersize\QT\untitled01\main.cpp:19: error: 'class QCoreApplication' has no member named 'setStyleSheet'
QApplication::instance()->setStyleSheet(ts.readAll());
^
Here's my Code
Qt Code:
  1. #include "mainwindow.h"
  2. #include <QApplication>
  3. #include <QFile>
  4. #include <Qtextstream>
  5.  
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9.  
  10. QFile f(":qdarkstyle/style.qss");
  11. if (!f.exists())
  12. {
  13. printf("Unable to set stylesheet, file not found\n");
  14. }
  15. else
  16. {
  17. f.open(QFile::ReadOnly | QFile::Text);
  18. QTextStream ts(&f);
  19. QApplication::instance()->setStyleSheet(ts.readAll());
  20. }
  21.  
  22. QApplication a(argc, argv);
  23. MainWindow w;
  24.  
  25. w.show();
  26.  
  27. return a.exec();
  28. }
To copy to clipboard, switch view to plain text mode