I have been making my C++ functions callable from Qml by following the approach given in Qt documentation.
This requires one of these conditions to be fulfilled :
public
and Q_INVOKABLE
orpublic slot
This is sometimes not in sync with my class design. As in, the function which I want to be callable from QML, is private according to my class design.
Q1. Can I make a function visible to QML and still keep it private?
Q2. Is it my design flaw to expect this kind of behavior?
If you make something private by design, you consider that it's something to be used only within a class.
What you are asking actually is how can I work around my design.
Obvious answer is — you can make a public wrapper in a class which will invoke your private method and publish this public wrapper into QML, but I would suggest to review design if you face such situation.