class ShowResults;
if (!showResults){
showResults = new ShowResults (this, "showResutls");
connect(this,
SIGNAL(newData
(QString)),
showResults,
SLOT(newData
(QString)));
}
showResults->show();
showResults->raise();
showResults->setActiveWindow();
filename = workingFileName ;
emit newData(workingFileName);
class ShowResults;
if (!showResults){
showResults = new ShowResults (this, "showResutls");
connect(this, SIGNAL(newData(QString)),
showResults, SLOT(newData(QString)));
}
showResults->show();
showResults->raise();
showResults->setActiveWindow();
filename = workingFileName ;
emit newData(workingFileName);
To copy to clipboard, switch view to plain text mode
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qtextview.h>
#include <qprocess.h>
#include <qstring.h>
#include <qfile.h>
#include <qdir.h>
#include <qmessagebox.h>
#include "showResults.h"
ShowResults
::ShowResults(QWidget *parent,
const char *name
)// ,QString FileName )
{
setGeometry
( QRect( 400,
40,
660,
640 ) );
setCaption(tr("Gas Dynamics Calculator: The Results"));
output = new QTextView( this );
output
->setGeometry
( QRect( 15,
10,
630,
550 ) );
closeButton
= new QPushButton(tr
("Close Window"),
this);
closeButton
->setGeometry
( QRect( 200,
580,
100,
40 ) );
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
clearButton
= new QPushButton(tr
("Clear Window"),
this);
clearButton
->setGeometry
( QRect( 340,
580,
100,
40 ) );
connect(clearButton, SIGNAL(clicked()), this, SLOT(clearOutput()));
init();
}
void ShowResults::init()
{
proc = 0;
output->setText("<html> </html>");
}
void ShowResults::readFromStdout()
{
curPosX = output->contentsHeight() - 30 ;
output->append( proc->readStdout() );
}
void ShowResults::clearOutput()
{
output->setText("");
}
void ShowResults::scrollToTop()
{
curPosX = output->contentsHeight()- 30;
output->setContentsPos( curPosX, 0 );
}
void ShowResults
::newData(QString FileName
) {
if (!proc){
connect( proc, SIGNAL(readyReadStdout()), this, SLOT(readFromStdout()) );
connect( proc, SIGNAL(processExited()), this, SLOT(scrollToTop()) );
// the gd/gd program sent the html file below
proc->setArguments( "./gd/gd" );
proc->addArgument( FileName );
}
curPosX = output->contentsHeight();
output->setContentsPos( curPosX, 0 );
output->setContentsPos( curPosX, 0 );
if ( !proc->start() ) {
tr("Fatal error"),
tr("Could not start the gd program."),
tr("Quit") );
exit( -1 );
}
}
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qtextview.h>
#include <qprocess.h>
#include <qstring.h>
#include <qfile.h>
#include <qdir.h>
#include <qmessagebox.h>
#include "showResults.h"
ShowResults::ShowResults(QWidget *parent, const char *name)
// ,QString FileName )
: QDialog(parent, name)
{
setGeometry( QRect( 400, 40, 660, 640 ) );
setCaption(tr("Gas Dynamics Calculator: The Results"));
output = new QTextView( this );
output->setGeometry( QRect( 15, 10, 630, 550 ) );
closeButton = new QPushButton(tr("Close Window"), this);
closeButton->setGeometry( QRect( 200, 580, 100, 40 ) );
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
clearButton = new QPushButton(tr("Clear Window"), this);
clearButton->setGeometry( QRect( 340, 580, 100, 40 ) );
connect(clearButton, SIGNAL(clicked()), this, SLOT(clearOutput()));
init();
}
void ShowResults::init()
{
proc = 0;
output->setText("<html> </html>");
}
void ShowResults::readFromStdout()
{
curPosX = output->contentsHeight() - 30 ;
output->append( proc->readStdout() );
}
void ShowResults::clearOutput()
{
output->setText("");
}
void ShowResults::scrollToTop()
{
curPosX = output->contentsHeight()- 30;
output->setContentsPos( curPosX, 0 );
}
void ShowResults::newData(QString FileName)
{
if (!proc){
proc = new QProcess( this );
connect( proc, SIGNAL(readyReadStdout()), this, SLOT(readFromStdout()) );
connect( proc, SIGNAL(processExited()), this, SLOT(scrollToTop()) );
// the gd/gd program sent the html file below
proc->setArguments( "./gd/gd" );
proc->addArgument( FileName );
}
curPosX = output->contentsHeight();
output->setContentsPos( curPosX, 0 );
QString notice, notice1, caption;
output->setContentsPos( curPosX, 0 );
if ( !proc->start() ) {
QMessageBox::critical( 0,
tr("Fatal error"),
tr("Could not start the gd program."),
tr("Quit") );
exit( -1 );
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks