Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Signals and Slot Problem

Signals and Slot Problem

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 2 Posters 867 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.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #1

    in socketudp.cpp
    ipDataReceived(datagram) is emitted

    In main.cpp
    socketudp UnderUDP;
    UnderUDP object created.
    If i create object in mainwindow.cpp, UDP data cannot received (TCP no problem)
    (strange problem, i tried debugging many times and this is the symptom.

    in mainwindow.cpp
    connect(&UnderUDP,SIGNAL(ipDataReceived(QByteArray)),this,SLOT(onPortDataReceived(QByteArray)));

    doing debug, i found my SLOT is never call. Why is this so?
    I did experiment 2.
    I move slot and QObject::connect to main.cpp but can't declare slot in main.cpp. Pls Help ..
    I am out of idea.

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

      Hi,

      Without any code it's pretty much Crystal Ball (™).

      IRCC, debugging, so can you share it ?

      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
      • H Offline
        H Offline
        houmingc
        wrote on last edited by
        #3

        I found that i can make connection for UDP to my system not in Mainwindow but in main (before mainwindow object is created), but my problem is main do not have header file ( there is no main.h only main.cpp).

        Thus i can't add a SLOT in main.h.

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

          Depends, you can use C++11 lambda as slots

          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

          • Login

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