Preferred way to design application arhitecture in Qt

  architecture, c++, qt

I have application which has MainWindow that is divided in three main parts:

enter image description here

Thing is, all three parts need to communicate between themselves. For example, there is a QListView in left section where you select items, and depending on the selected item options change in the right section.

I have come up with three solutions:

  1. draw everything within the MainWindow which would make MainWindow one big superclass:

This solution solves all problems with communication between widgets because all of them are part of MainWindow::ui but then I get one big (potentially messy) class.

  1. put each section in it’s own class and make MainWindow a singleton:

This solution is… well a singleton. And I don’t really like singletons. I will have access to MainWindow from everywhere (essentially I am creating a global variable) and I would still have to expose MainWindow::ui (and ::uis of other sections) via getter which would mean that everything will have access to ::uis.

  1. put each section in it’s own class and connect everything via signals and slots:

This would probably be the best solution but with this solution I need to create getter for each widget from EachSection::ui (to be able to connect it in MainWindow with it’s counterparts), I would need a lot of calls to connect() and I also have a problem if two slots react to same signal but they need to react in specific order.

So what would be the best approach?

Source: Windows Questions C++