Results 1 to 5 of 5

Thread: Mainwindow qprocesss

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Posts
    95
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Mainwindow qprocesss

    I have to run an external aplication (in windows an exe file) from a qt aplication. With this code works correctly, but when i change to other aplication and the external app is running, qt app is all white(no controls, no boxes....) and when the external app finished, qt show all widget correctly.

    Qt Code:
    1. QString fullinputName=TXTDatosArchivo->text();
    2.  
    3. QStringList Parameters;
    4. Parameters<<fullinputName;
    5. QString strprocess="GDAM.exe";
    6. QProcess *myProcess=new QProcess(this);
    7. myProcess->waitForFinished();
    8. QApplication::setOverrideCursor(Qt::WaitCursor);
    9.  
    10. int salida = myProcess->execute(strprocess,Parameters);
    11. if (salida!=0){
    12. QMessageBox::critical(this,"Error",lang->leer_idioma("148").arg(strprocess));
    13. QApplication::restoreOverrideCursor();
    14. ........
    15. }else{
    16. ..........}
    To copy to clipboard, switch view to plain text mode 

    Some help please!!!!!!!

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Mainwindow qprocesss

    First of all, QProcess::execute() is a static method. Secondly, as it says in the docs, QProcess::execute() "waits for the process to finish". Thirdly, do not use QProcess::waitFor*() methods in GUI applications because they block the event loop meanwhile the process is running. This is why the application has no chance to repaint itself. Use QProcess::start() and connect to appropriate signals to get notified when something interesting happens.
    J-P Nurmi

  3. #3
    Join Date
    Jan 2007
    Posts
    95
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Mainwindow qprocesss

    Do you know an example on how to use signals in qprocess (finished(), exitCode, exitStatus, error,...)?

    Thanks for quick reply

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Mainwindow qprocesss

    Quote Originally Posted by zorro68 View Post
    Do you know an example on how to use signals in qprocess (finished(), exitCode, exitStatus, error,...)?
    Use the powerful search facilities of the forum! Here's one: http://www.qtcentre.org/forum/p-i-st...ostcount2.html
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    drake1983 (10th December 2007)

  6. #5
    Join Date
    Jan 2007
    Posts
    95
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Mainwindow qprocesss

    I'm trying and reading and the information have been too usefull for me.

    Thanks

Similar Threads

  1. Notifying Mainwindow of an event..
    By MrGarbage in forum Qt Programming
    Replies: 1
    Last Post: 9th November 2007, 21:29
  2. Replies: 1
    Last Post: 11th September 2007, 13:34
  3. Communication between MainWindow and a dialog
    By Backslash in forum Newbie
    Replies: 9
    Last Post: 3rd August 2007, 04:27
  4. Replies: 3
    Last Post: 23rd July 2006, 18:02
  5. mainwindow does not refresh
    By edb in forum Qt Programming
    Replies: 22
    Last Post: 25th January 2006, 16:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.