2018-04-23 18:29:20 +08:00
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MainWindow::MainWindow ( QWidget* parent ) :
|
|
|
|
|
QMainWindow ( parent ),
|
|
|
|
|
ui ( new Ui::MainWindow )
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi ( this );
|
|
|
|
|
|
|
|
|
|
// serialport example
|
|
|
|
|
// tcpsocket example
|
|
|
|
|
// websocket?
|
|
|
|
|
//
|
2018-04-29 23:14:13 +08:00
|
|
|
|
//Tcp OK
|
2018-04-29 23:43:19 +08:00
|
|
|
|
p = QQtClientConnectionInstance ( this );
|
|
|
|
|
//p = QQtClientUdpConnectionInstance ( this );
|
2018-04-23 18:29:20 +08:00
|
|
|
|
connect ( p, SIGNAL ( signalServerSay ( QString ) ),
|
2018-04-29 14:44:39 +08:00
|
|
|
|
this, SLOT ( on_recv_say_hello ( QString ) ),
|
|
|
|
|
Qt::QueuedConnection );
|
2018-04-23 20:25:18 +08:00
|
|
|
|
|
2018-04-29 12:35:53 +08:00
|
|
|
|
//QQtClient2Protocol* p0 = QQtClient2ConnectionInstance ( this );
|
|
|
|
|
//p0->sendCommand1();
|
2018-04-23 18:29:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
|
{
|
|
|
|
|
delete ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_pushButton_clicked()
|
|
|
|
|
{
|
|
|
|
|
p->sendA1Command ( ui->lineEdit->text() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_recv_say_hello ( QString a )
|
|
|
|
|
{
|
|
|
|
|
pline() << a;
|
2018-04-29 15:27:47 +08:00
|
|
|
|
//这个地方不要加/r/n 程序会死。
|
2018-04-29 14:59:42 +08:00
|
|
|
|
ui->textBrowser->append ( a );
|
2018-04-23 18:29:20 +08:00
|
|
|
|
}
|