[Solved] QObject::connect: Incompatible sender/receiver arguments



  • Hello i have write this:
    @void Widget::leggo_output(QProcess &p){
    QApplication::processEvents();
    QString mess = p.readAllStandardOutput();
    ui->plainTextEdit->setPlainText(mess);
    QApplication::processEvents();

    }

    void Widget::leggo_errore(QProcess &p){
    QApplication::processEvents();
    QString mess_err = p.readAllStandardError();
    ui->plainTextEdit->setPlainText(mess_err);
    QApplication::processEvents();
    }

    void Widget::masterizzo(){
    QProcess *p = new QProcess;
    connect(p,SIGNAL(readyReadStandardOutput()),this,SLOT(leggo_output(QProcess&)));
    connect(p,SIGNAL(readyReadStandardError()),this,SLOT(leggo_errore(QProcess&)));
    p->start("xbox");
    }@

    I get this error:
    QObject::connect: Incompatible sender/receiver arguments
    QProcess::readyReadStandardOutput() --> Widget::leggo_output(QProcess&)
    QObject::connect: Incompatible sender/receiver arguments
    QProcess::readyReadStandardError() --> Widget::leggo_errore(QProcess&)
    what is wrong?

    Thanks

    Luca



  • Hello again i have soved
    h file
    @#ifndef WIDGET_H
    #define WIDGET_H

    #include <QWidget>
    #include <QProcess>

    namespace Ui {
    class Widget;
    }

    class Widget : public QWidget
    {
    Q_OBJECT

    public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();
    QProcess *p ;

    private:
    Ui::Widget *ui;

    public slots:
    void masterizzo();
    void leggo_output();
    void leggo_errore();

    };

    #endif // WIDGET_H@

    cpp file

    @#include "widget.h"
    #include "ui_widget.h"
    #include <QProcess>

    Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
    {
    ui->setupUi(this);
    p = new QProcess;
    connect(p,SIGNAL(readyReadStandardOutput()),this,SLOT(leggo_output()));
    connect(p,SIGNAL(readyReadStandardError()),this,SLOT(leggo_errore()));
    connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(masterizzo()));
    }

    Widget::~Widget()
    {
    delete ui;
    }

    void Widget::leggo_output(){
    QApplication::processEvents();
    QByteArray mess = p->readAllStandardOutput();
    ui->plainTextEdit->setPlainText(mess);
    QApplication::processEvents();

    }

    void Widget::leggo_errore(){
    QApplication::processEvents();
    QByteArray mess_err = p->readAllStandardError();
    ui->plainTextEdit->setPlainText(mess_err);
    QApplication::processEvents();
    }

    void Widget::masterizzo(){
    p->start("xbox");

    }@

    Luca


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.