Results 1 to 4 of 4

Thread: QProcess problem: compile well but output error

  1. #1
    Join Date
    Feb 2008
    Posts
    2

    Default QProcess problem: compile well but output error

    Hi everyone,

    I have a problem as written in title. Here are the codes:
    Qt Code:
    1. Window::Window()
    2. {
    3.  
    4. QGroupBox *echoGroup = new QGroupBox(tr("Anscare"));
    5.  
    6. QLabel *echoLabel = new QLabel(tr("File:"));
    7. QPushButton *browse = new QPushButton(tr("browse.."));
    8. QPushButton *convert = new QPushButton(tr("convert"));
    9. echoLineEdit = new QLineEdit;
    10. echoLineEdit->setFocus();
    11.  
    12. connect(convert, SIGNAL(clicked()),this, SLOT(runAnscare()));
    13. connect(browse, SIGNAL(clicked()),this, SLOT(getPath()));
    14.  
    15. QGridLayout *layout = new QGridLayout;
    16. layout->addWidget(echoGroup, 0, 0);
    17.  
    18. setLayout(layout);
    19.  
    20. setWindowTitle(tr("WinCares"));
    21. }
    22.  
    23. void Window::runAnscare()
    24. {
    25. convert->setEnabled( false );
    26.  
    27. if( process )
    28. delete process;
    29. process = new QProcess( this );
    30.  
    31. connect( process, SIGNAL(readyReadStandardOutput()), this, SLOT(handleReadStandardOutput()));
    32.  
    33. process->start( "anscares.exe ");
    34. }
    35.  
    36. void Window::handleReadStandardOutput()
    37. {
    38. QString string=echoLineEdit->text();
    39. QFileInfo fi(string);
    40. QString name=fi.fileName();
    41. int i=name.size();
    42. name.remove(i-4,4);
    43. process->write(name.toAscii()+"\n");
    44.  
    45. }
    To copy to clipboard, switch view to plain text mode 

    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"

    Can anyone give me some hints?

    Thanks.
    Last edited by wysota; 29th February 2008 at 19:06. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess problem: compile well but output error

    Quote Originally Posted by jx324 View Post
    process->start( "anscares.exe ");
    Where is that file located?

    Quote Originally Posted by jx324 View Post
    But push the "convert" button, an error occurs: "something wrong with it"
    Could you post the exact error message?

  3. #3
    Join Date
    Feb 2008
    Posts
    2

    Default Re: QProcess problem: compile well but output error

    The executable file was located in the debug folder. The error shows simply :"an error occurs", that's why I cannot solve it.

    Anyway, thanks for your reply.

  4. #4
    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: QProcess problem: compile well but output error

    Are you running the app via an IDE? If so, most likely the current working directory is not in debug nor release subfolder but one level up. See
    J-P Nurmi

Similar Threads

  1. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  2. Error compiling psql plugin
    By vieraci in forum Installation and Deployment
    Replies: 4
    Last Post: 7th October 2007, 02:49
  3. Qtopia core 4.2.2 cross compile make error
    By smiyai18 in forum Installation and Deployment
    Replies: 2
    Last Post: 28th August 2007, 17:04
  4. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 12:19
  5. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52

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.