samedi 20 mars 2021

How to make an application architecture right on Qt? [closed]

I have very little experience with .NET WPF. Now I decided to try Qt because of the use of C++ here (I want to go further into this language).

Now I’m faced with the problem of building an architecture for a future application. I want to plan how components will interact with other in the app. For the first application I chose the snake game with speed and mode (solid borders or not) settings, which means at least 2 windows (startup window with settings and game window).

WPF uses Movel-View-ViewModel architecture extensively. I’m not very good at it, as I am not very good at architectural solutions. But I know there it is implemented through a data binding system called "bindings". So View is the visual part of the application, in WPF it’s a XAML layout. This View "connects" to a specific data context for this View - to the ViewModel. Also, there is the Model. I didn’t really get the gist of the model, but I understand it to contain data properties. So if I have some text in WPF, and also, say, a slider, then using bindings I can bind them. So if I move the slider, it changes the value of the property that is associated with the text. And the text will automatically change when you move the slider to the current slider value. Well, it’s just an example of how you can use this architecture and what the WPF platform gives you to work with it. And you can use that to communicate across classes and so on. In Qt, I understand, there are no such bindings.

So my question is. How do I implement architecture, communication between different classes and windows in Qt Widgets more correctly?

If I want to create an user interface through code, then I need some View as in WPF? How can it be linked to implementation? Where should the basic logic be placed and how to interact it with other components (or other components with it) of the project?

Maybe you can give me some advice, given the context - the snake game?

I hope I have made myself clear. But if anything remains unclear, please let me know and I will try to explain the details as soon as possible. Thank you!

Aucun commentaire:

Enregistrer un commentaire