Organizing desktop application

Patrick Stinson patrickkidd at gmail.com
Tue Apr 13 18:40:29 BST 2021


I disagree with some of the comments above. There are a number of application project folder structures which mimic the MVC structure. Indeed, very large projects benefit from this when actually using MVC types. However, my experience is that 99% of Qt applications are not complex enough to go beyond a monolithic folder structure. I have written a few widely used Qt applications and each one separated basic data structures from the UI, but only because I was actually reusing those basic data structures outside the application project.

I do agree with the comment about Qt’s MVC types being more tightly bound than the design pattern suggests academically. However, I don’t think this impacts folder structure for 99% of Qt projects.

If this is your first project, or if you are otherwise unclear on how to structure the project directory then I suggest you just start with a monolithic folder and differentiate only when there is a reason to do so.

> On Apr 13, 2021, at 8:39 AM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> 
> On Tue, 13 Apr 2021, Maurizio Berti wrote:
> 
>> - The MVC pattern is a bit different from the "Qt point of view", due to
>> the way the library works. In general, they are much less separated than
>> some other frameworks, and it's common to have both the view and the
>> controller contained in the same object (a display object, a class that
>> inherits from QWidget or its subclasses). For data models it's even more
>> "strict": in substance, it is just "Model/View", as both the view and the
>> controller are actually combined in what are called "item views"
>> (QListView, QTableView, QTreeView, all of them being Qt widgets inheriting
>> from QAbstractItemView); both the view and controller parts are also
>> partially managed through what is called an "item delegate", which is
>> responsible of displaying the data of each model index in a (possibly)
>> human readable form, and providing appropriate editors whenever required,
>> while interfacing with the model when data is being committed. Qt even
>> provides higher level views (QListWidget, QTableWidget, QTreeWidget), which
>> provide only simple interfaces to the underlying model, both for the
>> programmer and the user.
>> 
>> I suggest you to take your time and read more about this topic:
>> https://doc.qt.io/qt-5/model-view-programming.html
> 
> Maurizio,
> 
> Thank you. This answers my questions.
> 
> Stay well,
> 
> Rich


More information about the PyQt mailing list