Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Am3359 QT5.1 Signal slot and timer problem in gui
QtWS25 Last Chance

Am3359 QT5.1 Signal slot and timer problem in gui

Scheduled Pinned Locked Moved Mobile and Embedded
1 Posts 1 Posters 838 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.
  • S Offline
    S Offline
    shriramrs31
    wrote on last edited by
    #1

    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
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved