Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. slot is called increasingly in a local function
Forum Updated to NodeBB v4.3 + New Features

slot is called increasingly in a local function

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 309 Views
  • 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.
  • Q Offline
    Q Offline
    QtTester
    wrote on last edited by
    #1

    hi,guys:
    here is my code,why the lambda will be called increasingly for a local variable qeventloop? even i use UniqueConnection or not:
    微信截图_20230728172200.png

    J.HilkJ 1 Reply Last reply
    0
    • Q QtTester

      hi,guys:
      here is my code,why the lambda will be called increasingly for a local variable qeventloop? even i use UniqueConnection or not:
      微信截图_20230728172200.png

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @QtTester

      Unique connections do not work for lambdas because we can't compare them for equality.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      Q 1 Reply Last reply
      1
      • J.HilkJ J.Hilk

        @QtTester

        Unique connections do not work for lambdas because we can't compare them for equality.

        Q Offline
        Q Offline
        QtTester
        wrote on last edited by
        #3

        @J-Hilk
        thanks for reply.
        but local variable will be destructed, and last lambda will disconnect automatically. right?

        J.HilkJ 1 Reply Last reply
        0
        • Q QtTester

          @J-Hilk
          thanks for reply.
          but local variable will be destructed, and last lambda will disconnect automatically. right?

          J.HilkJ Online
          J.HilkJ Online
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @QtTester what local variable ?

          connect(this, &QLibUsb::sigEpxDone, this, &)

          both reference objects are the same this instance of your class, It's going to exist forever, or at least as long as your class is instantiated


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          Q 1 Reply Last reply
          2
          • J.HilkJ J.Hilk

            @QtTester what local variable ?

            connect(this, &QLibUsb::sigEpxDone, this, &)

            both reference objects are the same this instance of your class, It's going to exist forever, or at least as long as your class is instantiated

            Q Offline
            Q Offline
            QtTester
            wrote on last edited by
            #5

            @J-Hilk thank you

            1 Reply Last reply
            0

            • Login

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