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. Invalid property assignment error in DLL but not QT creator
Forum Updated to NodeBB v4.3 + New Features

Invalid property assignment error in DLL but not QT creator

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
21 Posts 3 Posters 3.5k Views 2 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.
  • L Offline
    L Offline
    Lord Bytor
    wrote on 3 Feb 2021, 15:09 last edited by
    #1

    I'm building a DLL which creates an FBO from a QT window, I have the dll outputting error logs to a file and I keep getting this:

    Invalid property assignment: color expected
    

    on the following QML:

    import QtQuick 2.15
    
    Item {
        Rectangle {
            id: rectangle
            x: 0
            y: 0
            width: 614
            height: 376
            color: "#00aa00"
            Text {
                id: text1
                text: qsTr("Text")
            }
    
            Image {
                id: image
                x: 16
                y: 56
                width: 100
                height: 100
                source: "qrc:/qtquickplugin/images/template_image.png"
                fillMode: Image.PreserveAspectFit
            }
        }
    
    }
    

    This displays as expected in QT creator, but brings up error in my DLL. If I remove the line "color: "#00aa00" everything works correctly. Any idea on what I could possibly be doing wrong here?

    O L 2 Replies Last reply 4 Feb 2021, 14:57
    0
    • L Lord Bytor
      3 Feb 2021, 15:09

      I'm building a DLL which creates an FBO from a QT window, I have the dll outputting error logs to a file and I keep getting this:

      Invalid property assignment: color expected
      

      on the following QML:

      import QtQuick 2.15
      
      Item {
          Rectangle {
              id: rectangle
              x: 0
              y: 0
              width: 614
              height: 376
              color: "#00aa00"
              Text {
                  id: text1
                  text: qsTr("Text")
              }
      
              Image {
                  id: image
                  x: 16
                  y: 56
                  width: 100
                  height: 100
                  source: "qrc:/qtquickplugin/images/template_image.png"
                  fillMode: Image.PreserveAspectFit
              }
          }
      
      }
      

      This displays as expected in QT creator, but brings up error in my DLL. If I remove the line "color: "#00aa00" everything works correctly. Any idea on what I could possibly be doing wrong here?

      O Offline
      O Offline
      ODБOï
      wrote on 4 Feb 2021, 14:57 last edited by
      #2

      hi @Lord-Bytor
      you could try color : Qt.rgba() or Qt.hsla()

      1 Reply Last reply
      0
      • L Lord Bytor
        3 Feb 2021, 15:09

        I'm building a DLL which creates an FBO from a QT window, I have the dll outputting error logs to a file and I keep getting this:

        Invalid property assignment: color expected
        

        on the following QML:

        import QtQuick 2.15
        
        Item {
            Rectangle {
                id: rectangle
                x: 0
                y: 0
                width: 614
                height: 376
                color: "#00aa00"
                Text {
                    id: text1
                    text: qsTr("Text")
                }
        
                Image {
                    id: image
                    x: 16
                    y: 56
                    width: 100
                    height: 100
                    source: "qrc:/qtquickplugin/images/template_image.png"
                    fillMode: Image.PreserveAspectFit
                }
            }
        
        }
        

        This displays as expected in QT creator, but brings up error in my DLL. If I remove the line "color: "#00aa00" everything works correctly. Any idea on what I could possibly be doing wrong here?

        L Offline
        L Offline
        Lord Bytor
        wrote on 8 Feb 2021, 21:45 last edited by
        #3

        Realized that updating code to

        color: Qt.rgba(0,1,0,1)
        

        Stopped errors, but once I actually rendered the output I realize that it color is not working on text at all. It always come out as black. Also trying to do anything like setting

        font.pixelSize: 12
        

        results in an "Invalid property assignment error", again everything is fine in QT creator but not my DLL.

        J 1 Reply Last reply 8 Feb 2021, 23:12
        0
        • L Lord Bytor
          8 Feb 2021, 21:45

          Realized that updating code to

          color: Qt.rgba(0,1,0,1)
          

          Stopped errors, but once I actually rendered the output I realize that it color is not working on text at all. It always come out as black. Also trying to do anything like setting

          font.pixelSize: 12
          

          results in an "Invalid property assignment error", again everything is fine in QT creator but not my DLL.

          J Offline
          J Offline
          JKSH
          Moderators
          wrote on 8 Feb 2021, 23:12 last edited by
          #4

          @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

          everything is fine in QT creator but not my DLL.

          How did you deploy your DLL?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Lord Bytor
            wrote on 9 Feb 2021, 14:13 last edited by Lord Bytor 2 Sept 2021, 14:14
            #5

            Built it in QT creator msvc2017 64bit release, used DLL's "LibEGL, QICore, etc..." from qt\5.15.2\msvc2019_64\bin
            Edit: also tried building as QT 5.15.2 MSVC2019 64 bit but appears to act the same

            J 1 Reply Last reply 9 Feb 2021, 14:34
            0
            • L Lord Bytor
              9 Feb 2021, 14:13

              Built it in QT creator msvc2017 64bit release, used DLL's "LibEGL, QICore, etc..." from qt\5.15.2\msvc2019_64\bin
              Edit: also tried building as QT 5.15.2 MSVC2019 64 bit but appears to act the same

              J Offline
              J Offline
              JKSH
              Moderators
              wrote on 9 Feb 2021, 14:34 last edited by
              #6

              @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

              used DLL's "LibEGL, QICore, etc..." from qt\5.15.2\msvc2019_64\bin

              Did you use windeployqt?

              See also https://wiki.qt.io/Deploy_an_Application_on_Windows

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              L 1 Reply Last reply 9 Feb 2021, 14:39
              2
              • J JKSH
                9 Feb 2021, 14:34

                @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                used DLL's "LibEGL, QICore, etc..." from qt\5.15.2\msvc2019_64\bin

                Did you use windeployqt?

                See also https://wiki.qt.io/Deploy_an_Application_on_Windows

                L Offline
                L Offline
                Lord Bytor
                wrote on 9 Feb 2021, 14:39 last edited by
                #7

                @JKSH I'll try that

                J 1 Reply Last reply 9 Feb 2021, 14:59
                0
                • L Lord Bytor
                  9 Feb 2021, 14:39

                  @JKSH I'll try that

                  J Offline
                  J Offline
                  JKSH
                  Moderators
                  wrote on 9 Feb 2021, 14:59 last edited by
                  #8

                  @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                  @JKSH I'll try that

                  Good luck.

                  The windeployqt documentation is at https://doc.qt.io/qt-5/windows-deployment.html ; you might need to use the --qmldir and --qmlimport options.

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  L 1 Reply Last reply 9 Feb 2021, 20:14
                  2
                  • J JKSH
                    9 Feb 2021, 14:59

                    @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                    @JKSH I'll try that

                    Good luck.

                    The windeployqt documentation is at https://doc.qt.io/qt-5/windows-deployment.html ; you might need to use the --qmldir and --qmlimport options.

                    L Offline
                    L Offline
                    Lord Bytor
                    wrote on 9 Feb 2021, 20:14 last edited by Lord Bytor 2 Sept 2021, 21:19
                    #9

                    Well I've used windeployqt and I may have had some success because the image in my QML is showing up properly but all other colors seem non functional. I built including every possible library just to be on the safe side and still no other colors.
                    Edit: in the output of windeployqt I see Qt5Declarative.dll does not exist, not sure if thats important
                    What I expect:
                    designer_qt.png
                    What I actually see:
                    dll_qt.png

                    J 1 Reply Last reply 9 Feb 2021, 22:43
                    0
                    • L Lord Bytor
                      9 Feb 2021, 20:14

                      Well I've used windeployqt and I may have had some success because the image in my QML is showing up properly but all other colors seem non functional. I built including every possible library just to be on the safe side and still no other colors.
                      Edit: in the output of windeployqt I see Qt5Declarative.dll does not exist, not sure if thats important
                      What I expect:
                      designer_qt.png
                      What I actually see:
                      dll_qt.png

                      J Offline
                      J Offline
                      JKSH
                      Moderators
                      wrote on 9 Feb 2021, 22:43 last edited by
                      #10

                      @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                      I may have had some success because the image in my QML is showing up properly but all other colors seem non functional.

                      That's very odd.

                      Try these:

                      1. Launch your app from the Command Line. Do you see any error messages?
                      2. While your deployed app is running, use Process Explorer to see the list of DLLs that your app is using. Pay extra attention to the absolute paths of the Qt DLLs. Repeat this while you run your app from Qt Creator. What differences do you see (if any)?

                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                      L 1 Reply Last reply 10 Feb 2021, 15:28
                      0
                      • J JKSH
                        9 Feb 2021, 22:43

                        @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                        I may have had some success because the image in my QML is showing up properly but all other colors seem non functional.

                        That's very odd.

                        Try these:

                        1. Launch your app from the Command Line. Do you see any error messages?
                        2. While your deployed app is running, use Process Explorer to see the list of DLLs that your app is using. Pay extra attention to the absolute paths of the Qt DLLs. Repeat this while you run your app from Qt Creator. What differences do you see (if any)?
                        L Offline
                        L Offline
                        Lord Bytor
                        wrote on 10 Feb 2021, 15:28 last edited by
                        #11

                        Unfortunately this dll being used by a game engine rather than an app so I can't really run it from creator or launch it from the command line. I based it loosely off of the quickrendercontrol example but as a dll rather than app

                        J 1 Reply Last reply 10 Feb 2021, 15:42
                        0
                        • L Lord Bytor
                          10 Feb 2021, 15:28

                          Unfortunately this dll being used by a game engine rather than an app so I can't really run it from creator or launch it from the command line. I based it loosely off of the quickrendercontrol example but as a dll rather than app

                          J Offline
                          J Offline
                          JKSH
                          Moderators
                          wrote on 10 Feb 2021, 15:42 last edited by
                          #12

                          @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                          Unfortunately this dll being used by a game engine rather than an app so I can't really run it from creator or launch it from the command line.

                          Then do the first part of Step #2. Are your Qt DLLs being loaded from the folder(s) that you expect?

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          1 Reply Last reply
                          0
                          • L Offline
                            L Offline
                            Lord Bytor
                            wrote on 10 Feb 2021, 16:07 last edited by
                            #13

                            Well it looks like all dll's are running from the correct location with the exception of Qt5Svg.dll which path is from perforce instead. That dll exists at the expected folder, so I'm puzzled as to why it's using preforce's copy instead.

                            J 1 Reply Last reply 11 Feb 2021, 01:14
                            0
                            • L Lord Bytor
                              10 Feb 2021, 16:07

                              Well it looks like all dll's are running from the correct location with the exception of Qt5Svg.dll which path is from perforce instead. That dll exists at the expected folder, so I'm puzzled as to why it's using preforce's copy instead.

                              J Offline
                              J Offline
                              JKSH
                              Moderators
                              wrote on 11 Feb 2021, 01:14 last edited by
                              #14

                              @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                              path is from perforce

                              Check your PATH. Make sure that the PATH does not contain any folders which contains Qt DLLs. (This is the #1 cause of strange loading issues)

                              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                              L 1 Reply Last reply 11 Feb 2021, 14:52
                              0
                              • J JKSH
                                11 Feb 2021, 01:14

                                @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                                path is from perforce

                                Check your PATH. Make sure that the PATH does not contain any folders which contains Qt DLLs. (This is the #1 cause of strange loading issues)

                                L Offline
                                L Offline
                                Lord Bytor
                                wrote on 11 Feb 2021, 14:52 last edited by
                                #15

                                @JKSH Fixed path, doesn't load Qt5Svg.dll at all but my example still loads.. still doesn't recognize color in hex format and Qt.rgba does nothing to change color of text or background

                                1 Reply Last reply
                                0
                                • J Offline
                                  J Offline
                                  JKSH
                                  Moderators
                                  wrote on 11 Feb 2021, 15:19 last edited by
                                  #16

                                  @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                                  still doesn't recognize color in hex format and Qt.rgba does nothing to change color of text or background

                                  Hmm... very strange.

                                  Are you able to create and deploy a small QML app that has coloured background and text?

                                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                  L 1 Reply Last reply 11 Feb 2021, 16:09
                                  0
                                  • J JKSH
                                    11 Feb 2021, 15:19

                                    @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                                    still doesn't recognize color in hex format and Qt.rgba does nothing to change color of text or background

                                    Hmm... very strange.

                                    Are you able to create and deploy a small QML app that has coloured background and text?

                                    L Offline
                                    L Offline
                                    Lord Bytor
                                    wrote on 11 Feb 2021, 16:09 last edited by
                                    #17

                                    So I built a small window example

                                    import QtQuick 2.2
                                    import QtQuick.Window 2.2
                                    
                                    Window {
                                        width: 640
                                        height: 480
                                        visible: true
                                        color: "#67ee62"
                                        title: qsTr("Hello World")
                                    
                                        Text {
                                            id: text1
                                            color: "#f63c3c"
                                            text: qsTr("Text")
                                            font.pixelSize: 12
                                        }
                                    }
                                    

                                    deployed and application works
                                    updated qml of my dll to use the same and I get

                                    qrc:/rendercontrol/demo.qml:2:1: module "QtQuick.Window" is not installed : 
                                    

                                    I have QT += quick in the .pro file of dll and deploying the same as app, but getting very different results

                                    J 1 Reply Last reply 12 Feb 2021, 01:46
                                    0
                                    • L Lord Bytor
                                      11 Feb 2021, 16:09

                                      So I built a small window example

                                      import QtQuick 2.2
                                      import QtQuick.Window 2.2
                                      
                                      Window {
                                          width: 640
                                          height: 480
                                          visible: true
                                          color: "#67ee62"
                                          title: qsTr("Hello World")
                                      
                                          Text {
                                              id: text1
                                              color: "#f63c3c"
                                              text: qsTr("Text")
                                              font.pixelSize: 12
                                          }
                                      }
                                      

                                      deployed and application works
                                      updated qml of my dll to use the same and I get

                                      qrc:/rendercontrol/demo.qml:2:1: module "QtQuick.Window" is not installed : 
                                      

                                      I have QT += quick in the .pro file of dll and deploying the same as app, but getting very different results

                                      J Offline
                                      J Offline
                                      JKSH
                                      Moderators
                                      wrote on 12 Feb 2021, 01:46 last edited by
                                      #18

                                      @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                                      I have QT += quick in the .pro file

                                      This only affects compilation; it does not contribute to deployment.

                                      qrc:/rendercontrol/demo.qml:2:1: module "QtQuick.Window" is not installed
                                      

                                      ...

                                      deploying the same as app, but getting very different results

                                      Inspect every single file in the deployment folders of your example app and your big DLL. Ensure that all the files that were deployed with your example app also exist when you deploy your DLL (including qmldir files).

                                      Also, try cleaning your project (delete the "build" folder) and build it again from scratch before deploying.

                                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                      L 1 Reply Last reply 16 Feb 2021, 14:57
                                      0
                                      • J JKSH
                                        12 Feb 2021, 01:46

                                        @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                                        I have QT += quick in the .pro file

                                        This only affects compilation; it does not contribute to deployment.

                                        qrc:/rendercontrol/demo.qml:2:1: module "QtQuick.Window" is not installed
                                        

                                        ...

                                        deploying the same as app, but getting very different results

                                        Inspect every single file in the deployment folders of your example app and your big DLL. Ensure that all the files that were deployed with your example app also exist when you deploy your DLL (including qmldir files).

                                        Also, try cleaning your project (delete the "build" folder) and build it again from scratch before deploying.

                                        L Offline
                                        L Offline
                                        Lord Bytor
                                        wrote on 16 Feb 2021, 14:57 last edited by
                                        #19

                                        @JKSH Well, I've checked and rebuilt multiple times beyond comparing all folders, I think there is just some sort of issue running this in a DLL maybe in how Unity takes in DLLs. I may just have to go with a different solution.

                                        J 1 Reply Last reply 16 Feb 2021, 22:39
                                        0
                                        • L Lord Bytor
                                          16 Feb 2021, 14:57

                                          @JKSH Well, I've checked and rebuilt multiple times beyond comparing all folders, I think there is just some sort of issue running this in a DLL maybe in how Unity takes in DLLs. I may just have to go with a different solution.

                                          J Offline
                                          J Offline
                                          JKSH
                                          Moderators
                                          wrote on 16 Feb 2021, 22:39 last edited by
                                          #20

                                          @Lord-Bytor said in Invalid property assignment error in DLL but not QT creator:

                                          maybe in how Unity takes in DLLs

                                          I just remembered: You Unity app's working directory is probably different from your DLL's location, so Qt can't find the QML modules. If you want to check, record the results of QDir::currentPath() from your DLL and from your small window example app.

                                          Anyway, call QQmlEngine::addImportPath() to tell Qt where to find the QML modules: https://stackoverflow.com/questions/35352930/qt5-qml-module-is-not-installed/49326965#49326965

                                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                          L 1 Reply Last reply 17 Feb 2021, 14:50
                                          1

                                          1/21

                                          3 Feb 2021, 15:09

                                          • Login

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