Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Compiled qml sources visible inside executable
Forum Updated to NodeBB v4.3 + New Features

Compiled qml sources visible inside executable

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
23 Posts 7 Posters 6.8k Views 4 Watching
  • 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.
  • fcarneyF Offline
    fcarneyF Offline
    fcarney
    wrote on last edited by
    #14

    @KH-219Design
    Is this a debug binary? I wonder if that makes a difference.

    C++ is a perfectly valid school of magic.

    FalsinSoftF 1 Reply Last reply
    0
    • fcarneyF fcarney

      @KH-219Design
      Is this a debug binary? I wonder if that makes a difference.

      FalsinSoftF Offline
      FalsinSoftF Offline
      FalsinSoft
      wrote on last edited by
      #15

      @fcarney In my case it's a release

      1 Reply Last reply
      1
      • FalsinSoftF Offline
        FalsinSoftF Offline
        FalsinSoft
        wrote on last edited by FalsinSoft
        #16

        Created bug report here

        1 Reply Last reply
        2
        • KH-219DesignK KH-219Design

          I see the giant omission in my prior post.

          I did not run with qmake CONFIG+=qtquickcompiler !!

          Oops. Doing that now, and will report the result.

          J Offline
          J Offline
          jobusch
          wrote on last edited by
          #17

          @KH-219Design Hey dude, you nearly saved my day. I was trying to use your method to get back some lost source .qml files, because I lost data of my source files but still got the directory it was compiled.

          I have exactly the same files as you have and I did it the same way.
          Using your example file I get clear readable text, but using my file it is not working, so maybe I have another encoding? Any idea on how I could try to find out my encoding? In Qt Editor it says Windows CRLF (which is only about line endings, right?) Looking into my settings it says utf-8, which didnt work.

          Any help would really be appreciated!

          This is the output I get:

          ê  
          VÄo|n2ôZcf¨xäÂTq;õjk§µs’¦J
          B.1°1W*½J2Ld{û•äæî\ºÄÌ.À9>½ ¼(Þ±`d¦€	-Ë
          V\#|
          ë5ýsïTÞÉ{zz½Fýü-êîPŸ‚ÎðÞ?3¯Åºû¯¬ŸEºû_H÷^@ú‹ÔôÎT*ÓЯ‡»÷ª¸{Oã^^5¤ÌŠ~^ßìÖ!×"1Ö…hÒ?.t½Öá‚Û‰ÔEâÔü¨×I<Ë;xå^vô2Rq÷~Û„:U&•ß9õËuÕ$òw\Sææ‘° úáqm‘nŠ˜9°+ñ~ñEÑ R-¸•ˆ£RØ•þèûØë£Á
          
          

          from:

            b = bytearray.fromhex("00 00 02 ea \
            00 \
            00 0a 1b 78 9c bd 95 6d 4f db 30 10 c7 df 23 f5 \
            3b 58 d9 0b 40 db d2 07 b1 09 55 94 09 ba 49 a0 \
            8d 17 ac 6c 7b ed 38 d7 c6 c2 b5 83 7d a1 14 c4 \
            77 df 39 49 97 a4 4f 0c a6 e1 b6 6a 72 ff f3 f9 \
            fc f3 25 27 a7 a9 b1 c8 2e f1 32 93 e2 9a f5 c2 \
            ee 87 d6 8e 6c 18 c3 5f 52 c7 66 b6 5e 1b 1a 8d \
            d6 28 f7 84 da 0d 0f 56 c4 6f 7c 6e 32 f4 5a 63 \
            66 a8 78 e4 c2 54 71 1c 1b 3b f5 6a 6b a7 b5 73 \
            92 a6 4a 0a 8e d2 e8 32 9d 87 d6 0e a3 21 e3 3e \
            9b 72 a9 67 b9 b5 b0 dd 4a 27 23 05 7d 86 36 83 \
            c2 34 93 31 26 7d f6 f1 a0 53 dc 27 20 27 09 f6 \
            d9 c1 61 69 40 89 7e c6 8d bb b2 7b c1 e7 9f ec \
            c2 44 52 01 1b 65 12 81 9d 19 87 c1 be cf c3 bb \
            1a 3d 54 c6 49 3d e9 2f 92 f0 43 90 0d 42 2e 04 \
            a4 08 31 1b b0 31 57 0e 2a bd 4a 32 4c 64 0c 7b \
            fb 95 e4 e6 ee 5c 18 1d ba c4 cc 2e c0 39 3e 81 \
            bd a0 bc 28 12 0b de b1 60 64 a6 80 09 2d cb 0a \
            56 5c 23 13 7c 0a 2c 4b 43 36 54 fe f8 48 76 0c \
            0d bb d6 04 68 6a 2c 84 41 b9 cc e3 22 f9 d1 dc \
            21 4c af 2c 9f fb 25 eb 1b f0 24 cb 4c 2a e3 1a \
            94 b9 6f 9e ae c9 ac 20 29 b8 b1 a2 df b6 e0 e8 \
            37 a6 bf 24 4c f5 24 a8 9c d1 18 85 32 dd 06 97 \
            8d c0 de 82 0d 6a 50 8c 3e 11 28 6f 39 c1 6c 70 \
            5e 62 e9 99 d5 59 2e c9 96 4b 07 db 74 b8 c9 c0 \
            e1 62 a9 ba 67 8e ac 46 af b8 bc e2 d1 29 b7 cb \
            dc 22 6e 2b 43 59 6b 29 b7 a0 31 cc ef 2a 31 e2 \
            e2 7a 62 4d a6 69 d6 77 10 74 8a 13 22 b1 b4 3f \
            3f da 6d 61 94 b1 84 f7 4d f7 d0 7f 82 a6 cf 42 \
            45 cb b5 2b d6 5a f2 78 ac 55 58 ca 45 5e b0 9d \
            ca e6 77 92 21 36 8b 60 b1 21 e4 51 a7 69 45 b8 \
            a3 e7 25 38 1a 1b 5f 77 7e f1 c1 ee 2c a1 03 dc \
            3d 0e d8 db f2 6c bf 52 3d 5a ee 82 7d b2 04 47 \
            6d ef 7b 1c 2c d0 3d 1b c1 d2 56 09 72 28 32 eb \
            77 7a ae 63 b8 63 83 01 eb b0 4f 15 20 46 f9 45 \
            8a a2 6f 06 e1 47 ca e3 38 87 d1 eb 2c a7 d6 ce \
            53 0e 23 a3 e2 0d eb 35 fd 73 ef 54 de 81 1a c9 \
            7b 7a 14 7a bd 46 fd fc 2d ea ee 0b 50 9f 82 ce \
            f0 de 3f 33 af c5 ba fb af ac 9f 45 ba fb 5f 48 \
            f7 5e 40 fa 8b d4 f4 ce 54 2a d3 13 d0 af 87 bb \
            f7 aa b8 7b 4f e3 5e 01 5e 35 15 a4 cc 8a 7e 5e \
            df ec d6 17 21 d7 22 31 d6 85 68 d2 3f 2e 74 bd \
            d6 e1 82 db 89 d4 45 e2 d4 fc a8 d7 49 3c cb 3b \
            78 e5 5e 76 f4 32 52 71 f7 7e db 84 3a 81 55 26 \
            95 df 39 f5 cb 75 d5 24 f2 77 1d 15 5c 53 1a e6 \
            e6 91 b0 00 fa e1 71 6d 91 6e 8a 98 39 b0 2b f1 \
            7e 90 f1 45 d1 1c 20 52 2d b8 95 88 a3 52 d8 18 \
            95 fe e8 fb 1b d8 eb a3 c1")
          
          1 Reply Last reply
          0
          • KH-219DesignK Offline
            KH-219DesignK Offline
            KH-219Design
            wrote on last edited by
            #18

            @jobusch two questions for you:

            1. What operating system are you on? (I'm guessing windows because you mentioned CRLF, but best to be explicit.)
            2. Are you using CONFIG+=qtquickcompiler in your project build, yes or no?

            What we determined in this thread previously is that without CONFIG+=qtquickcompiler, the raw QML text is present, and likewise with CONFIG+=qtquickcompiler the plain QML text is still present, but a bunch of other stuff could be inserted around it.

            So if qtquickcompiler was part of the configuration when your binary was produced, it could complicate your efforts (but should not thwart them entirely).

            www.219design.com
            Software | Electrical | Mechanical | Product Design

            1 Reply Last reply
            0
            • KH-219DesignK Offline
              KH-219DesignK Offline
              KH-219Design
              wrote on last edited by
              #19

              @jobusch As far as I was aware several years ago, Microsoft still had a penchant for preferring UTF-16/UCS-2 over utf8. So that's something to maybe consider.

              www.219design.com
              Software | Electrical | Mechanical | Product Design

              1 Reply Last reply
              0
              • KH-219DesignK Offline
                KH-219DesignK Offline
                KH-219Design
                wrote on last edited by
                #20

                @jobusch another thought:

                the qt resource compiler can be used to "bake in" more than just QML text. resources can be of arbitrary files types. (e.g. pdf files, graphical assets, other documents).

                Maybe you are mistakenly focusing on the wrong batch of hex bytes? Maybe the bytes you grabbed for examination via python are not, in fact, bytes from a QML text file?

                If you look at my gist again: https://gist.github.com/pestophagous/bf30369f824a7344d047496002afdc52

                You'll see that qt_resource_data is one giant static array, but the resource compiler inserted various comments lines throughout:

                // /opt/repositories/client/219/qt-qml-cpp-proj-template/src/lib_app/qml/ImageSvgHelper.qml
                ...
                 // /opt/repositories/client/219/qt-qml-cpp-proj-template/src/lib_app/qml/VersionLabel.qml
                ...
                // /opt/repositories/client/219/qt-qml-cpp-proj-template/src/lib_app/qml/qmldir
                

                Does your file have such comment lines?

                Another factual question that I should have asked earlier, for completeness:

                1. What version of Qt are you using?

                www.219design.com
                Software | Electrical | Mechanical | Product Design

                1 Reply Last reply
                0
                • KH-219DesignK Offline
                  KH-219DesignK Offline
                  KH-219Design
                  wrote on last edited by
                  #21

                  @jobusch GOT IT.

                  today is my most hacking-est day in a while.

                  So I ended up here: https://en.wikipedia.org/wiki/List_of_file_signatures

                  Noticed that 78 9C is a marker for zlib.

                  So I took the python that you shared, chopped off everything that was in front of 78 9C.

                  That left me with something like:

                  bb = bytearray.fromhex("78 9c bd 95 6d 4f db 30 10 c7 df 23 f5 \
                    3b 58 d9 0b 40 db d2 07 b1 09 55 94 09 ba 49 a0 \
                    8d 17 ac 6c 7b ed 38 d7 c6 c2 b5 83 7d a1 14 c4 \
                  
                  ...
                  

                  I wrote that to a file named abc.zlib

                  Then ran this (in bash terminal):

                  zlib-flate -uncompress < abc.zlib  > out.qml
                  

                  And I now see your code:

                  ...
                  
                          TabButton {
                              id: tab1
                              text: "<font color='white'>" + qsTr("Benutzer") + "</font>"
                  
                              background: Rectangle {
                                          color: bar.currentIndex == 1 ? "#181818" : "black"
                              }
                              padding: 20
                              //font.bold: bar.currentIndex == 1
                              font.pixelSize: 22
                          }
                          TabButton {
                              id: tab2
                              text: "<font color='white'>" + qsTr("Einstellungen") + "</font>"
                  
                              background: Rectangle {
                                          color: bar.currentIndex == 2 ? "#181818" : "black"
                              }
                              padding: 20
                              //font.bold: bar.currentIndex == 2
                              font.pixelSize: 22
                  
                          }
                  
                  ...

                  www.219design.com
                  Software | Electrical | Mechanical | Product Design

                  1 Reply Last reply
                  2
                  • K Offline
                    K Offline
                    kibsoft
                    wrote on last edited by
                    #22

                    As a workaround we can use

                    QMAKE_RESOURCE_FLAGS += -threshold 0
                    

                    for QMake projects. All the files from resources will be compressed and most part of the QML code will be hidden.
                    The reason why all QML files are included to the final executable when QtQuickCompiler is turned on is described here.

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      sidsukana
                      wrote on last edited by
                      #23
                      This post is deleted!
                      1 Reply Last reply
                      0

                      • Login

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