Results 1 to 9 of 9

Thread: Call QProcess without GUI

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2007
    Location
    Munich, Bavaria
    Posts
    144
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Call QProcess without GUI

    simply use: this

  2. #2
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Call QProcess without GUI

    Do you mean in this way?
    Qt Code:
    1. connect(&process, SIGNAL(readyReadStandardError()), this, SLOT(updateError()));
    To copy to clipboard, switch view to plain text mode 
    I get this error: connect was not declered in this scope

  3. #3
    Join Date
    Oct 2007
    Location
    Munich, Bavaria
    Posts
    144
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Call QProcess without GUI

    Try this:
    Qt Code:
    1. QObject::connect(&process, SIGNAL(readyReadStandardError()), this, SLOT(updateError()));
    To copy to clipboard, switch view to plain text mode 

  4. The following user says thank you to DeepDiver for this useful post:

    mattia (5th November 2007)

  5. #4
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Call QProcess without GUI

    now i get the access at the connect function but something still wrong, i get this error:
    no matching function for call to ‘QObject::connect(QProcess*, const char [26], CallApplication* const, const char [15])’

  6. #5
    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: Call QProcess without GUI

    CallApplication doesn't inherit QObject and it lacks Q_OBJECT macro --- without this signals & slots mechanism won't work.

  7. #6
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Call QProcess without GUI

    So, have i to declare the .h class in this way?
    Qt Code:
    1. #include <QProcess>
    2.  
    3. class CallApplication : public QObject
    4. {
    5. Q_OBJECT
    6. public:
    7. CallApplication();
    8. ~CallApplication();
    9. void performApplication();
    10. private slots:
    11. void updateError();
    12. void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
    13. void processError(QProcess::ProcessError error);
    14. public:
    15. QProcess process;
    16. };
    To copy to clipboard, switch view to plain text mode 

  8. #7
    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: Call QProcess without GUI

    Quote Originally Posted by mattia View Post
    So, have i to declare the .h class in this way?
    Yes, and don't forget to re-run qmake.

  9. The following user says thank you to jacek for this useful post:

    mattia (5th November 2007)

  10. #8
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Call QProcess without GUI

    Done! Now it's working. Thanks so much.

Similar Threads

  1. QProcess error to call mogrify
    By mattia in forum Newbie
    Replies: 2
    Last Post: 29th October 2007, 11:46
  2. QProcess and Pipes
    By KaptainKarl in forum Qt Programming
    Replies: 1
    Last Post: 9th April 2007, 23:11
  3. QProcess extremely slow on Windows?
    By Pepe in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2007, 00:25
  4. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 13:30
  5. QProcess / system call not working under linux. Why?
    By johnny_sparx in forum Qt Programming
    Replies: 12
    Last Post: 11th March 2006, 00:32

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.