Closed omnbmhong closed 1 year ago
Hello,
QML is tricky to debug, because it always compiles, it is evaluated at runtime, so any issue QML related will only be known when running.
Having said the above, the QML engine is complaining about the map object. You used the map object, which probably was called map on your SimpleItemMapVisual.qml, but most likely on PlanView.qml the reference to map is loaded in a different property. Check how the map object is called in PlanView.qml and use it instead of "map".
If you can not make it work, a link to your branch or something to see more of it could help.
Cheers!
Dear David, Halo Would you kindly specify a little bit more about , how to or any good way, to check the loaded Name of "map object" in PlanView.qml. Many thanks again.
Sent with Proton Mail secure email.
------- Original Message ------- On Monday, December 12th, 2022 at PM 7:01, David Sastre @.***> wrote:
Hello,
QML is tricky to debug, because it always compiles, it is evaluated at runtime, so any issue QML related will only be known when running.
Having said the above, the QML engine is complaining about the map object. You used the map object, which probably was called map on your SimpleItemMapVisual.qml, but most likely on PlanView.qml the reference to map is loaded in a different property. Check how the map object is called in PlanView.qml and use it instead of "map".
If you can not make it work, a link to your branch or something to see more of it could help.
Cheers!
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Do you have a branch I can take a look at? I would be easier to point you better in the right direction if I knew more about how and where exactly you placed the code above.
sorry,i dont have a remote brach, i copy the code window, as pictures as above, my own code only lie between line73--108. all the rest code remains as original unchanged. please kindly advise , Many thanks.
your judgement is right, I guess. I try to console.log the value of "map" , it is undefined. I just don't know how to fix it. meanwhile , i also console log the value of "map" in the file "simpleitemmapvisual.qml" , it shows a value of "FlightMap_QMLType_147......" , i dont know how this is imexplicitly assigned this type. I also attached a pic for your reference thanks a lot.,
Dear David, I try to upload it to my branch this morning ,foryour convinicence. link as: https://github.com/omnbmhong/qgc2022bimcar pls check, PlanView.qml , SimpleItemMapVisual.qml these 2 files. Thanks. Looking forward to your advice.
I checked it real quick, so I am not really sure if I will be right. You are working over a old version of QGC so I am not really familiarized with how the codebase of your version is.
I do see in planview.qml the map id is editorMap. Try with editorMap.addMapItem, or _root.editorMap.addMapItem.
It Works! Many thanks David. All problem solved. Great advice!
Great to hear it works, thanks for confirming! I will close the issue now as it is completed. In any case, for the next time, it is better if you post these kind of issues related to custom developments in discord development chat, I think it is more appropriate than github issues for this matter. Best regards!
I think it is more appropriate than github issues for this matter.
Yes. Unless there is something that should be added to the docs coming out of this discussion :-). Thanks for sorting this out @Davidsastresas
this code (code details as below) can serve as draw a circle on map, when we planning the path. I use it in “SimpleItemMapVisual.qml”. it works perfectly. But when I copy and use it in the file “PlanView.qml” , Compiling is OK. But when run this function, it fail and report error: “ TypeError: Cannot call method 'addMapItem' of undefined,"
My Code details: property var map ///< Map control to place item in property var _circle property bool _circleShowing: false
Component { id: circleComponent
Component.onCompleted: { showCircle() }