[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] QString mutable, unicode string immutable
From: Wolfgang Rohdewald <wolfgang () rohdewald ! de>
Date: 2009-02-26 21:58:35
Message-ID: 200902262258.36751.wolfgang () rohdewald ! de
[Download RAW message or body]
Hi,
I just found out the hard way what the subject says
Now I am curious: The PyQt roadmap says that non-pythonic classes
like QString will be removed. So the result of some Qt/KDE methods
will no longer return a mutable result but an immutable result.
Could this not break code that relies on the result being mutable?
This is the concrete case I had:
In a class derived from kdeui.KConfigSkeleton:
(this code is edited to a minimum, might not run)
self._value = QString()
self.configValue = self.addItemString('value',self._value,QString('default'))
after the config dialog I save the new value elsewhere:
saveValue = config.configValue.value()
now saveValue is a QString
after next config dialog I check if the value changed:
if saveValue != config.configValue.value():
self.applyChanges()
but since theye are QStrings, they are always identical -
the config dialog also changes my saveValue.
of course the solution is simple: saveValue = str(config.configValue.value())
--
Wolfgang
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic