Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Running in parallel process qt?



  • I created one gui with all the things i needed. So Each Button has its own functionality but lineEdit and PushButton are main in my scenario.

    When I write some information in LineEdit i will receive that text and try to the following mentioned in below snipper. But while doing like this the gui hangs until it is done with process.

    But I dont want to happen like this and instead it should be smooth!. Can someone suggest some solution for this?

    For PushButton it looks similar to code mentioned here (https://forum.qt.io/topic/123510/how-to-run-external-executable-in-qt-project)

    int Widget::on_lineEdit_returnPressed()
    {
    
    
        QString value = "it is :";
        QString value1 = ui->lineEdit->text();
        QString value2 = value + value1;
        ui->plainTextEdit->appendPlainText(value2);
    
        std::string it = ui->lineEdit->text().toStdString();
        dt = new someSDK(it1,port);
    
        if (!dt->isValid()) {
           
            ui->plainTextEdit->appendPlainText("some  error");
            return -3;
        }
        std::cout << "connected to  " << it1 << " with port " << dt->getsomePort() << std::endl;
    }
    

  • Lifetime Qt Champion

    @sm2770s said in Running in parallel process qt?:

    done with process

    Which process? I do not see you starting any processes in the code you posted, so please explain better and provide relevant code!



  • @jsulm Sorry for causing some problem in understanding question. What I mean here is if i enter some informaion in LineEdit and press Enter. It hangs up until it does what is expected to do (this is kept in code block in question). So i want to make this smooth that means basically,
    the code works in background and i can some information on linedit2 and so on..

    Did you get my question now?


  • Lifetime Qt Champion

    @sm2770s said in Running in parallel process qt?:

    Did you get my question now?

    Did you get my question?
    How is anybody supposed to help you if you don't provide enough information?
    What is someSDK doing? Where does your app hang?



  • @sm2770s use a thread to do the job and your widgets are still free for use.


Log in to reply