I am working with python plugins for QGIS same as rt sql layer.I developed the plugin and copied into local repository *C:\Documents and Settings\comp90.qgis\python\plugins*. When i open QGIS exe,connection is established ans all the tables are listed.But when i try to open my query builder form,it gives me error saying

QDialog.__init__(self, parent)
TypeError: QDialog(QWidget parent=None, Qt.WindowFlags flags=0): argument 1 has unexpected 
type 'QgisInterface'

My code of query builder form is a follows:

class DlgQueryBuilder(QDialog, Ui_Dialog):
    def __init__(self,db=conn, iface=None, parent=None):


            QDialog.__init__(self, parent)

            self.setupUi(self)

            self.db = db

What is QgisInterface?? help me out...!!

this form is called from ManagerWindow.py file as below:

def queryWindow(self):
            """ show sql window """
            dlg = DlgQueryBuilder(self, self.db, self.iface)
            if dlg.exec_():
                    self.close()
有帮助吗?

解决方案

You don't pass self when creating an object:

dlg = DlgQueryBuilder(self.db, self.iface)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top