What's the best way to split the application logic into multiple classes/files ? #3005
Replies: 2 comments 2 replies
-
|
You can move the code that initialize the properties and callback for a given page in a different file. If, for example you have a global for a given part of the UI, you can have this funciton in a separate file. Or maybe even as a member of a C++ class void init_foobar(const Foobar &) { ... }And you can call that from the UI code as init_foobar(app->global<Foobar>()); |
Beta Was this translation helpful? Give feedback.
-
|
I have also experienced this I am currently looking into conditionally rendering pages using a states system while still using the
This doesn't tho, I am getting |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello there,
In Qt (sorry for keep using it as an example), I could split the application logic into multiple classes:
.uiapps, it was easy, as you created all the views by inheriting the apropiate QClass, called the setup to create all the ui elements and all the UI signals/slots where isolated in that class.QML_ELEMENTI could expose any C++ stuff to QML world easily and there I could used them independently.I checked all slint C++ examples and, to my knowledge, it seems the only way to interact with the UI elements is through main window properties & callbacks, which for a simple application might be okay, but for apps which have lots of "screens" with many UI controls on each screen won't work. Even for a simple application like
Printer Demoexample, you'll endup with a few dozens of properties & callbaks in one place...Is there anything that I'm missing? If yes, can you please change
Printer Demo, and add a class which does something for each view?E.g. for :
It's probably related to #154
Beta Was this translation helpful? Give feedback.
All reactions