Results 1 to 13 of 13

Thread: How to run Qt programs----simple one

  1. #1
    Join Date
    Sep 2006
    Posts
    102
    Thanks
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Exclamation How to run Qt programs----simple one

    hii all friends

    this is really very simple question but its quite irritating when it doesnt run.

    i want to know the correct way to run Qt projects or simple ui files with kdevelop.
    this is what is want..

    I create a project file with atleast one dialog. then on the shell i type the command:
    qmake project.pro
    make

    fine. the exe is made and the project runs ok.

    the files which i get after running the qmake and make on the project file in that particular directory are : .exe , form1.ui , form.ui~ , main.cpp , main.cpp~ , .pro , Makefile

    the exe is running as required.
    but tell me is it necessary that qmake and make should also have generated *.o and *.moc files or moc_* kind of files.
    if yes then how can i do so and where is the fault. why it is not getting generated.

    and if not then tell me is it necessary to get these files to make this project running in kdevelop??

    plz tell me how can i run the qt project in kdevelop. I use kdevelop 2.1 and qt3.3.0

    the KAppWizard under project->new gives---> Qt-sdi.

    please explain step by step process.
    gmail--> shahshamiks@gmail.com 4 chat

    thanks and regards.
    shamik

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to run Qt programs----simple one

    I think that qmake uses hidden directories for this. Try ls -la

  3. #3
    Join Date
    Sep 2006
    Posts
    102
    Thanks
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: How to run Qt programs----simple one

    hii

    i tried ls -la but none of *.o of moc_*.* is getting listed. i think there is no use of it. these files are not present in any of the internal directories. they are present in the directory where project file and make file are present.

    but first of all tel me are these files really necessary to get the program running in kdevelop ? actually without these files the project is running fine but only from the shell.
    this question arises because i have a sample project which has got these files and it is running fine in kdevelop. the thing is that i have not created that project so i dont know the actual procedure.

    i think these files should get generated automatically whenever the project is compiled.
    what say?


    regards.
    shamik

  4. #4
    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: How to run Qt programs----simple one

    It's not possible that there are no .o files. Your executable is formed from them. There could be a .obj directory and all the object files (one for each cpp file in the project) should be there.

  5. #5
    Join Date
    Sep 2006
    Posts
    102
    Thanks
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: How to run Qt programs----simple one

    hii

    the moc and *.o files are getting created but only when the project compiles completely without any errors.

    thats fine.

    but the project is still not running. I already had qt 3.1 installed bydefault with RH9.
    then i installed qt 3.3.0 manually and have set the path variables. when i type the set command it shows the new installation path i.e. /usr/local/qt/bin ... etc ....thats ok.

    when i type which moc and which uic and which qmake then it shows the new one i.e. /usr/local/qt/bin/moc , /usr/local/qt/bin/uic, /usr/local/qt/bin/qmake....that is also ok.

    but when i compile or configure or make the kdevelop project then it takes /usr/lib/qt-3.1 files.
    something like this..
    checking for moc...../usr/lib/qt-3.1/bin/moc
    checking for uic...../usr/lib/qt-3.1/bin/uic ...........etc.


    that means kdevelop still takes the old qt file's paths.
    but i have already set the necessary environment variables. when i compile any project file i.e. *.pro of qt using qmake in the shell then it normally takes the new qt path.

    then why cant kdevelop do so??
    if kdevelop starts taking the new qt path then i think the problem should get solved. can u please tell me how should i do it ?

  6. #6
    Join Date
    May 2006
    Location
    Pune,India
    Posts
    63
    Thanks
    7
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to run Qt programs----simple one

    Only *.exe is required. *.o and *.moc is generated during compilation.

  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: How to run Qt programs----simple one

    Quote Originally Posted by shamik View Post
    then why cant kdevelop do so??
    if kdevelop starts taking the new qt path then i think the problem should get solved. can u please tell me how should i do it ?
    The easiest way (that's how I often do it) is to set the path as a custom environment variable inside the project configuration. Alternatively, you cat set the path in your user profile, so that kdevelop always picks the right path or you can create a custom desktop icon for kdevelop and modify its properties and set the path there.

  8. #8
    Join Date
    Sep 2006
    Posts
    102
    Thanks
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: How to run Qt programs----simple one

    i m trying to set those library path through project->options->linker

    then i uncheck the qt checkbox and manually give the following paths :
    /usr/local/qt/include /usr/local/qt/bin /usr/local/qt/lib /usr/local/qt/bin/uic /usr/local/qt/bin/moc


    but still while configuring it again takes moc and uic paths as /usr/lib/qt3.1/bin

    and after adding all these paths when i make the project it gives hell lot of errors.

    my main aim is to run the Qt GUIs through kdevelop. this is what i have done-->
    1. i created a new project Qt Sdiwithout source and headers.
    2. then file->new->*.ui and gave it a name called KTestDlg.ui ( as explained in the manual).
    3. then Qt opened and i added a push button.......created a new slot called pbclicked() and under it i wrote a small code to show a messagebox. I am sure it has got no errors.....(save). now i can view this file under "Interfaces" folder.

    4. then going back to kdevelop i created new class called KTest and under base class i wrote "KTestDlg" without quotes and checked the checkbox against 'generate a QWidget child class'.
    5. the KTestDlg class gets created with its constructor and destructors and the KTest.h file which has got nothing but only the declaration of these constructors and destructors.

    6. then in the main file i make object of this class KTest as kk and just kk.show() shows the form with the pushbutton widget.
    7. but the slot which i had written for it under the ui.h file in Qt is not getting called. instead either close() is the slot or nothing happens at all after clicking this pushbutton.

    8. i think the .h file of KTest class i.e. KTest.h should be the one similar to KTestDlg.h which is getting generated automatically. This .h file is the original ui.h file written in Qt i.e. KTestDlg.ui.h

    9. on the heading of the file KTestDlg.h which kdevelop shows is written that this file has been generated after reading KTestDlg.ui by the uic and it is created by Qt 3.1.1
    which is the older version.

    I know it is becoming quite messy. but read it carefully it is easy to visuallize the situation from this long description.

    please tell me the write procedure if i am going wrong anywhere.
    the slots declared in Qt are not shown in KTest class as functions. I think this KTest class should show the slots and all the funtions of KTestDlg.ui.h written in Qt as its function since it is inheriting it.

    please tell me. i have tried out all the possible combinations of it hoping that trial and error might lead to some solution but dint worked.

    y the KTest class cant show the slots as its functions. and y the slot of every pushbutton becomes either close() or happens nothing bydefault and the original one declared is not called eventhough the compiler is linking KTestDlg.h dynamically.


    thanks and regards.
    shamik



  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: How to run Qt programs----simple one

    It's in "Make options". Add an environment variable PATH and set it to "/your/qt4/installation/bin:$PATH".

  10. #10
    Join Date
    Sep 2006
    Posts
    102
    Thanks
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Thumbs up Re: How to run Qt programs----simple one

    hiii alll


    thankyou very much for the help

    i have now solved the problem myself. the answere to what i asked is nowhere in this thread but anyhow i managed to solve it.

    thanks everybody for trying to help me.

    regards..
    shamik

  11. #11
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to run Qt programs----simple one

    It would help if you could state what the real problem was and How you managed to solve it
    We can't solve problems by using the same kind of thinking we used when we created them

  12. #12
    Join Date
    Sep 2006
    Posts
    102
    Thanks
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Thumbs up Re: How to run Qt programs----simple one

    I was trying out different combinations of solving this problem and finally i got one which worked. and i think this is the correct method because every project file which i create is now working fine. here it goes.


    i made a qt project .pro and compiled it, made the exe by running make. the exe should run as desired.

    now there are three hidden folders in the folder where u create this .pro file.
    amongst these is one called .ui

    from terminal, go to the folder where ur .pro file is and then type the command--- mv .ui ui

    now u can view this folder from the GUI. now copy the files inside this folder outside of it i.e. to the folder where ur .pro file . (actually this is not required but u can do it.....adding files to kdevelop becomes easy).

    now open kdevelop newly created project and click on project->add existing files

    then go to this folder where ur .pro file is. then add the files ending with .ui and .ui.h and .h

    kdevelop will automatically create the class and place the files in their proper locations.
    what else?
    configure it and make it

    enjoy running the exe.

    sometimes we can solve the problem without anybody's help

    right !?! hai na bhaiya?? (i cannot mention the name but the one who reads can understand it)


    regards
    shamik

  13. #13
    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: How to run Qt programs----simple one

    Wouldn't it be simpler just to show hidden files from your file manager? Or delete the entries from your project file enabling the use of ui, object and moc dirs?

    Besides, these folders are hidden on purpose - you don't need to even know what's inside them and they are hidden so that they don't clutter your view. But if you want to always see them, then good for you!

Similar Threads

  1. Simple way to expand all nodes on a QTreeView?
    By cboles in forum Qt Programming
    Replies: 10
    Last Post: 12th April 2014, 17:54
  2. Replies: 4
    Last Post: 10th October 2009, 18:59
  3. QTextEdit simple question
    By Marcopolo in forum Qt Tools
    Replies: 4
    Last Post: 11th October 2007, 01:01
  4. Simple input box for QPainter
    By therealjag in forum Qt Programming
    Replies: 1
    Last Post: 23rd February 2006, 16:33
  5. can't get a simple dialog working
    By pthomas in forum Newbie
    Replies: 8
    Last Post: 13th 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.