[PyQt] Empty string converted to 0.0 using pyqtSlot

Kálmán Viktor viktorvector at gmail.com
Mon Sep 17 19:44:46 BST 2018


Hello,

this code produces the following output

Python snippet
@pyqtSlot(float)
def xy(self, amount):
    print("am", amount)

QML snippet
print(amountInput.text, amountInput.text === "")
controller.xy(amountInput.text)

Output
qml:  true
am 0.0

Is this intentional? If I use any other string than "" I get (I think the
correct) nan. I'm using PyQt5==5.11.2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180917/8c743ced/attachment.html>


More information about the PyQt mailing list