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. I get an error when refactoring connect.

I get an error when refactoring connect.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 194 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.
  • W Offline
    W Offline
    w.tkm
    wrote on last edited by
    #1

    Hi.
    I refactoring [connect]. Then, I get an error.

    brefor:

    connect(m_pUdpSockRecv, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(fnSocketError()));
    

    after:

    connect(m_pUdpSockRecv, &QAbstractSocket::error, this, &Udp::fnSocketError);
    

    get error:
    error: no matching member function for call to 'connect'

    Do I need to add anything?

    J.HilkJ 1 Reply Last reply
    0
    • W w.tkm

      Hi.
      I refactoring [connect]. Then, I get an error.

      brefor:

      connect(m_pUdpSockRecv, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(fnSocketError()));
      

      after:

      connect(m_pUdpSockRecv, &QAbstractSocket::error, this, &Udp::fnSocketError);
      

      get error:
      error: no matching member function for call to 'connect'

      Do I need to add anything?

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

      @w-tkm what version of Qt do you use ?

      the error signal was deprecated and errorOccured was introduced.
      This was made due to the fact that error is not only a signal but also a regular function of QAbstractSocket.

      to use an overload in the new connect syntax requires the use of complicated casting, or the use of the qOverload macro
      https://doc.qt.io/qt-5/qtglobal.html#qOverload


      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.

      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