Results 1 to 4 of 4

Thread: How to Port Q3Process::launch to Qt4 ?

  1. #1
    Join Date
    Oct 2007
    Posts
    39
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question How to Port Q3Process::launch to Qt4 ?

    While porting code from Qt3 to Qt4, I encounter the following problem.

    I create Process object
    Qt Code:
    1. QProcess m_Process = QProcess(this);
    To copy to clipboard, switch view to plain text mode 

    Now there is one statement which needs to be ported:

    Qt Code:
    1. m_Process->launch(some_Argument);
    To copy to clipboard, switch view to plain text mode 

    I have used :
    Qt Code:
    1. m_Process->execute(some_Argument);
    To copy to clipboard, switch view to plain text mode 

    I'm using this, but the process doesn't get launch.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to Port Q3Process::launch to Qt4 ?

    Look at the QProcess documentation. There is an example there.
    execute() is a static member so you don't need a QProcess instance.

  3. #3
    Join Date
    Oct 2007
    Posts
    1
    Qt products
    Qt4

    Default Re: How to Port Q3Process::launch to Qt4 ?

    Even I am searching an equivalent function to Q3Process::launch.
    But i didn't got.
    I am porting some code from Qt3 to Qt4.
    The Qt3 code is as follows:
    m_process = new QProcess(this);

    connect(m_process, SIGNAL(processExited()),
    this, SLOT(slotPsOutputCompleted()));

    m_process->launch(Arg);

    I have used finished(int, QProcess::ExitStatus) signal instead of processExited().
    But couldn't port launch in Qt4.
    Please guide me for the same.

  4. #4
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to Port Q3Process::launch to Qt4 ?

    Quote Originally Posted by radhika.khandway View Post
    Even I am searching an equivalent function to Q3Process::launch.
    But i didn't got.
    I am porting some code from Qt3 to Qt4.
    The Qt3 code is as follows:
    m_process = new QProcess(this);

    connect(m_process, SIGNAL(processExited()),
    this, SLOT(slotPsOutputCompleted()));
    m_process->launch(Arg);
    Have you found the porting solution without qt3to4?

    I found the same problem on convert postscript file to PNG image

    QT3 code send and take all data to stdin stdout and never save item to file....

    Qt Code:
    1. proc = new QProcess();
    2. #if defined(Q_OS_WIN32)
    3. proc->addArgument( "gswin32c" );
    4. #else
    5. proc->addArgument( "gs" );
    6. #endif
    7. proc->addArgument( "-q" );
    8. proc->addArgument( "-dBATCH" );
    9. proc->addArgument( "-dNOPAUSE" );
    10. proc->addArgument( "-sDEVICE=pnggray" );
    11. proc->addArgument( "-sOutputFile=-" );
    12. proc->addArgument( "-" );
    13.  
    14. writingStdout = true;
    15. /* send postscript code to console */
    16. if ( !proc->launch( psBarcode ) ) {
    17. /* error code */
    18. } else {
    19. readingStdout = true;
    20. while ( readingStdout ) {
    21. qApp->processEvents();
    22. if ( !proc->isRunning() )
    23. writingStdoutFinished(); /* read png data from console ... */
    24. }
    25. }
    To copy to clipboard, switch view to plain text mode 

    qt4 code ...

    Qt Code:
    1. cmd.append(ghosti); /* Ghostscript bin full path */
    2. cmd.append("-dBATCH");
    3. cmd.append("-dNOPAUSE");
    4. cmd.append("-sDEVICE=pnggray");
    5. cmd.append("-sOutputFile="+imageiosFileCache); /* define out file */
    6. cmd.append("-q");
    7. cmd.append(stimeFileCache); /* define in file postscript to transform */
    8. Barcode_Delete( bc ); /* remove barcode gnu */
    9. errprocess = false;
    10. procfinished=false;
    11. if (getGSVersion().size() < 4) {
    12. PaintError(tr("Install Ghostscript."));
    13. return;
    14. }
    15. const QString makepnggreycommand = cmd.join(" ");
    16. proc = new QProcess(this);
    17. connect(proc, SIGNAL(finished(int)),this, SLOT(SlotEndProcess(int)));
    18. proc->start(makepnggreycommand);
    To copy to clipboard, switch view to plain text mode 


    QT4 QProcess having .... doc "Processes have two predefined output channels: The standard output channel (stdout) supplies regular console output, and the standard error channel (stderr) ...."

    also i suppose if a stdin chanel not exist on QT4 QProcess maybe is not possibel to send postscript code to a chanel... grep QTextStream on site doc QProcess qt4 return Null..
    Or ist this mistake , work on qt4 postscript transform without file ?

Similar Threads

  1. how to control 32 com port through application
    By amit_pansuria in forum Qt Programming
    Replies: 1
    Last Post: 25th July 2007, 06:59
  2. First attempt to display serial port data on GUI
    By ShaChris23 in forum Newbie
    Replies: 12
    Last Post: 4th May 2007, 09:14
  3. Replies: 6
    Last Post: 18th April 2007, 15:04
  4. trayicon port to QT4
    By ykohn in forum Qt Programming
    Replies: 10
    Last Post: 21st April 2006, 15:11
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.