void MainWindow::on_pushButton_clicked(){ Translator t; t.translate("Hello, world!","En","Ru"); connect(&t,SIGNAL(dataReceived(QVariant)),this,SLOT(getTranslated(QVariant))); connect(&t,SIGNAL(error(QVariant)),this,SLOT(getTranslated(QVariant)));}void MainWindow::getTranslated(const QVariant &text){ QString translated = text.toString(); ui->lineEdit_2->setText(translated); }
Translator *m_translator;
m_translator = new Translator(this);
QString translated = text.toString(); QString s = QString::fromLocal8Bit(translated);