I am building a plugin in a new window with table of contents associated. I have some actions, for example, zoom to extent and others and I want also to show the attribute table.
I search and find help in here How to show attribute table in the form, with this little code:
from PyQt4.QtGui import QApplication, QTableView
from qgis.gui import QgsAttributeTableModel
cache = QgsVectorLayerCache(self.view.currentLayer(), 10000)
model = QgsAttributeTableModel(cache)
model.loadLayer()
table = QTableView()
table.setModel(model)
table.show()
But this code doesn't show anything. Could you help me to understand what is wrong?
No comments:
Post a Comment