# Declare instance attributes
self.actions = []
self.menu = self.tr(u'&City_searcher_plugin')
# TODO: We are going to let the user set this up in a future iteration
self.toolbar = self.iface.addToolBar(u'city_searcher_class')
QObject.connect(self.dlg.Statecombo, SIGNAL("currentIndexChanged(int)"), self.findTheCityNames)
QObject.connect(self.dlg.Citycombo, SIGNAL("currentIndexChanged(int)"), self.calcDistance)
QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("accepted()")), self.buffer)
#QObject.connect(self.dlg.browsepushButton, SIGNAL("clicked()"), self.saveTheFile)

In the above snippet, I used fromUtf8. But it is saying an error fromUtf8 is not defined. Where should I import fromUtf8 like from qtgui or qtcore?

  • Most welcome Ahamed! I will post the above comment as an answer for the convenience of others. – Joseph Feb 20 '15 at 10:50

You can apply the following code to define fromUtf8 which was taken from the QGIS Workshop describing how to use PyQT for QGIS:

_fromUtf8 = QtCore.QString.fromUtf8
  • No worries buddy :) – Joseph Feb 20 '15 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.