[GRASS] data item fix

This commit is contained in:
Radim Blazek 2014-11-18 13:39:46 +01:00
parent 7d7ac62f67
commit eef435e979
3 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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 );
@ -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

View File

@ -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
@ -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 );
}