Make a private C++ function visible to Qml
I have been making my C++ functions callable from Qml by following the approach given in Qt documentation. This require one of these conditions to be fulfilled : Make the C++ function public and Q_INVOKABLE or Make the C++ function a public slot This sometimes is 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 ?
Well, if you do something private by design you consider that it's something to be used only within a class. Now you are now asking actually is how can I workaround 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.
Unable to connect signal to slot in another class
TCP network communication security risks
QT getting the screen resolution without the extended monitor
Gtk skip_taskbar_hint (seen in Glade-ui-Designer) äquivalent in Qt
change text in another class by button
Use boost build bjam for building Qt stuff
I want to use gdb with my Qt project..But I received “Permission denied” message?
qmake: could not find a Qt installation of '' - Setting up qmake?
qt file menu with vertical separator to make recent column
Why won't my scrollbars synchronise properly?
How to fill default text into QInputDialog
Make a pixmap transparent for a QLabel
OpenCV 2.4.6 with QT 5.1.0 Errors
Server Respose in QTCP SOCKET
How to install qt add-in (for Qt 4x) for Visual Studio 2012
Not able to access my webcam using opencv library