How to read file from QRC?
Solved
General and Desktop
-
Hey
Bit annoying but I have this in QRC:
<RCC> <qresource prefix="/"> <file>data.glsl</file> </qresource> <qresource prefix="/openGL/"> <file alias="testX">file/test.glsl</file> </qresource> </RCC>
And I wish to load it as :
QString path = "/openGL/testX" loadShader(path); .... void loadShader(QString filePath){ QFile v(filePath); v.open(QIODevice::ReadOnly); qDebug() << v.readAll(); if (!mShader->addShaderFromSourceFile(QOpenGLShader::Vertex, v.readAll())) {
This seems to not work...
device not open
bla bla bla...What to do ?
TIA
-
Hi
When having files in a resource file, the syntax for its paths is
":/xxx" . note the start :
Anyway, find the file in the project explorer tree and right click the file.
You can then copy the complete path to use.