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 Lord Bytor

    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?

    ODБOïO Offline
    ODБOïO Offline
    ODБOï
    wrote on last edited by
    #2

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

    1 Reply Last reply
    0
    • L Lord Bytor

      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 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.

      JKSHJ 1 Reply Last reply
      0
      • L Lord Bytor

        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.

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on 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 last edited by Lord Bytor
          #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

          JKSHJ 1 Reply Last reply
          0
          • L Lord Bytor

            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

            JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on 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
            2
            • JKSHJ JKSH

              @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 last edited by
              #7

              @JKSH I'll try that

              JKSHJ 1 Reply Last reply
              0
              • L Lord Bytor

                @JKSH I'll try that

                JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on 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
                2
                • JKSHJ JKSH

                  @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 last edited by Lord Bytor
                  #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

                  JKSHJ 1 Reply Last reply
                  0
                  • L Lord Bytor

                    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

                    JKSHJ Offline
                    JKSHJ Offline
                    JKSH
                    Moderators
                    wrote on 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
                    0
                    • JKSHJ JKSH

                      @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 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

                      JKSHJ 1 Reply Last reply
                      0
                      • L Lord Bytor

                        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

                        JKSHJ Offline
                        JKSHJ Offline
                        JKSH
                        Moderators
                        wrote on 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 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.

                          JKSHJ 1 Reply Last reply
                          0
                          • L Lord Bytor

                            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.

                            JKSHJ Offline
                            JKSHJ Offline
                            JKSH
                            Moderators
                            wrote on 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
                            0
                            • JKSHJ JKSH

                              @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 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
                              • JKSHJ Offline
                                JKSHJ Offline
                                JKSH
                                Moderators
                                wrote on 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
                                0
                                • JKSHJ JKSH

                                  @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 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

                                  JKSHJ 1 Reply Last reply
                                  0
                                  • L Lord Bytor

                                    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

                                    JKSHJ Offline
                                    JKSHJ Offline
                                    JKSH
                                    Moderators
                                    wrote on 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
                                    0
                                    • JKSHJ JKSH

                                      @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 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.

                                      JKSHJ 1 Reply Last reply
                                      0
                                      • L Lord Bytor

                                        @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.

                                        JKSHJ Offline
                                        JKSHJ Offline
                                        JKSH
                                        Moderators
                                        wrote on 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
                                        1
                                        • JKSHJ JKSH

                                          @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

                                          L Offline
                                          L Offline
                                          Lord Bytor
                                          wrote on last edited by Lord Bytor
                                          #21

                                          @JKSH Well, progress in that I'm getting a new error "Cannot load library D:\Dev\UnityProjects\QT experiment\Assets\Plugins\QtQuick.2\qtquick2plugin.dll: The specified module could not be found" that dll is present at that exact location though

                                          Edit: Dependency walker shows it needs QT5Quick.dll, QT5Core etc... but those are all in its parent folder as produced by windeployqt

                                          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