Unsolved Invalid property assignment error in DLL but not QT creator
-
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?
-
hi @Lord-Bytor
you could try color : Qt.rgba() or Qt.hsla() -
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.
-
@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?
-
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 -
@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
-
@JKSH I'll try that
-
@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. -
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:
What I actually see:
-
@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:
- Launch your app from the Command Line. Do you see any error messages?
- 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)?
-
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
-
@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?
-
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.
-
@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)
-
@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
-
@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?
-
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 getqrc:/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
-
@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.
-
@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.
-
@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