Здравствуйте! Работаю над проектом передачи данных между устройством и Qt интерфейсом.
Возникла запарка. В диалоговом окне я получаю некое значение, которое должен отослать на устройство.
В классе mainwindow есть слот writeData(QByteArray &data) который получает значение из диалогового окна и пишет его в порт. Однако проблемка. Не могу разобраться как организовать соединение сигнал-слот. Допустим в главном окне я сделаю кнопку отправить. И по сигналу должен буду выполнять слот writeData(QByteArray &data). Но ведь и сигнал и слот должны иметь одинаковые аргументы. Строку из диалогового окна я получаю так: 
QString str;
QByteArray dat;
str = delay->getDelay();
dat = str.toLatin1(); 
dat мне нужно по идее передать. Но как. Подскажите пожалуйста.
mainwindow.h#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QtSerialPort/QSerialPort>
namespace Ui {
class MainWindow;
}
class Console;
class SetDelay;
class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
private slots:
    void openSerialPort();
    void closeSerialPort();
    void readData();
    void writeData(const QByteArray &data);
    void handleError(QSerialPort::SerialPortError error);
private:
    void initAC();
    bool portSettings();
    
private:
    Ui::MainWindow *ui;
    QSerialPort *serial;
    Console *console;
    SetDelay *delay;
};
#endif // MAINWINDOW_H
  mainwindow.cpp#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "console.h"
#include "setdelay.h"
#include <QMessageBox>
#include <QtSerialPort/QSerialPort>
#include <QByteArray>
#include <QString>
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    console = new Console;
    console->setEnabled(false);
    setCentralWidget(console);
    serial = new QSerialPort(this);
    ui->actionConnect->setEnabled(true);
    ui->actionDisconnect->setEnabled(false);
    delay = new SetDelay;
    initAC();
    connect(serial, SIGNAL(error(QSerialPort::SerialPortError)), this,
            SLOT(handleError(QSerialPort::SerialPortError)));
    connect(serial, SIGNAL(readyRead()), this, SLOT(readData()));
    connect(console, SIGNAL(getData(QByteArray)), this, SLOT(writeData(QByteArray)));
    QString str;
    str = delay->getDelay();
    QByteArray dat;
    dat = str.toLatin1();
    writeData(dat);
}
MainWindow::~MainWindow()
{
    delete delay;
    delete ui;
}
void MainWindow::openSerialPort()
{
    serial->setPortName("COM3");
    if (serial->open(QIODevice::ReadWrite))
    {
    /*    QString str;
        str = delay->getDelay();*/
        if(portSettings())
        {
            ui->actionConnect->setEnabled(false);//Некликабельна
            ui->actionDisconnect->setEnabled(true);//Кликабельна
            //console->setEnabled(true);
            console->setLocalEchoEnabled(true);
            ui->statusBar->showMessage(tr("Connected"));
        }
        else
        {
            serial->close();
            QMessageBox::critical(this,tr("Error"),serial->errorString());
            ui->statusBar->showMessage(tr("OpenError"));
        }
     }
    else
    {
            QMessageBox::critical(this, tr("Error"), serial->errorString());
        ui->statusBar->showMessage(tr("Configure error"));
    }
}
void MainWindow::closeSerialPort()
{
    serial->close();
    ui->actionConnect->setEnabled(true);
    ui->actionDisconnect->setEnabled(false);
    ui->statusBar->showMessage(tr("Disconnected"));
}
void MainWindow::writeData(const QByteArray &data)
{
    serial->write(data);
}
void MainWindow::readData()
{
    QByteArray data = serial->readAll();
    console->putData(data);
}
void MainWindow::initAC()
{
     connect(ui->actionConnect, SIGNAL(triggered()), this, SLOT(openSerialPort()));
     connect(ui->actionDisconnect, SIGNAL(triggered()), this, SLOT(closeSerialPort()));
     connect(ui->actionSet_delay, SIGNAL(triggered()), delay, SLOT(show()));
}
void MainWindow::handleError(QSerialPort::SerialPortError error)
{
    if (error == QSerialPort::ResourceError) {
        QMessageBox::critical(this, tr("Critical Error"), serial->errorString());
        closeSerialPort();
    }
}
bool MainWindow::portSettings()
{
    bool res = true;
    res &= serial->setBaudRate(QSerialPort::Baud9600);
    res &= serial->setDataBits(QSerialPort::Data8);
    res &= serial->setParity(QSerialPort::NoParity);
    res &= serial->setStopBits(QSerialPort::OneStop);
    res &= serial->setFlowControl(QSerialPort::NoFlowControl);
    return res;
}
 setdelay.cpp#include "setdelay.h"
#include "ui_setdelay.h"
SetDelay::SetDelay(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SetDelay)
{
    ui->setupUi(this);
    connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(apply()));
}
SetDelay::~SetDelay()
{
    delete ui;
}
void SetDelay::apply()
{
    QString str = getDelay();
    hide();
}
QString SetDelay::getDelay()
{
    return ui->lineEdit->text();
}
 setdelay.h#ifndef SETDELAY_H
#define SETDELAY_H
#include <QDialog>
namespace Ui {
class SetDelay;
}
class SetDelay : public QDialog
{
    Q_OBJECT
public:
    QString getDelay();
    explicit SetDelay(QWidget *parent = 0);
    ~SetDelay();
private slots:
    void apply();
private:
    Ui::SetDelay *ui;
};
#endif // SETDELAY_H
 
					если я правильно понял:
C++ (Qt)
connect(ui->sendButton, SIGNAL(clicked()), SLOT(send()));
...
void MainWindow::send()
{
    QString str = delay->getDelay();
    QByteArray dat = str.toLatin1();
    writeData(dat);
}