#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(&sender,SIGNAL(sendReceivedData(QVector<float>)),this,SLOT(dataReceivedSlot(QVector<float>)));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pBSend_clicked()
{
QVector <float> v1;
v1.append(ui->lE_Send->text().toFloat());
v1.append(ui->lE_Send_2->text().toFloat());
v1.append(ui->lE_Send_3->text().toFloat());
sender.broadcastDatagram(v1);
}
void MainWindow::dataReceivedSlot(QVector<float> v2)
{
int i;
float ftmp;
QString tmp="";
QString tmp2="";
int koko=v2.size();
for(i=0;i<koko;i++){
ftmp=v2.at(i);
tmp.setNum(ftmp);
tmp2+=tmp;
tmp2+=" ";
}
ui->lE_Receive->setText(tmp2);
}
|