qt


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.

Related Links

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

Categories

HOME
jboss
weblogic12c
verification
selenium-builder
activex
add-on
antd
slider
visualforce
impala
siesta
createjs
xbap
outlook-restapi
squirrel-sql
distributed-computing
heap-dump
asciimath
cmake-gui
fido-u2f
websphere-portal
opentext
high-availability
morris.js
window-managers
xdebug
boolean-logic
tsung
tilemill
es6-modules
dotcms
quick-nimble
series
quickcheck
testlink
jade4j
djcelery
aurelia-cli
mv
cloudera-quickstart-vm
oauth2-playground
kitura
gcal
ternary-operator
pyaudio
svnserve
zynq
gcloud-node
jenkins-workflow
between
codecharge
highlighting
textblock
verisign
android-expansion-files
miniconda
opencyc
openshift-cartridge
darwin
ipod
lifetime
oracle-adf-mobile
redpitaya
.htpasswd
pre
iosched
hyphen
frontbase
mute
disjoint-union
postgres-xc
objective-c-runtime
pacman
flv
handshake
jzmq
acpi
snackjs
server-variables
azure-acs
fragment-identifier
jquery-1.4
asp.net-mvc-views
anonymous-types
activestate
yahoo-maps
xap
version-control-migration
regioninfo

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile