Qt World Summit: Submit your Presentation

Can't open text file resource

  • I try to open a text file that I added as resource but can't find any valid argument for open(... )

    With gcc it compiles fine and I can work with the file after opening

    QFile file("qrc:/myfile.txt);

    if (!file.open(QIODevice::ReadOnly))..

    Once I switch to the wasm kit the line with. Open gets red with the error that no valid argument is supplied to open() ... I can't find out what the valid argument would be
    Just to clarify I am not talking about a local file, the text file is compiled into the application as resource
    Any hints?

  • If the resource is in a library make sure to invoke Q_INIT_RESOURCE for your resource file (see documentation for details).

Log in to reply