Results 1 to 11 of 11

Thread: system() function and QProgressBar

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: system() function and QProgressBar

    I have gone through Qt Docs.

    there its mentioned waitForFinished() should used for NON GUI. How to achieve the same in GUI
    Apps.
    Thanks,
    Rajesh.S

  2. #2
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: system() function and QProgressBar

    Make a QEventLoop, connect the finished() signal of the QProcess to the quit() slot of the QEventloop, execute the QProcess, and immediately the QEventLoop. This technique will block until your process is really finished.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: system() function and QProgressBar

    As far as I know when you run an application as detatched, you won't receive a finished signal.

  4. #4
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: system() function and QProgressBar

    I tried mapping finished() signal with qeventquit() slot, its stopping the execution but again its not starting even if the process finished.
    Thanks,
    Rajesh.S

  5. #5
    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: system() function and QProgressBar

    Notice that QProcess::startDetached() is a static method. Calling non-static methods have no effect on a detached process.
    Last edited by wysota; 2nd June 2008 at 15:22. Reason: spelling error
    J-P Nurmi

  6. #6
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: system() function and QProgressBar

    how to achieve my requirement any suggestion Please ?
    Thanks,
    Rajesh.S

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: system() function and QProgressBar

    Don't start the process as detached. If it doesn't work, it's because you made some mistake.

  8. #8
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: system() function and QProgressBar

    Sorry , I made mistake in start,

    Previously I used

    Wrong Code:

    Qt Code:
    1. QProcess process = new QProcess(this)
    2. process->start("cmd.exe /C ant -buildfile fileName");
    To copy to clipboard, switch view to plain text mode 

    to start the cmd process.

    This is wrong,


    Now i am using

    Correct Code:


    Qt Code:
    1. QProcess process = new QProcess(this)
    2. process->start("cmd /C ant -buildfile fileName") ;
    To copy to clipboard, switch view to plain text mode 

    Now this is working.


    Thank u for ur continuous help.
    Thanks,
    Rajesh.S

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.