What's the best way to split the application logic into multiple classes/files ? #3005
Unanswered
bog-dan-ro
asked this question in
General
Replies: 1 comment 1 reply
-
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.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
.ui
apps, 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_ELEMENT
I 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 Demo
example, 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