
Originally Posted by
radhika.khandway
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....
#if defined(Q_OS_WIN32)
proc->addArgument( "gswin32c" );
#else
proc->addArgument( "gs" );
#endif
proc->addArgument( "-q" );
proc->addArgument( "-dBATCH" );
proc->addArgument( "-dNOPAUSE" );
proc->addArgument( "-sDEVICE=pnggray" );
proc->addArgument( "-sOutputFile=-" );
proc->addArgument( "-" );
writingStdout = true;
/* send postscript code to console */
if ( !proc->launch( psBarcode ) ) {
/* error code */
} else {
readingStdout = true;
while ( readingStdout ) {
qApp->processEvents();
if ( !proc->isRunning() )
writingStdoutFinished(); /* read png data from console ... */
}
}
proc = new QProcess();
#if defined(Q_OS_WIN32)
proc->addArgument( "gswin32c" );
#else
proc->addArgument( "gs" );
#endif
proc->addArgument( "-q" );
proc->addArgument( "-dBATCH" );
proc->addArgument( "-dNOPAUSE" );
proc->addArgument( "-sDEVICE=pnggray" );
proc->addArgument( "-sOutputFile=-" );
proc->addArgument( "-" );
writingStdout = true;
/* send postscript code to console */
if ( !proc->launch( psBarcode ) ) {
/* error code */
} else {
readingStdout = true;
while ( readingStdout ) {
qApp->processEvents();
if ( !proc->isRunning() )
writingStdoutFinished(); /* read png data from console ... */
}
}
To copy to clipboard, switch view to plain text mode
qt4 code ...
cmd.append(ghosti); /* Ghostscript bin full path */
cmd.append("-dBATCH");
cmd.append("-dNOPAUSE");
cmd.append("-sDEVICE=pnggray");
cmd.append("-sOutputFile="+imageiosFileCache); /* define out file */
cmd.append("-q");
cmd.append(stimeFileCache); /* define in file postscript to transform */
Barcode_Delete( bc ); /* remove barcode gnu */
errprocess = false;
procfinished=false;
if (getGSVersion().size() < 4) {
PaintError(tr("Install Ghostscript."));
return;
}
const QString makepnggreycommand
= cmd.
join(" ");
connect(proc, SIGNAL(finished(int)),this, SLOT(SlotEndProcess(int)));
proc->start(makepnggreycommand);
QStringList cmd;
cmd.append(ghosti); /* Ghostscript bin full path */
cmd.append("-dBATCH");
cmd.append("-dNOPAUSE");
cmd.append("-sDEVICE=pnggray");
cmd.append("-sOutputFile="+imageiosFileCache); /* define out file */
cmd.append("-q");
cmd.append(stimeFileCache); /* define in file postscript to transform */
Barcode_Delete( bc ); /* remove barcode gnu */
errprocess = false;
procfinished=false;
if (getGSVersion().size() < 4) {
PaintError(tr("Install Ghostscript."));
return;
}
const QString makepnggreycommand = cmd.join(" ");
proc = new QProcess(this);
connect(proc, SIGNAL(finished(int)),this, SLOT(SlotEndProcess(int)));
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 ?
Bookmarks