Skip to content

Commit

Permalink
Fix refresh of postgis schema in browser (#4400)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Oct 19, 2011
1 parent 5b89a32 commit b1e5038
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/providers/postgres/qgspostgresdataitems.cpp
Expand Up @@ -122,9 +122,16 @@ QgsPGSchemaItem::QgsPGSchemaItem( QgsDataItem* parent, QString name, QString pat
: QgsDataCollectionItem( parent, name, path )
{
mIcon = QIcon( getThemePixmap( "mIconDbSchema.png" ) );
mConnInfo = connInfo;
mLayerProperties = layerProperties;
populate();
}

QVector<QgsDataItem*> QgsPGSchemaItem::createChildren()
{
QVector<QgsDataItem*> children;
// Populate everything, it costs nothing, all info about layers is collected
foreach( QgsPostgresLayerProperty layerProperty, layerProperties )
foreach( QgsPostgresLayerProperty layerProperty, mLayerProperties )
{
QgsDebugMsg( "table: " + layerProperty.schemaName + "." + layerProperty.tableName );

Expand All @@ -149,11 +156,11 @@ QgsPGSchemaItem::QgsPGSchemaItem( QgsDataItem* parent, QString name, QString pat
}
}

QgsPGLayerItem * layer = new QgsPGLayerItem( this, layerProperty.tableName, mPath + "/" + layerProperty.tableName, connInfo, layerType, layerProperty );
mChildren.append( layer );
QgsPGLayerItem * layer = new QgsPGLayerItem( this, layerProperty.tableName, mPath + "/" + layerProperty.tableName, mConnInfo, layerType, layerProperty );
children.append( layer );
}

mPopulated = true;
return children;
}

QgsPGSchemaItem::~QgsPGSchemaItem()
Expand Down
6 changes: 6 additions & 0 deletions src/providers/postgres/qgspostgresdataitems.h
Expand Up @@ -48,6 +48,12 @@ class QgsPGSchemaItem : public QgsDataCollectionItem
QgsPGSchemaItem( QgsDataItem* parent, QString name, QString path,
QString connInfo, QVector<QgsPostgresLayerProperty> layerProperties );
~QgsPGSchemaItem();

QVector<QgsDataItem*> createChildren();

protected:
QString mConnInfo;
QVector<QgsPostgresLayerProperty> mLayerProperties;
};

class QgsPGRootItem : public QgsDataCollectionItem
Expand Down

0 comments on commit b1e5038

Please sign in to comment.