Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QT doesn't want to load resource
xLlama last edited by xLlama
I want to load a resource. This is my code:
QFile file(":/images/loading"); QByteArray dump = file.readAll(); qDebug() << "contents: " << dump; qDebug() << "error status: " << file.error();
But the output is:
QIODevice::read (QFile, ":\images\loading"): device not open contents: "" error status: 0
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = Streamcloud TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp HEADERS += mainwindow.h FORMS += mainwindow.ui CONFIG += mobility MOBILITY = DISTFILES += RESOURCES += \ images.qrc
<RCC> <qresource prefix="/images"> <file alias="loading">loading.gif</file> </qresource> </RCC>
What did I do wrong?
t3685 last edited by
You did not open your file for reading as indicated by the error messag "device not open".