Hi All,
As i am new to qt quick i'm in need of calling a function from qml to cpp file, I am not able to write code for this. I tried this code...
I am trying to add two numbers!!!I tried writing it in qml but could not get the result.. so i am looking to write a function for adding the nos. in the cpp file .
i would call from qml to cpp function...
QML CODE:
property string i;
property string j;
Button {
id: one
x: 59
y: 131
width: 41
height: 42
text: "1"
onClicked:
{
i = text
textfield.text = textfield.text + i
}
}
Button {
id: two
x: 119
y: 131
text: "2"
onClicked:
{
i = text
textfield.text = textfield.text + i
}
}
Button {
id: add
x: 247
y: 131
text: "+"
onClicked:
{
j = textfield.text
ans = j
textfield.text = ""
funct.buttonclicked()
property string i;
property string j;
Button {
id: one
x: 59
y: 131
width: 41
height: 42
text: "1"
onClicked:
{
i = text
textfield.text = textfield.text + i
}
}
Button {
id: two
x: 119
y: 131
text: "2"
onClicked:
{
i = text
textfield.text = textfield.text + i
}
}
Button {
id: add
x: 247
y: 131
text: "+"
onClicked:
{
j = textfield.text
ans = j
textfield.text = ""
funct.buttonclicked()
To copy to clipboard, switch view to plain text mode
CPP CODE:
void funct::buttonclicked()
{
s->show();
.....???
.....???
}
void funct::buttonclicked()
{
QString *s = new QString;
s->show();
.....???
.....???
}
To copy to clipboard, switch view to plain text mode
I am not able write from this!!!!
Thanks in advance and Regards,
Naufal.A
Bookmarks