Skip to content

Commit

Permalink
uglily find qgisapp for attribute table, fixes #786
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7613 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Nov 20, 2007
1 parent 73e2713 commit 30758ae
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/app/legend/qgslegendlayerfile.cpp
Expand Up @@ -243,9 +243,23 @@ void QgsLegendLayerFile::table()
{
// display the attribute table
QApplication::setOverrideCursor(Qt::waitCursor);

// TODO: pointer to QgisApp should be passed instead of NULL
// but we don't have pointer to it. [MD]
mTableDisplay = new QgsAttributeTableDisplay(vlayer, NULL);
// but be can get it using this ugly hack. [jef]
// TODO: do this cleanly
QgisApp *app = NULL;
QList<QWidget *> list = QApplication::topLevelWidgets();

int i;
for(i=0; i<list.size(); i++)
if( list[i]->windowTitle().startsWith("Quantum GIS") )
{
app=reinterpret_cast<QgisApp*>(list[i]);
break;
}

mTableDisplay = new QgsAttributeTableDisplay(vlayer, app);
mTableDisplay->table()->fillTable(vlayer);
mTableDisplay->table()->setSorting(true);

Expand Down

0 comments on commit 30758ae

Please sign in to comment.