Results 1 to 20 of 47

Thread: kdialog and klocate problems

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2007
    Location
    Valencia, Spain
    Posts
    30
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: kdialog and klocate problems

    I'm sorry, I did it wrong. It was a QWidget.......now is working perfectly, thank you.

  2. #2
    Join Date
    Apr 2007
    Location
    Valencia, Spain
    Posts
    30
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: kdialog and klocate problems

    Sorry, but I have another question. I have also one Exit button that is like this:
    void BTScanning::exit()
    {
    close();
    }

    but it only close the GUI, it doesn't kill the process in the computer. I have to press "Ctrl+C" to kill the process in the command promp.
    Is there any way to kill the process at the same time that I close the GUI inside the slot?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: kdialog and klocate problems

    Yes. Connect the lastWindowClosed() signal of the application object to its quit() slot.

  4. #4
    Join Date
    Apr 2007
    Location
    Valencia, Spain
    Posts
    30
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: kdialog and klocate problems

    Hi again,
    I have another little problem with one of the buttons of the GUI. I'll try to explain. I have the redFang Dialog where I asked for the values to the user using lineedits and getting the values when the user presses the button. The process that I have to launch then is a program that is in the same directory of the project but in another folder.
    the project is in a folder named proj. then, inside this folder I have another one called redfang-2.5, in this way proj/redfang-2.5, and inside there is the file called fang, that is the file I have to run.
    So I did like this inside the dialog:
    QString max_val;
    QString min_val;
    QString time;
    QDir dir;

    max_val = max_add->text();
    min_val = min_add->text();
    time = timeout->text();


    dir.cd("redfang-2.5");
    process->addArgument("fang");
    process->addArgument("-n");
    process->addArgument("1");
    process->addArgument("-r");
    process->addArgument("0016755116A8");
    process->addArgument("-0016755116AA");
    process->addArgument("-t");
    process->addArgument("5000");//%d es el timeout

    connect(process, SIGNAL( readyReadStdout() ), this, SLOT( onRedFangReadyRead() ) );

    process->start();// starts RedFang program

    if(!process->start())
    te_resul->insertParagraph(QString("proc is not running"),-1);

    and then i created the onRedFangReadyRead() slot like this:
    QProcess *process = (QProcess*)sender();

    while(process->canReadLineStdout()){
    te_resul->insertParagraph(process->readLineStdout(), -1);
    }

    if(process->normalExit()){
    te_resul->insertParagraph(process->readStdout(), -1);
    }

    everything compiles good, but the result in te_resul area is "proc is not running".

    The input for the redfang program has to be:
    fang -n 1 -r %s-%s -t %d where %s are tho chars[25] and the %d is an integer for the timeout.
    The problem is that I have to put strings as arguments for the process.....and also, i don't know if the path for the fang file is ok like I put.
    Can anybody help me?

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: kdialog and klocate problems

    No, the path is not ok. System won't be able to find your program. You have to provide a correct path or put the program into system $PATH

  6. #6
    Join Date
    Apr 2007
    Location
    Valencia, Spain
    Posts
    30
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: kdialog and klocate problems

    I want to put the relative path but still doesn't work.......can you please tell me how to do It or where can I find some examples? Because I have found some of them but I tried everything and it doesn't work.

    dir.cd("redfang-2.5/fang")
    process->addArgument("fang");
    process->addArgument("-n");
    process->addArgument("1");
    process->addArgument("-r");
    process->addArgument("0016755116A8");
    process->addArgument("-0016755116AA");
    process->addArgument("-t");
    process->addArgument("5000");

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: kdialog and klocate problems

    Just make sure the path is correct. Try
    Qt Code:
    1. process->addArgument("redfang-2.5/fang/fang");
    To copy to clipboard, switch view to plain text mode 
    or something like that.

  8. #8
    Join Date
    Apr 2007
    Location
    Valencia, Spain
    Posts
    30
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: kdialog and klocate problems

    The exec file of the program is called "fang" and is directly inside the redfang-2.5 folder. So I put:
    process->arrArgument("redfang-2.5/fang");
    but is nor working, the message is still "proc is not running".
    to run the process directly in the command promp what I have to put is:
    redfang-2.5/fang -n 1 -r %s-%s -t %d

    where %s are two strings and %d is an integer.
    I did this:
    process->addArgument("redfang-2.5/fang");
    process->addArgument("-n");
    process->addArgument("1");
    process->addArgument("-r");
    process->addArgument("0016755116A8");
    process->addArgument("-0016755116AA");
    process->addArgument("-t");
    process->addArgument("5000");
    but still "proc is not running"

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: kdialog and klocate problems

    Please first check what is the current working directory of the application while running. Don't assume you think what it is, just check it. If you can't handle it, just copy or link the application to the directory where your main binary resides.

  10. #10
    Join Date
    Apr 2007
    Location
    Valencia, Spain
    Posts
    30
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: kdialog and klocate problems

    Finally I put the absolute path of the application an It works.......thank you very much for everything.
    I've been thinking about this problem that I had with the path. Is impossible to put the relative path of the program? I tried a lot of different combinations and nothing worked, it only works with the absolute path and this is not really useful for an open source program that will go from one computer to another, isn't it?
    The other question is about lineedits. What you can get from a lineedit is a string, just doing lineedit->text(); but what happens if what I have to get from the lineedit is an integer? Is possible to get an integer as an integer, not as a string, from the lineedit? How?
    Thanks a lot for your help.

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: kdialog and klocate problems

    You can use a path relative to the application path by using QApplication::applicationDirPath()
    As for the integer - convert the string to integer or use a spin box.

  12. #12
    Join Date
    Apr 2007
    Location
    Valencia, Spain
    Posts
    30
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: kdialog and klocate problems

    Hi, I would like to say thank you for everything. Now the project is working perfectly. I would like to thank everyone who have helped me.
    I have to say that when I started the project I had no idea about Qt language but now I know how useful it is and I will try other things with it, other projects.
    Thanks a lot again.

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.