[PyQt] Qt connect and first connect or unicode

Mohsen Pahlevanzadeh mohsen at pahlevanzadeh.org
Wed Sep 18 04:43:00 BST 2013


On Tue, 2013-09-17 at 09:07 +0430, Mohsen Pahlevanzadeh wrote:
> Dear all,
> 
> Unfortunately, i confused and need help... the following code is:
> ###################################################
> ##CheckBox:
>     QtCore.QObject.connect(self.checkBox,
> QtCore.SIGNAL(_fromUtf8("toggled(bool)")), lambda:
> self.materialsInstance.setFilterDict("C",self,"name",self.lineEdit.text()))
> 
>         QtCore.QObject.connect(self.checkBox_2,
> QtCore.SIGNAL(_fromUtf8("toggled(bool)")), lambda:
> self.materialsInstance.setFilterDict("C",self,"bought_price",persianToInteger(unicode(self.lineEdit_2.text()))))
> 
>         QtCore.QObject.connect(self.checkBox_4,
> QtCore.SIGNAL(_fromUtf8("toggled(bool)")), lambda:
> self.materialsInstance.setFilterDict("C",self,"stock",persianToInteger(unicode(self.lineEdit_3.text()))))
> 
> ##LineEdit
>         QtCore.QObject.connect(self.lineEdit,
> QtCore.SIGNAL(_fromUtf8("editingFinished()")), lambda:
> self.materialsInstance.setFilterDict("L",self,"name",self.lineEdit.text()))
> 
>         QtCore.QObject.connect(self.lineEdit_2,
> QtCore.SIGNAL(_fromUtf8("editingFinished()")), lambda:
> self.materialsInstance.setFilterDict("L",self,"bought_price",persianToInteger(unicode(self.lineEdit_2.text()))))
> 
>         QtCore.QObject.connect(self.lineEdit_3,
> QtCore.SIGNAL(_fromUtf8("editingFinished()")), lambda:
> self.materialsInstance.setFilterDict("L",self,"stock",persianToInteger(unicode(self.lineEdit_3.text()))))        
> 
>         QtCore.QObject.connect(self.lineEdit,
> QtCore.SIGNAL(_fromUtf8("editingFinished()")), lambda:
> self.materialsInstance.responseToRequestForData(self))
> 
>         QtCore.QObject.connect(self.lineEdit_2,
> QtCore.SIGNAL(_fromUtf8("editingFinished()")), lambda:
> self.materialsInstance.responseToRequestForData(self))
> 
>         QtCore.QObject.connect(self.lineEdit_3,
> QtCore.SIGNAL(_fromUtf8("editingFinished()")), lambda:
> self.materialsInstance.responseToRequestForData(self))        
> 
>         QtCore.QObject.connect(self.lineEdit,
> QtCore.SIGNAL(_fromUtf8("returnPressed()")), lambda:
> self.materialsInstance.responseToRequestForData(self))
> 
>         QtCore.QObject.connect(self.lineEdit_2,
> QtCore.SIGNAL(_fromUtf8("returnPressed()")), lambda:
> self.materialsInstance.responseToRequestForData(self))
> 
>         QtCore.QObject.connect(self.lineEdit_3,
> QtCore.SIGNAL(_fromUtf8("returnPressed()")), lambda:
> self.materialsInstance.responseToRequestForData(self))        
> 
> ##PushButton:
>         QtCore.QObject.connect(self.pushButtonSearch,
> QtCore.SIGNAL(_fromUtf8("clicked()")), lambda:
> self.materialsInstance.responseToRequestForData(self))
> 
> 
> 
>     def setFilterDict(self,widget,obj,field,lineEditContent):
>         if field not in obj.materialsInstance.filterNameDict.keys():
> 
> obj.materialsInstance.filterNameDict.update({field:lineEditContent})
> 
> 
> ####################################################
> Description:
> I have 3 widget:
> 1. CheckBox:  a. name b. bought_price c. stock
> 2. LineEdit : a. name b. bought_price c. stock
> 3. One PushButton
> 
> i have three slot: 1. responseToRequestForData()  2.setFilterDict()
> 3.unSetFilterDict()
> responseToRequestForData(): start to search in DB
> setFilterDict(): fill a dict from my LineEdit
> 
> Problem:
> My name is filled in dict but its value doesn't fill up. b and c don't
> have any problem.
> 
> I get the following output in console:
> {'stock': 2, 'name': PyQt4.QtCore.QString(u''), 'bought_price': 23}
> 
> Yours,
> Mohsen
> 
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

i solved, I didn't think Qt hard up.i change priority of connect in my
script and every thing was OK. ohhhh day of hard code....Thanks GOD.




More information about the PyQt mailing list