Results 1 to 3 of 3

Thread: how to make system calls to be displayed in QLineEdit

  1. #1
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question how to make system calls to be displayed in QLineEdit

    hi friends/experts,
    I have succeed in calling a system call inside my application
    ex=> system("htmlview 192.168.1.4") ;

    but is it possible to display the result of the command call to be display in QLineEdit
    ex: I need to display ifconfig call to be display in my lineEdit

    please help me to solve the problem ....
    thanks

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to make system calls to be displayed in QLineEdit

    using system, not really.
    possibilities
    * shell redirection: system("your command > outputfile")
    then read the file, unlink it, and display the contents
    // not quite so portable as QProcess
    // you need to generate a (free) temp. filename
    // you need write access to some place
    * use QProcess (this is what i would suggest)

    HTH

  3. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile Re: how to make system calls to be displayed in QLineEdit

    thanks ya,
    i made it so fine using QProcess


    my code : QString program = "/sbin/ifconfig";
    QStringList arguments;
    arguments <<"eth0";

    proc = new QProcess(this);
    connect(proc, SIGNAL(readyReadStandardOutput()), this, SLOT(readFromStdout()));
    proc->start(program, arguments);
    }
    void Panel2::readFromStdout()
    {
    ui->resultTextEdit->setPlainText(proc->readAllStandardOutput() );
    }


    i made it.....

Similar Threads

  1. Pointer Question related to QLineEdit
    By ChrisReath in forum Qt Programming
    Replies: 1
    Last Post: 23rd May 2008, 15:13
  2. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57

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.