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. QMap Signal/Slot issue
Forum Updated to NodeBB v4.3 + New Features

QMap Signal/Slot issue

Scheduled Pinned Locked Moved General and Desktop
signal&slot
5 Posts 3 Posters 3.3k Views 3 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.
  • gian71G Offline
    gian71G Offline
    gian71
    wrote on last edited by
    #1

    Hi, I have a problem with Signal and Slot.
    I have an object that contains a QMap<quint64,QString> and other variable members. I emit the object as signal and receive it as slot. The object that I receive has all the members of the object emitted except the QMap which is empty.

    I tried to qDebug() the map just before emit and in the slot and it looks like the map existed before and was empty after...

    Can anybody help?

    Thanks

    G.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      Have you tested that Your class is copyable ?
      I assume when the class is emitted its a copy and not the actual class, as in a pointer?

      void TestFunc( YourClass A) { // no * or & here
      is lists still filled here for A
      }

      --main--
      YourClass mine;
      // fill the qmap
      TestFunc(mine);

      1 Reply Last reply
      0
      • gian71G Offline
        gian71G Offline
        gian71
        wrote on last edited by
        #3

        Thanks for the answer.
        Yes my object is copyable. I made a copy just before to emit the object and printed it out , the QMap...QMap is present in the copy, then I emit the object and I get it in the slot..the copy in the slot has QMap empty.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Can you share the code where you emit the signal ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • gian71G Offline
            gian71G Offline
            gian71
            wrote on last edited by
            #5

            Hi, it is my bad...mrjj was right, I did an incorrect test. The object is not copyable...I have to make it copyable first..that is the reason why I see the issue probably. Thanks

            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