jx324
29th February 2008, 18:26
Hi everyone,
I have a problem as written in title. Here are the codes:
Window::Window()
{
QGroupBox *echoGroup = new QGroupBox(tr("Anscare"));
QLabel *echoLabel = new QLabel(tr("File:"));
QPushButton *browse = new QPushButton(tr("browse.."));
QPushButton *convert = new QPushButton(tr("convert"));
echoLineEdit = new QLineEdit;
echoLineEdit->setFocus();
connect(convert, SIGNAL(clicked()),this, SLOT(runAnscare()));
connect(browse, SIGNAL(clicked()),this, SLOT(getPath()));
QGridLayout *layout = new QGridLayout;
layout->addWidget(echoGroup, 0, 0);
setLayout(layout);
setWindowTitle(tr("WinCares"));
}
void Window::runAnscare()
{
convert->setEnabled( false );
if( process )
delete process;
process = new QProcess( this );
connect( process, SIGNAL(readyReadStandardOutput()), this, SLOT(handleReadStandardOutput()));
process->start( "anscares.exe ");
}
void Window::handleReadStandardOutput()
{
QString string=echoLineEdit->text();
QFileInfo fi(string);
QString name=fi.fileName();
int i=name.size();
name.remove(i-4,4);
process->write(name.toAscii()+"\n");
}
Compile well and when "browse" button is pressed, echoLineEdit can show the path of file. But push the "convert" button, an error occurs: "something wrong with it" :mad:
Can anyone give me some hints?
Thanks.
I have a problem as written in title. Here are the codes:
Window::Window()
{
QGroupBox *echoGroup = new QGroupBox(tr("Anscare"));
QLabel *echoLabel = new QLabel(tr("File:"));
QPushButton *browse = new QPushButton(tr("browse.."));
QPushButton *convert = new QPushButton(tr("convert"));
echoLineEdit = new QLineEdit;
echoLineEdit->setFocus();
connect(convert, SIGNAL(clicked()),this, SLOT(runAnscare()));
connect(browse, SIGNAL(clicked()),this, SLOT(getPath()));
QGridLayout *layout = new QGridLayout;
layout->addWidget(echoGroup, 0, 0);
setLayout(layout);
setWindowTitle(tr("WinCares"));
}
void Window::runAnscare()
{
convert->setEnabled( false );
if( process )
delete process;
process = new QProcess( this );
connect( process, SIGNAL(readyReadStandardOutput()), this, SLOT(handleReadStandardOutput()));
process->start( "anscares.exe ");
}
void Window::handleReadStandardOutput()
{
QString string=echoLineEdit->text();
QFileInfo fi(string);
QString name=fi.fileName();
int i=name.size();
name.remove(i-4,4);
process->write(name.toAscii()+"\n");
}
Compile well and when "browse" button is pressed, echoLineEdit can show the path of file. But push the "convert" button, an error occurs: "something wrong with it" :mad:
Can anyone give me some hints?
Thanks.