Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Bad practice with connections?
Forum Updated to NodeBB v4.3 + New Features

Bad practice with connections?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 254 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Circuits
    wrote on last edited by
    #1

    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.

    JKSHJ 1 Reply Last reply
    0
    • C Circuits

      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.

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      @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.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved