How to divide a larger project in Qt C++



  • Hi all.

    I have always been a C# programmer who has used some C++ (mainly C# wrappers that interact with C++) in my current project but I want to learn how to use Qt so I can create my app for other OS types.

    I have been playing around with the samples and tutorials that come with Qt.

    Currently I have a semi large project in C# I would like to try to convert to Qt C++.

    In C# I have learned to separate logic so it's easy to maintain and debug. For Example instead of having your database SQL queries all over the place you can create a class in 1 place and use that when needed.. If I ever had a SQL issue I knew what section I should start looking.

    http://www.eatoncode.com/resources/shareit/TrafficBrowser_MasterSolution_-_Microsoft_Visual_Studio_2016-10-25_19.17.15.png

    I would like to do this in Qt C+ if it's possible. I have looked at a few examples that Qt provides and I don't really see any good examples of larger projects. So I wonder if it's a preference or a specific reason why. I am hoping and guessing it's to be simplistic.

    I loaded a larger example in Qt.

    http://www.eatoncode.com/resources/shareit/RibbonControls.pro_qtitanribbon_Qt_Creator_2016-10-25_19.24.36.png

    I see that you can include .pri files inside .pro files... you can even call other .pri files from .pri files.. but what I don't understand is how to create a .pri file.

    Am I on the right track to separate my logic? Or am I going about it wrong and there is an easier way ? At the end of the day I want a project that's easy to maintain and understand.

    This might be a totally noobie question that I should already know, but I don't so I am asking how do you handle your larger project ?

    Thanks,
    David


  • Moderators

    @EatonCode said in How to divide a larger project in Qt C++:

    I see that you can include .pri files inside .pro files... you can even call other .pri files from .pri files.. but what I don't understand is how to create a .pri file.

    A .pri file isn't any different from a .pro file. They are just named differently to mark them as include files.
    The best bigger project how to separate code is Qt source code itself ;)
    There you can see and check the pro files of the different (sub-)modules how they include their stuff. Then the rest is just "learning" qmake variables.


Log in to reply
 

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