Results 1 to 8 of 8

Thread: How to use the QProcess to execute the Browser ?

  1. #1

    Default How to use the QProcess to execute the Browser ?

    Hello,all


    I have a question about use theQProcess

    to execute the Browseron the Qt4.5.1for

    embedded Linux.



    My main program is Buttontest, and when I

    press the button in it, it will execute the Browser program whit QProcess. I

    use the Qt Demo Browser, and the function is ok on X11.



    After that, I try to port this simple

    program to my target board(a MIPS embedded board).




    When I type the ./Buttontest –qws and ./

    browser –qws, it all work fine.



    But when I press the button in the

    Buttontest program, it does not execute the Browser ,and Qt return the messeage:” Did

    not receive a connection event from the qws server .” ?(







    How to resolve this problem? Do I need to

    modify the code?



    I just hope can execute another Qt software

    in my main program on the Embedded board.




    Sorry about my poor English and thanks for

    your Help.

    Below is the code

    to execute the Browser.






    if(sender()->objectName()=="Button1")

    {




    QProcess process;

    process.execute("./browser");

    }




    Eric Chien

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to use the QProcess to execute the Browser ?

    try one of static functions of QProcess, i.e. QProcess::execute or QProcess::startDetached.
    note: read about differences.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Sep 2009
    Posts
    39
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to use the QProcess to execute the Browser ?

    Hi.....
    Plz can i know how to execute program on Qt by QProcess. I'm new to Qt. I need a simple code to execute "ls -l" which should act on CLI(Command line interface). For example if i click on button it should send command "ls -l" to shell. I tried by
    mainwindow.h
    class QProcess;
    Public:
    QProcess *proc:

    mainwindow.cpp
    void Mainwindow::On_button_clicked()
    {
    proc =new QProcess;
    proc->start("ls -l")
    }

    But it is not working.Can you plz share code with me to execute simple command or to execute a program which on Linux ARM board.

    now in CLI i'm executing bu ./program_name -qws

    it is working fine but i want run from Qt and writing same lines ./program _name -qws in a line edit of GUI.

    Thanks in Advance

  4. #4
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to use the QProcess to execute the Browser ?


  5. #5
    Join Date
    Sep 2009
    Posts
    39
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to use the QProcess to execute the Browser ?

    Thanks for reply, But i'm using on embedded linux ARM board. I need to just execute a simple code to show "ls -l" or some program ./test -qws. plz can you tell me how it can be achieved

  6. #6
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to use the QProcess to execute the Browser ?

    Quote Originally Posted by Rajeshsan View Post
    Thanks for reply, But i'm using on embedded linux ARM board. I need to just execute a simple code to show "ls -l" or some program ./test -qws. plz can you tell me how it can be achieved
    Then why you are asking for browser ?
    Ok, you can run a system command using QProcess and redirect its output to any display widget. Now please search this very forum for output redirection.

  7. #7
    Join Date
    Sep 2009
    Posts
    39
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to use the QProcess to execute the Browser ?

    Hello Yogesh sir, I'm working on Windows PC only. by using following commands i got cmd.exe on windows if i click on button.

    plz understand what i'm telling. If i click on button cmd.exe got open by
    proc=new QProcess;
    proc->startDetached("cmd.exe")

    okay after getting command window on my PC. I need to send some characters to printed on that commad line like copy etc by using Qt one more button. i searched all options in parameters list of Qt. I didnt get it.Atleast i need to open some file by using same logic if i click a button, it should open some files with defeoned path.

  8. #8
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use the QProcess to execute the Browser ?

    Rajeshsan, you are confusing people by asking off-topic questions in other peoples threads. Please only ask your questions in your own threads.

Similar Threads

  1. Detect First QProcess finished in a group and kill other
    By Davidaino in forum Qt Programming
    Replies: 3
    Last Post: 11th July 2008, 12:53
  2. Replies: 7
    Last Post: 14th March 2008, 13:52
  3. Invoking a browser...???
    By deepusrp in forum Newbie
    Replies: 4
    Last Post: 12th June 2007, 17:32
  4. QProcess / system call not working under linux. Why?
    By johnny_sparx in forum Qt Programming
    Replies: 12
    Last Post: 11th March 2006, 00:32
  5. QProcess in a QThread
    By chombium in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 15: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.