How can I edit resource file?



  • Hi

    I have a XML file in some folder of my project.

    I can to read the file but I am not able to write.

    I have this error:

    QIODevice::write (QFile, ":\files\zoom.XML"): device not open

    void MyXML::save(){
    
        QFile file(":/files/zoom.XML");
        if (!file.open(QIODevice::WriteOnly | QFile::Text))
            return;
    
        QXmlStreamWriter xmlWriter(&file);
        xmlWriter.setAutoFormatting(true);
        xmlWriter.writeStartDocument();
    
        xmlWriter.writeStartElement("record");
    
        xmlWriter.writeAttribute("prop1",newProp1);
        ...
    	...
        xmlWriter.writeAttribute("propn",newPropn);
    
        xmlWriter.writeEndElement();
    }
    

  • Lifetime Qt Champion

    Hi,

    You can't write in a resource file. It's built in your application.

    If you need a file that's modifiable, you should copy it in a standard application specific path that you can retrieve with QStandardPaths



  • Resource file is readonly file. You will not able to write this file.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.