Hi!! I´m newer in qml and I like to implement c++ in qml, for example: when I press the rectangle or other thing ask two number and do sum. Can someone help me? Can do a complete example and give me the code please?
thank you very much.
Hi!! I´m newer in qml and I like to implement c++ in qml, for example: when I press the rectangle or other thing ask two number and do sum. Can someone help me? Can do a complete example and give me the code please?
thank you very much.
Could you rephrase your question please?
What is it that you want to do in QML and what is it that you want to do in C++?
Cheers,
_
askatuak (17th September 2013)
Hi!! Cheers.
for example, I like to do this, when I press the qml rectangle, say "Hellow World", but the "Hellow wolrd" program in c++. Other example, when I press the qml rectangle, appeared the result of 2+2 (or other numbers).
Thanks
He wants to call a c++ function as a result of interaction with QML-created elements.
askatuak (17th September 2013)
http://qt-project.org/doc/qt-4.8/qtb...qml-components
Second example (the one with the ApplicationData class)
Cheers,
_
askatuak (17th September 2013)
What didn't work?
The example contains all important pieces:
- definition of a QObject derived class
- marking a method as Q_INVOKABLE
- creating an instance of that class
- exporting it to QML by calling setContextProperty() on the view's root context.
It doesn't get easier than that.
If you want to use QtQuick2 instead of QtQuick1 use a QQuickView instead of the QDeclarativeView, and "import QtQuick 2.0" instead of "import QtQuick 1.1"
Cheers,
_
askatuak (17th September 2013)
Thanks!!! the program works!!!
Added after 38 minutes:
How can I do, when I do fuction onclicked appered "Hellor world", but "Hellow wolrd" is in c++, for example:
onclicked: {
s.getstring()
}
onclicked:{
text: s.getstring()
}
text {
text:s.getstring()
}
onclicked:{
Text.visible=s.getstring()
}
All that thing are proved in code but they are not run. How can I do it?
Thanks!!!
Last edited by askatuak; 17th September 2013 at 14:59.
I press the qml rectangle.
These are instead travesties, misuses and abuses of the erotic lingerie's God-honoring purpose in life.
Bookmarks