From eef435e979bdc455bc7bc0ffd57518974af257c5 Mon Sep 17 00:00:00 2001 From: Radim Blazek Date: Tue, 18 Nov 2014 13:39:46 +0100 Subject: [PATCH] [GRASS] data item fix --- python/core/qgsdataitem.sip | 4 +--- src/core/qgsdataitem.h | 4 +++- src/providers/grass/qgsgrassprovidermodule.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/core/qgsdataitem.sip b/python/core/qgsdataitem.sip index 2a71e6c03f6..e0141e72f6c 100644 --- a/python/core/qgsdataitem.sip +++ b/python/core/qgsdataitem.sip @@ -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 @@ -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, @@ -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 diff --git a/src/core/qgsdataitem.h b/src/core/qgsdataitem.h index b4e8d647eb9..fc11365c031 100644 --- a/src/core/qgsdataitem.h +++ b/src/core/qgsdataitem.h @@ -67,6 +67,9 @@ class CORE_EXPORT QgsDataItem : public QObject virtual void populate( QVector 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 ); @@ -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 diff --git a/src/providers/grass/qgsgrassprovidermodule.cpp b/src/providers/grass/qgsgrassprovidermodule.cpp index 530bd3aab7b..e16bf29bf0b 100644 --- a/src/providers/grass/qgsgrassprovidermodule.cpp +++ b/src/providers/grass/qgsgrassprovidermodule.cpp @@ -132,7 +132,7 @@ QVector 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 @@ -154,7 +154,7 @@ QVector 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 ); }