Bad practice with connections?
-
Would anyone here say that having lot's of connections is bad practice? For instance:
Connections { target: back-end connection 1 } Connections { target: back-end connection 2 } Connections { target: back-end connection 3 } Connections { target: back-end connection 4 }
all in the same QML file or does this just depend on if it's needed or not? Should I put all of these connections under and item and separate them into their own QML file? I am just looking for advice on "best practices" when creating connections to the back-end in the UI.
-
Would anyone here say that having lot's of connections is bad practice? For instance:
Connections { target: back-end connection 1 } Connections { target: back-end connection 2 } Connections { target: back-end connection 3 } Connections { target: back-end connection 4 }
all in the same QML file or does this just depend on if it's needed or not? Should I put all of these connections under and item and separate them into their own QML file? I am just looking for advice on "best practices" when creating connections to the back-end in the UI.
@Circuits said in Bad practice with connections?:
Would anyone here say that having lot's of connections is bad practice?
Connections are not bad in themselves. However, the "on<Signal>" signal handler is preferred. See the description at https://doc.qt.io/qt-5/qml-qtqml-connections.html on when you should use Connections.
If you truly need many Connections, then feel free to use them.
Should I put all of these connections under and item and separate them into their own QML file?
My first inclination is to put the Connections in the same file as the target.