Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Am3359 QT5.1 Signal slot and timer problem in gui

    Mobile and Embedded
    1
    1
    748
    Loading More Posts
    • 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.
    • S
      shriramrs31 last edited by

      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

      1 Reply Last reply Reply Quote 0
      • First post
        Last post