You just call the slots directly.
Slots, like Q_INVOKABLE methods, can be called from QML.
Your QML code suggests that you want to pass both date and user name when clicking search, so a single slot with two arguments will do.
I guess you have two options:
- use an additional table that maps from a date to a table name for that date
- encode the date in the table name
Yes, exactly, though you probably want to use a single method if both inputs are to be used in the search.
They have to be slots or Q_INVOKABLE.
From the QML side's point of view there is actually no difference.
It is customary though to use Q_INVOKABLE when methods return something, as slots usually don't do that.
In your case all methods you have so far could be slots.
I would advise against that, you would put effort into learning something that you then don't want to use.
I.e. you don't want your C++ code to be dependent on specific QML objects or their specific signals.
Yes, but you really don't want to do that.
Theoretically yes, but the QML scene has not been loaded yet when the model's constructor runs, so the connect would have to happen from outside after both model and QML objects exist.
Cheers,
_
Bookmarks