How to include file .h from other projects?



  • Hi everyone, I did 3 dialog projects, now I will create project main window, I wonder how to include file .h from other projects (copy it, create new one ...)?



  • Hmm, move header and source file to the directory where You created Your new project. Then include it in new file with #include directive. After that type (assuming that You are using Linux and You have Qt installed) in command line (be sure that Your working directory is new project directory):

    @make clean@

    @qmake -project@

    @qmake@

    @make@

    @./newProjectBin@

    If this won't help, write some more details: what do You use to write Your Qt applications (QtCreator, some other IDE). Then we will help You :)



  • I understand your idea, First, I think that I must copy file .h and .cpp from old projects to new project. But that way only resolves problem if we code form purely while having a dialog project I used qt designer. I must copy its file .ui to new project, doesn't it?

    ps: I love Windows :)


  • Moderators

    bq. I must copy its file .ui to new project, doesn’t it?

    Yes, you should add it also in your pro file. eg. :

    FORMS    += yourdialog.ui



  • Thanks everyone!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.