Reputation: 339
I have a simple code nothing crazy but i just can't figure out how i can sent information from ComboBox
to Python
. I know the connection between pyton and qml is good, becouse i can sent other strings to python from qml.
Thanks in advance
Funcy.py
@pyqtSlot(str)
def mail(self, dropdown):
print(dropdown) #should print Yes or No
Gui.qml
ComboBox
{
id: dropdown
// those are the options a user could choose
model: ["No", "Yes"]
}
Button
{
// some styling
onClicked
{
backend.mail(dropdown.text)
}
}
Upvotes: 1
Views: 64
Reputation: 244152
If you want to send the selected text from the ComboBox when the Button is pressed then you must send the currentText:
onClicked: backend.mail(dropdown.currentText)
Upvotes: 2