python 3.x - PyQt: QDataWidgetMapper doesn't show any data in widgets -


i have abstractitemmodel want map widgets. in constructor of window have:

    print("creating model")     self.model = model(self.cluster)     print("creating mapper")     self.mapper = qtgui.qdatawidgetmapper()     print("setting model")     self.mapper.setmodel(self.model)     print("setting root index")     self.mapper.setrootindex(self.model.root_index())     print("setting index")     self.mapper.setcurrentindex(0)     print("mapping widgets")     self.mapper.addmapping(self.realnamelineedit, 1)     self.mapper.addmapping(self.emaillineedit, 2)     self.mapper.addmapping(self.infoplaintextedit, 3)     print("done") 

this results in following output:

creating model model.__init__() model.rowcount(<pyside.qtcore.qmodelindex(0,0,0x7faa2ff446a0,model(0x17c6f50) )   @ 0x7faa2d9ea4c8>) = 0 model.rowcount(<pyside.qtcore.qmodelindex(0,0,0x7faa2ff446a0,model(0x17c6f50) )   @ 0x7faa2d9d2888>) = 1 creating mapper setting model setting root index model.root_index() setting index model.rowcount(<pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2ff50d08>) = 2 model.index(0, 0, <pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2ff50d08>) model.rowcount(<pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2d9ea608>) = 2 model.columncount(<pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2d9ea608>) = 4 mapping widgets model.index(0, 1, <pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2ff50d08>) model.rowcount(<pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2d9ea608>) = 2 model.columncount(<pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2d9ea608>) = 4 model.index(0, 2, <pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2ff50d08>) model.rowcount(<pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2d9ea608>) = 2 model.columncount(<pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2d9ea608>) = 4 model.index(0, 3, <pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2ff50d08>) model.rowcount(<pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2d9ea608>) = 2 model.columncount(<pyside.qtcore.qmodelindex(-1,-1,0x0,qobject(0x0) )  @ 0x7faa2d9ea608>) = 4 done 

for me looks correct far. none of mapped widgets display data. model.data() isn't called @ (i have print there too).

when enter in realnamelineedit , press return get:

model.setdata(<pyside.qtcore.qmodelindex(0,1,0x7faa2da31908,model(0x17c6f50) )   @ 0x7faa2d9eadc8>, real name, 2) 

looks editing goes through mapper model correctly. why doesn't displaying?

copying comments sake of completeness: mapper.to first(), mapper.setcurrentindex() or similar must called after column mappings established mappings show data.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -