![]() |
Qt: Accessing a child property from the qml file of another child
Hi everyone, I don't know if this is the right place, but I'll try it anyway.
I was wondering if this method I implemented it's allowed or not. By allowed I mean if it is a terrible coding practise and it should be avoided, or if it is fair enough and I can freely use it. I have to say in advance that I'm not a "featured" programmer, so I might not respect some good/common coding practise, and I'm sorry for that (and that's probably the reason why I'm writing here). Basically I have an Item inside the file ParentQml.qml, in which I have two children: Code:
// ParentQml.qml As a user, I cannot modify neither ParentQml.qml or DefautChild.qml files, but only MyLovelyQml.qml. My problem is that, in general, from inside the file MyLovelyQml.qml I cannot access to any of the properties of any of its parents' children. But I am an hubristic user and I want to disable DefaultChild! (because it is in conflict with something I do inside MyLovelyQml.qml) In order to accomplish this, here comes the hack. I know that DefautChild{} has a (more or less) unique set of properties. Represented previously as "prop1", "prop2", "prop3" and "prop4". The method I used to disable (on will) DefaultChild is the following. Code:
// MyLovelyQml.qml Ok, to be more specific I did this because I'm interested in special keyboard layouts in SailfishOS, such as ease, 8pen or flick. In order to work properly, these keyboards need to modify KeyboardBase.qml, in particular to disable the children MultiPointTouchArea{} and substitute it with something made ad hoc. I didn't want to patch the non-user-accessible files, that is the reason I spent my time trying do cheat default files. As far as I understood the method works properly and I would like to share the so created layouts with the community, but if this is a practise that really shouldn't be done, I'll stick with the patching. Please let me know what you think and share your coding experience with me. :) |
All times are GMT. The time now is 00:13. |
vBulletin® Version 3.8.8