[PyQt] Casting from QSettings

lokev modern.zamurai at gmail.com
Wed Nov 25 16:36:10 GMT 2009


Hi Guys .. PyQt-noob .. and this is driving me nuts .. probably easy to sort
though ..

So I'm saving ints in a QSettings instance .. like this ..
def closeEvent(self, event):
    settings = QSettings()
    settings.setValue("MoneySpent", self.moneySpent)
    
and I'm loading this in init ..

def __init__(self, parent=None):
    settings = QSettings()
    self.moneySpent = settings.value("MoneySpent", 0).toInt()

but then the type of self.moneySpent is a tuple, not an int, so when i later
try

    self.moneySpent += 50

i get:
TypeError: can only concatenate tuple (not "int") to tuple ...

... soooo ? Why does "settings.value("MoneySpent", 0).toInt()" set the type
of self.moneySpent to tuple .... ?

I appreciate any help i can get to sort this out .. :)

- lokev


-- 
View this message in context: http://old.nabble.com/Casting-from-QSettings-tp26467897p26467897.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list