Navigation Menu

Skip to content

Commit

Permalink
[GRASS] data item fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Nov 18, 2014
1 parent 7d7ac62 commit eef435e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions python/core/qgsdataitem.sip
Expand Up @@ -30,6 +30,7 @@ class QgsDataItem : QObject
// Populate children using children vector created by createChildren()
virtual void populate();
bool isPopulated();
void setPopulated();

// Insert new child using alphabetical order based on mName, emits necessary signal to model before and after, sets parent and connects signals
// refresh - refresh populated item, emit signals to model
Expand All @@ -55,8 +56,6 @@ class QgsDataItem : QObject
// try to process the data dropped on this item
virtual bool handleDrop( const QMimeData * /*data*/, Qt::DropAction /*action*/ );

//

enum Capability
{
NoCapabilities,
Expand Down Expand Up @@ -162,7 +161,6 @@ class QgsDataCollectionItem : QgsDataItem
QgsDataCollectionItem( QgsDataItem* parent, QString name, QString path = QString::null );
~QgsDataCollectionItem();

void setPopulated();
void addChild( QgsDataItem *item /Transfer/ );

static const QIcon &iconDir(); // shared icon: open/closed directory
Expand Down
4 changes: 3 additions & 1 deletion src/core/qgsdataitem.h
Expand Up @@ -67,6 +67,9 @@ class CORE_EXPORT QgsDataItem : public QObject
virtual void populate( QVector<QgsDataItem*> children );
bool isPopulated() { return mPopulated; }

// Set as populated without populating
void setPopulated() { mPopulated = true; }

// Insert new child using alphabetical order based on mName, emits necessary signal to model before and after, sets parent and connects signals
// refresh - refresh populated item, emit signals to model
virtual void addChildItem( QgsDataItem *child, bool refresh = false );
Expand Down Expand Up @@ -221,7 +224,6 @@ class CORE_EXPORT QgsDataCollectionItem : public QgsDataItem
QgsDataCollectionItem( QgsDataItem* parent, QString name, QString path = QString::null );
~QgsDataCollectionItem();

void setPopulated() { mPopulated = true; }
void addChild( QgsDataItem *item ) { mChildren.append( item ); }

static const QIcon &iconDir(); // shared icon: open/closed directory
Expand Down
4 changes: 2 additions & 2 deletions src/providers/grass/qgsgrassprovidermodule.cpp
Expand Up @@ -132,7 +132,7 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
{
/* This may happen (one layer only) in GRASS 7 with points (no topo layers) */
QgsLayerItem *layer = new QgsLayerItem( this, name + " " + baseLayerName, path, uri, layerType, "grass" );
layer->populate(); // does nothing, but sets mPopulated to true to show non expandable in browser
layer->setPopulated();
items.append( layer );
}
else
Expand All @@ -154,7 +154,7 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
QgsDebugMsg( "uri = " + uri );

QgsLayerItem *layer = new QgsLayerItem( this, name, path, uri, QgsLayerItem::Raster, "grassraster" );
layer->populate(); // does nothing, but sets mPopulated to true to show non expandable in browser
layer->setPopulated();

items.append( layer );
}
Expand Down

0 comments on commit eef435e

Please sign in to comment.