Cannot open resource file

后端 未结 3 678
囚心锁ツ
囚心锁ツ 2021-01-17 23:03

Here is my code:

QFile test(\"://needle.png\"); // also tried :/needle.png :\\needle.png :\\\\needle.png

if(test.open(QFile::ReadOnly)) {
    qDebug() <&         


        
相关标签:
3条回答
  • 2021-01-17 23:44

    I had exactly the same problem. Running qmake again finally worked (build -> run qmake).

    0 讨论(0)
  • 2021-01-17 23:50

    Does the URL notation

    QFile test("qrc:///needle.png");
    

    work for you?

    0 讨论(0)
  • 2021-01-17 23:59

    I removed the project.user.pro file, reopened QT. And it chose the kit and rebuilt. Working now.

    0 讨论(0)
提交回复
热议问题