<html><head><meta http-equiv="Content-Type" content="text/html charset=gb2312"><meta http-equiv="Content-Type" content="text/html charset=gb2312"><meta http-equiv="Content-Type" content="text/html charset=gb2312"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hello all.</div><div class=""><br class=""></div><div class="">This is my third time to send this email to you, I can¡¯t solve the problem, I really want someone can help me, thanks.</div><div class=""><br class=""></div><div class="">I¡¯m now working on a personal GIS project, I want to use some features of QGis. Now I meet a wired thing that I can¡¯t initialize the attribute dialog of a vector layer well, I¡¯m writing to you to see if someone can help me. Thanks.</div><div class=""><br class=""></div><div class="">The code is simple, I paste them here</div><div class=""><br class=""></div><div class=""><div class="">void qgis_dev::openAttributeTableDialog()</div><div class="">{</div><div class=""> QgsVectorLayer* mylayer = qobject_cast<QgsVectorLayer*>( activeLayer() );</div><div class=""> if ( !mylayer ) { return; }</div><div class=""> </div><div class=""> QgsVectorLayerCache* lc = new QgsVectorLayerCache( mylayer, mylayer->featureCount() );</div><div class=""> QgsAttributeTableView* tv = new QgsAttributeTableView();</div><div class=""> QgsAttributeTableModel* tm = new QgsAttributeTableModel( lc, this );</div><div class=""><br class=""></div><div class=""> QgsAttributeTableFilterModel* tfm = new QgsAttributeTableFilterModel( new QgsMapCanvas(), tm, tm );</div><div class=""><br class=""></div><div class=""> tfm->setFilterMode( QgsAttributeTableFilterModel::ShowAll );</div><div class=""> tm->loadLayer();</div><div class=""> tv->setModel( tfm );</div><div class=""> tv->show();</div><div class="">}</div></div><div class=""><br class=""></div><div class="">and the result is like this, there are no attributes in the form, but the feature count is right.</div><div class=""><br class=""></div><div class=""><img apple-inline="yes" id="13345692-2225-453B-8D12-9F4D833CCBDF" height="266" width="240" apple-width="yes" apple-height="yes" class="" src="cid:F544CC8F-A474-4AAE-8CC3-7E2B54317023"></div><div class=""><br class=""></div><div class="">However, when I paste these code into QGis source code and compile the project, I get the right result. I don¡¯t know where I am wrong.</div><div class=""><br class=""></div><div class=""><br class=""></div>Really hope to get some help.<br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thank you!<br class=""><br class=""></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><a href="mailto:jacorygao@outlook.com" class="">jacorygao@outlook.com</a></div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">=========================<br class=""><br class=""><br class=""><br class=""></div></div>
</div>
<br class="">_______________________________________________<br class="">Qgis-developer mailing list<br class=""><a href="mailto:Qgis-developer@lists.osgeo.org" class="">Qgis-developer@lists.osgeo.org</a><br class="">List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" class="">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br class="">Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer_______________________________________________" class="">http://lists.osgeo.org/mailman/listinfo/qgis-developer_______________________________________________</a><br class="">Qgis-developer mailing list<br class=""><a href="mailto:Qgis-developer@lists.osgeo.org" class="">Qgis-developer@lists.osgeo.org</a><br class="">List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer<br class="">Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer</body></html>