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. Connect: unresolved overloaded function type
QtWS25 Last Chance

Connect: unresolved overloaded function type

Scheduled Pinned Locked Moved General and Desktop
qt5qabstractsocketqnetworksignal & slotcompile-errorsqtcpsocket
2 Posts 1 Posters 3.5k 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.
  • UndeadBlowU Offline
    UndeadBlowU Offline
    UndeadBlow
    wrote on last edited by UndeadBlow
    #1

    Hello.
    I'm trying to connect QTcpSocket signal error to my slot in Qt5 style, but it doesn't compile, because QAbstractSocket, from which QTcpSocket inherits, also have error function (returns last error type), and seems that compile can't determinate which one to connect.
    My compiler is gcc 4.7.2 (can't use newer versions cause of rules).

    socket = new QTcpSocket(this);
    connect(socket, &QTcpSocket::error, this, &Network::socketErrorSlot);
    1 Reply Last reply
    0
    • UndeadBlowU Offline
      UndeadBlowU Offline
      UndeadBlow
      wrote on last edited by UndeadBlow
      #2

      Ok, i got it:

      // Disambiguate overloaded member function below with static cast
      connect(socket, static_cast<void (QTcpSocket::*) (QAbstractSocket::SocketError)>(&QTcpSocket::error), this, &Network::socketErrorSlot);
      

      I think that deserves to be in bugtracker, isn't it? Not good idea to implement new notation and use the same names for method and signal.

      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