Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I edit resource file?

How can I edit resource file?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 866 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    neda
    wrote on last edited by
    #1

    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();
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

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

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        4

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved