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. static assertion failed: Signal and slot arguments are not compatible
Forum Updated to NodeBB v4.3 + New Features

static assertion failed: Signal and slot arguments are not compatible

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 386 Views 1 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.
  • G Offline
    G Offline
    GGG03
    wrote on last edited by
    #1

    I dont know why I am getting this error:```
    test.cpp

    Serial Ensayo;
    
    test::test(QWidget *parent): QWidget(parent), ui(new Ui::test)
    {
        ui->setupUi(this);
        qDebug() << Ensayo.connectArduino();
        connect(&Ensayo, &Serial::dataReady, this, SLOT(dataArrived()));
    }
    
    void test::dataArrived()
    {
        newData = Ensayo.getData();
    }
    

    serial.cpp

    void Serial::readSerial()
    {
        QByteArray serialData = arduino->readAll();
        serialBuffer += QString::fromStdString(serialData.toStdString());
        if (serialBuffer.contains("inicio") && serialBuffer.contains(",final"))
        {
            int startPos = serialBuffer.indexOf("inicio") + 6;
            int lengthData = serialBuffer.indexOf(",final", startPos) - startPos;
            QString prioData = serialBuffer.mid(startPos, lengthData);
            justData = prioData.split(",");
            serialBuffer.remove(0, startPos+lengthData + 6);
            if (dataPrint) qDebug() << justData;
            if (ensayo) emit dataReady();
        }
    }
    sierdzioS 1 Reply Last reply
    0
    • G GGG03

      I dont know why I am getting this error:```
      test.cpp

      Serial Ensayo;
      
      test::test(QWidget *parent): QWidget(parent), ui(new Ui::test)
      {
          ui->setupUi(this);
          qDebug() << Ensayo.connectArduino();
          connect(&Ensayo, &Serial::dataReady, this, SLOT(dataArrived()));
      }
      
      void test::dataArrived()
      {
          newData = Ensayo.getData();
      }
      

      serial.cpp

      void Serial::readSerial()
      {
          QByteArray serialData = arduino->readAll();
          serialBuffer += QString::fromStdString(serialData.toStdString());
          if (serialBuffer.contains("inicio") && serialBuffer.contains(",final"))
          {
              int startPos = serialBuffer.indexOf("inicio") + 6;
              int lengthData = serialBuffer.indexOf(",final", startPos) - startPos;
              QString prioData = serialBuffer.mid(startPos, lengthData);
              justData = prioData.split(",");
              serialBuffer.remove(0, startPos+lengthData + 6);
              if (dataPrint) qDebug() << justData;
              if (ensayo) emit dataReady();
          }
      }
      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @GGG03 said in static assertion failed: Signal and slot arguments are not compatible:

      connect(&Ensayo, &Serial::dataReady, this, SLOT(dataArrived()));

      You are mixing old and new connect syntax in a single line, that's not supported.

      Either use functor style &Serial::dataReady OR macro style SLOT().

      (Z(:^

      G 1 Reply Last reply
      4
      • sierdzioS sierdzio

        @GGG03 said in static assertion failed: Signal and slot arguments are not compatible:

        connect(&Ensayo, &Serial::dataReady, this, SLOT(dataArrived()));

        You are mixing old and new connect syntax in a single line, that's not supported.

        Either use functor style &Serial::dataReady OR macro style SLOT().

        G Offline
        G Offline
        GGG03
        wrote on last edited by
        #3

        @sierdzio Thank you very much!

        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