Skip to content
  • share declared variables QML

    Unsolved QML and Qt Quick
    0 Votes
    2 Posts

    I think just take a step back and redesign that.
    Because as is it'd be a bad idea. It's a bad idea because you will have a self contained component but then somethine totally unrelated apart from the fact that you've now (if even possible) got references to an object that has no concept of it being relying on.

    That would be a maintenance nightmare should it all look like that. Being a javascript engine currently though - I probably don't even want to know if it might be made to work. I curse javascript, it's origins, everything. It's just so... yuck.

    Either way, I think the spirit of this post is: how you will essentially - abuse yourself.
    If you want:

    a single instance - just do that. to declare so when QML loads it it instantiates (it looks like you are) - just do that too.

    But what I think you want/ask now is:

    declare once, in another, completely unrelated component use the instance. It feels really dangerous.
    What happens when a.qml drops dbus or even changes the reference to suit itself, or the project drops a altogether? Now shit's really broke, now you've got strange shit happening in a as b fiddles with it's instance internals!

    At least, if I understand what you ask...

  • 0 Votes
    9 Posts

    @Diracsbracket I think it should, let me try it, thanks you so much for your time!

  • 0 Votes
    11 Posts

    But why use QLineEdit if you are only manipulating numbers ? That makes the code uselessly complicated.