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. Is it possible to write to a qrc file dynamically?
Forum Update on Monday, May 27th 2025

Is it possible to write to a qrc file dynamically?

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 5 Posters 1.3k 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.
  • H Offline
    H Offline
    Hasan Al-Baghdadi
    wrote on last edited by
    #1

    I've tried to open a qrc file for writing but it didn't work.

    with errorString() returning unkown error.

    Is there another way to do it?

    J.HilkJ 1 Reply Last reply
    0
    • H Hasan Al-Baghdadi

      I've tried to open a qrc file for writing but it didn't work.

      with errorString() returning unkown error.

      Is there another way to do it?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @Hasan-Al-Baghdadi
      no you can not.

      qrc file is really only a xml based text file that is used to create binary data of your listed files/filetree to either pack into your executable or an external binary resource.

      That is generated during compilation. Therefore "readonly"


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        To add to @J-Hilk, do you mean write to one of the file provided by your .qrc file from within your application ?

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

        H 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          To add to @J-Hilk, do you mean write to one of the file provided by your .qrc file from within your application ?

          H Offline
          H Offline
          Hasan Al-Baghdadi
          wrote on last edited by
          #4

          @J-Hilk
          Thanks, that's quite unfortunate.

          @SGaist
          yes

          Pablo J. RoginaP 1 Reply Last reply
          0
          • H Hasan Al-Baghdadi

            @J-Hilk
            Thanks, that's quite unfortunate.

            @SGaist
            yes

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #5

            @Hasan-Al-Baghdadi if your issue is solved (or at least isn't going to be the way you expected) please don't forget to mark the post as solved.

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            H 1 Reply Last reply
            0
            • Pablo J. RoginaP Pablo J. Rogina

              @Hasan-Al-Baghdadi if your issue is solved (or at least isn't going to be the way you expected) please don't forget to mark the post as solved.

              H Offline
              H Offline
              Hasan Al-Baghdadi
              wrote on last edited by
              #6

              @Pablo-J.-Rogina my bad

              mrjjM 1 Reply Last reply
              0
              • H Hasan Al-Baghdadi

                @Pablo-J.-Rogina my bad

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Hasan-Al-Baghdadi
                Hi
                What was the use case ?
                I mean, what did you want to write back to rc ?
                Just curious.

                H 1 Reply Last reply
                0
                • mrjjM mrjj

                  @Hasan-Al-Baghdadi
                  Hi
                  What was the use case ?
                  I mean, what did you want to write back to rc ?
                  Just curious.

                  H Offline
                  H Offline
                  Hasan Al-Baghdadi
                  wrote on last edited by
                  #8

                  @mrjj
                  There is an input file that has to be read. It's assumed you're most likley to used the one you last used, so a copy is saved in the qrc, or atleast that was the plan.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    In that case you should have a default file that you have in your .qrc file and then use QStandardPaths to store it in and use it from a sensible place.

                    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
                    4

                    • Login

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