[PyQt] PyKDE4 OpenUrlArguments metaData ( QMap ) is uneditable

Phil Thompson phil at riverbankcomputing.com
Wed Feb 13 09:45:31 GMT 2013


On Wed, 13 Feb 2013 00:51:05 +0100, "Daniel Nagy" <DanielNagy at gmx.de>
wrote:
> Hi, 
> 
> there is a PyKDE4-datatype at
> http://api.kde.org/pykde-4.7-api/kparts/KParts.OpenUrlArguments.html 
> and I don't seem to be able to modify the QMap "metaData" property.
> From C++ you can easily do that, but not from python.
> Here is how you can reproduce this issue:
> 
> $ python
>>>> from PyKDE4.kparts import KParts
>>>> oua = KParts.OpenUrlArguments()
>>>> oua.metaData()["prop1"] = "val1"
>>>> oua.metaData()
> {}
>>>>
> 
> So the QMap metaData remains empty. Do you have any hint on how I can
edit
> this from within python?
> I am using Python 2.7.3.

I don't use PyKDE so this is a guess. The QMap is converted to a dict
which is what you are updating. The QMap is never updated from the dict.
There needs to be a separate API call (either real or added specifically to
PyKDE) to do this, eg

meta_data = oua.metaData()
meta_data["prop1"] = "val"
oua.setMetaData(meta_data)

...or...

oua.setMetaData("prop1", "val")

Phil


More information about the PyQt mailing list