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 kdialog and klocate problems

    Hi to everyone,
    I'm doing a gui using Qt3 for a program made by other guy. I made it using QtDesginer and I get .ui file. Then using uic I created the headder and .cpp files. Now I'm using Kdevelop as IDE.
    I put all the files in a folder and did like this in command promp:

    qmake -project
    qmake testgui.pro
    make

    and get this error:

    g++ -c -pipe -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/include/qt3 -o gui_bt.o gui_bt.cpp
    gui_bt.cpp:10:21: error: kdialog.h: No existe el fichero o directorio ( Doesn't exist file or directory )
    gui_bt.cpp:11:21: error: klocale.h: No existe el fichero ó directorio ( Doesn't exist file or directory )
    gui_bt.cpp:106:22: error: gui_bt.moc: No existe el fichero ó directorio ( Doesn't exist file or directory )
    gui_bt.cpp: In member function ‘virtual void GUI_BT::languageChange()’:
    gui_bt.cpp:77: error: ‘tr2i18n’ was not declared in this scope
    make: *** [gui_bt.o] Error 1

    I have to say that one small program like the Hello World is working perfectly doing the same steps.
    Thanks for all.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: kdialog and klocate problems

    You are using KDE widgets (which are based on Qt) and the include path is not set for them.
    If you are using the KWidgets in purpose, then I guess you know that you make your app dependent of KDE - and it will not run where you can't link to kde.
    If you are not doing this on pupopose, use the QWidgets (without 'K' at the beginning).
    This will both eliminate your error (provided that you are including the problem q - header files) and make it cross platform.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

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

    Default Re: kdialog and klocate problems

    Thank you for your answer, and sorry for this stupid error
    I've been trying what you said and now i get this error:

    g++ -c -pipe -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/include/qt3 -o gui_bt.o gui_bt.cpp
    gui_bt.cpp:14:22: error: gui_bt.moc: No existe el fichero ó directorio ( )
    gui_bt.cpp: In member function ‘virtual void GUI_BT::languageChange()’:
    gui_bt.cpp:80: error: ‘tr2i18n’ was not declared in this scope
    make: *** [gui_bt.o] Error 1

    I can guess that I don't have gui_bt.moc.
    As I said I did the GUI using QtDesigner and the instruction uic, so, why I have this "tr2i18n" error if it's something that I just put in the GUI?? They are just names for the buttons. Here is the code for the function, maybe it can help:

    void GUI_BT::languageChange()
    {
    setCaption( tr2i18n( "BT scanning program" ) );
    Menu->setTitle( tr2i18n( "MENU" ) );
    b_scan->setText( tr2i18n( "Scan" ) );
    b_save->setText( tr2i18n( "Scan and Save" ) );
    b_save->setAccel( QKeySequence( QString::null ) );
    b_redfang->setText( tr2i18n( "RedFang" ) );
    b_exit->setText( tr2i18n( "Exit" ) );
    }

    Thanks again for your answer.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: kdialog and klocate problems

    The function tr2i18n() is a KDE function.
    Are you sure you are not using KDE Widgets (available in Designer) on your Dialog?

    After this is sortes out, we can deal with the uic problem.

    Hmm. I am not sure I fully understand the stucture of your project.
    Could you explain it in a bit more detail?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

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

    Default Re: kdialog and klocate problems

    ok, yes, maybe is better if I explain everything better.
    I have to do a GUI for a program made by other guy. The original program is made using C language.
    I was thinking about how to do it using C++ and after some research I decided to do it using Qt libraries because I'm in kubuntu. For the same reason I'm using Kdevelop as IDE.
    First I did the GUI with QtDesigner and get the .ui file. Using uic I get both the .h and the .cpp files. And then I went to KDevelop.
    Using KDevelop I did 3 files more: another .h and .cpp and also a main.cpp. I did this following one book.
    So, finally I have 5 files: gui_bt.h, gui_bt.cpp, gui.h, gui.cpp and main.cpp.
    Probably, as you said, when I was creating the GUI with QtDesigner I used KDE Widgets without knowing it. The problem is now how I have to compile the project and how I have to run it if I have all this mistakes, mixing QWidgets and KWidgets.....
    The only thing I'm doing now is trying to compile the project and run it. Just the GUI. I didn't do all the program, cause I have to match the program with my GUI yet. I put the bottoms I need for the menu, but the functions are not implemented yet, I just have the functions empty.
    I know that I don't know anything about how to use this libraies and the programs, that's why I would like to say to you thanks a lot for your help.

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: kdialog and klocate problems

    Why are you using Qt3 and not Qt then?

    It will be much easier if you start all over, than for us to help you "patch -up" your project.
    You can do all you did in a much simpler way:
    Open KDevelop.
    Project->new Project
    Select QMake Project with a "Hello World" Template.
    In the make manager right click on the project, and "run qmake".
    Then build.
    If your project compiled then:
    To add new source and hader files, just right click "headers" or "sources" in the project manager on the right, and choose "add new".
    The ui you can add the same way, just choose "add existing".

    Post again if you have problems.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

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

    Default Re: kdialog and klocate problems

    Hi high_flyer,
    thanks a lot for your help. I did my project again from the beginning and everything is fine at the moment. It works and I could compile it without any problem.
    As you said, I did it wrong the first time because I was mixing KWidgets and QWidgets. Now i did It taking care about that and everything worked without problems.
    But now I have a problem with the actions of the menu.
    In the GUI there is a menu, 4 bottoms, each one is doing one actions, but I want the actions, all the results of that actions, appear in the GUI, in one on the areas that I create for that. Now, all the results are appearing in the terminal, not in the GUI. These areas are QTextEdit, but I don't know if there is another element to put instead of textEdit to do it, to do that the results appear in this area. Or maybe I missed some instruction....
    Thanks a lot again.

  8. #8
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: kdialog and klocate problems

    all the results of that actions, appear in the GUI,
    Please understand that we have no knowledge of what you are doing.
    What are the "results" and what did you do to have them on the GUI?
    As far as I understand, your GUI communicates with a console application - is that correct?
    Does the infomation flow from the non GUI application to your GUI application work ok?
    Could you explain how you did that?

    Relevant code segements with explanations could help.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

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

    Default Re: kdialog and klocate problems

    Sorry again for my really bad explanation. I'm not used to post in a forum like this one.
    Let's try to do it better:
    I had one program made in C language by another guy. All the results of that program appear in the terminal console. Also the program creates 3 files with the information. Now, I created the GUI and directly put the code of the original program in the menu, in each function on each button without changing anything. So, the program is working perfectly because when I press the buttons of the GUI they do what they has to do, but the results are still appearing in the terminal console, like before, not in the TextEdit that I put in the GUI.
    I know that is because there is no connection between both, my textEdit and the code of the original program because I did nothing, I just put the original code in each function of each button of the GUI. The code of the first function for example is like this:

    Button Scan

    void BTScanning::scan()
    {
    system("hcitool scan");
    }

    This function scans an area looking for some bluetooth devices that are connected, and the result of this function, once I press the button of the menu in the GUI appears in the terminal console, not in the textEdit area of the GUI.
    How can I do this? how can I "put" what appears in the terminal in that area of the GUI? How can I connect both?
    Thanks a lot again for your help.

  10. #10
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: kdialog and klocate problems

    Ok, now I see.
    Well, basically what you want is to read the output from the console, and diplay it in your gui -if I undertood you correctly.
    I see you are using the system() function, in Qt you will have to use the QProcess class to be able to tap to the stdio.
    Read the docs about it, and ask again when you get stuck.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

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

    Default Re: kdialog and klocate problems

    I've been reading the doc. for the QProcess class and I've been trying different things.
    Now I have like this in my .cpp file:

    first the include for the class
    Qt Code:
    1. #include <qprocess.h>
    2.  
    3. then the place where I want that the results appear:
    4. te_results = new QTextEdit( this, "te_results" );
    5. te_results->setGeometry( QRect( 250, 180, 341, 281 ) );
    6.  
    7. then the connection with the function scan():
    8. connect( pb_scan, SIGNAL( clicked() ), this, SLOT( scan() ) );
    9. pb_scan is the name of the button
    10.  
    11. and finally the function scan():
    12. void BTScanning::scan()
    13. {
    14. QProcess *process = new QProcess(this);
    15. QByteArray exit;
    16.  
    17. process->addArgument("hcitool scan");
    18.  
    19. exit->readAllStadardOutput();
    20.  
    21. process->start();
    22. }
    To copy to clipboard, switch view to plain text mode 

    But It appears one error like this when I'm trying to compile the project:
    btscanning.cpp: In member function ‘virtual void BTScanning::scan()’:
    btscanning.cpp:90: error: base operand of ‘->’ has non-pointer type ‘QByteArray’

    I tried a lot of different things:
    exit = process->start("hcitool scan");
    connect(process, SIGNAL((hcitool scan)), this, SLOT("te_results"));

    but nothings works...can you please help me. What I'm doing wrong? Thank you.
    Last edited by high_flyer; 4th May 2007 at 14:12. Reason: missing [code] tags

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.