Am3359 QT5.1 Signal slot and timer problem in gui



  • Hello Everyone,

    I have compiled qt 5.1.0 for AM3359 . I have a tcpserver qt console application and a gui based client application runing in the same board.

    In the server application signals and slots are working properly.

    In the client application (GUI based), any slot connected to a signal other than the gui controls are not getting called.

    For example I have this application :

    @#include "widget.h"
    #include <QApplication>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    Widget w;
    w.show();

    return a.exec&#40;&#41;;
    

    }
    @

    @#ifndef WIDGET_H
    #define WIDGET_H

    #include <QWidget>
    #include <QTcpSocket>

    namespace Ui {
    class Widget;
    }

    class Widget : public QWidget
    {
    Q_OBJECT

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

    private slots:
    void server_data_received();

    private:
    Ui::Widget ui;
    QTcpSocket
    Server;
    };

    #endif // WIDGET_H
    @

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

    Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
    {
    ui->setupUi(this);
    Server = new QTcpSocket(this);

    Server->connectToHost("127.0.0.1",3182);
    if(Server->waitForConnected(10000))
    {
    qDebug()<<"Connected. now connecting slot";
    connect(Server, SIGNAL(readyRead()),this,SLOT(server_data_received()));
    }
    else
    {
    qDebug()<<"Unable to connect";
    }

    QByteArray stest;stest.append((char)0xA0);
    qDebug()<<"Starting : "<< Server->write(stest);
    if(! Server->waitForBytesWritten(3000) )
    qDebug()<<"start not written - false";

    }

    void Widget::server_data_received()
    {
    qDebug()<<"server data received";
    }

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

    When the application starts, it send a message to server and the server sends the client some data back.

    But the slot server_data_received() is never being called. If insert a button and waitforreadyread in the clicked slot for the button, then i am able to read the data.

    This same program works with qt 4.8.3 in the same board.

    Also QTimer timeout events or singleshot are not getting triggered.

    Can anyone help me troubleshoot this problem ?

    Thanks a lot in advance.

    Shriram


Log in to reply
 

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