//---------------------------------------------------- void MainWindow::onClickConnect() { ScreenForm* screen = new ScreenForm(this); screen->setQuality(ui->cbHighQuality->isChecked()); screen->setShowFps(ui->cbShowFps->isChecked()); screen->show(); screen->connectTo(ui->ebIP->text()); hide(); }
//---------------------------------------------------- void MainWindow::onClickConnect() { // Check that the IP entered is valid QString ip = ui->ebIP->text(); QHostAddress address(ip); if (QAbstractSocket::IPv4Protocol != address.protocol()) { QMessageBox::critical(this, "Invalid IP", "The IP address you entered is invalid"); return; } // The IP is valid, connect to there ScreenForm* screen = new ScreenForm(this); screen->setAttribute(Qt::WA_DeleteOnClose); screen->setQuality(ui->cbHighQuality->isChecked()); screen->setShowFps(ui->cbShowFps->isChecked()); screen->show(); screen->connectTo(ui->ebIP->text()); // Hide this dialog hide(); }