QGIS API Documentation  2.99.0-Master (b058df7)
qgsbrowsermodel.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsbrowsermodel.cpp
3  ---------------------
4  begin : July 2011
5  copyright : (C) 2011 by Martin Dobias
6  email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #include <QDir>
16 #include <QApplication>
17 #include <QStyle>
18 #include <QtConcurrentMap>
19 #include <QUrl>
20 
21 #include "qgis.h"
22 #include "qgsapplication.h"
23 #include "qgsdataitemprovider.h"
25 #include "qgsdataprovider.h"
26 #include "qgsmimedatautils.h"
27 #include "qgslogger.h"
28 #include "qgsproviderregistry.h"
29 #include "qgsbrowsermodel.h"
30 #include "qgsproject.h"
31 #include "qgssettings.h"
32 
34  : mItem( item )
35 {
36 }
37 
38 // sort function for QList<QgsDataItem*>, e.g. sorted/grouped provider listings
39 static bool cmpByDataItemName_( QgsDataItem *a, QgsDataItem *b )
40 {
41  return QString::localeAwareCompare( a->name(), b->name() ) < 0;
42 }
43 
45  : QAbstractItemModel( parent )
46 
47 {
48 }
49 
51 {
53 }
54 
56 {
57  QString home = QgsProject::instance()->homePath();
58  if ( mProjectHome && mProjectHome->path() == home )
59  return;
60 
61  int idx = mRootItems.indexOf( mProjectHome );
62 
63  // using layoutAboutToBeChanged() was messing expanded items
64  if ( idx >= 0 )
65  {
66  beginRemoveRows( QModelIndex(), idx, idx );
67  mRootItems.remove( idx );
68  endRemoveRows();
69  }
70  delete mProjectHome;
71  mProjectHome = home.isNull() ? nullptr : new QgsDirectoryItem( nullptr, tr( "Project home" ), home, "project:" + home );
72  if ( mProjectHome )
73  {
75 
76  beginInsertRows( QModelIndex(), 0, 0 );
77  mRootItems.insert( 0, mProjectHome );
78  endInsertRows();
79  }
80 }
81 
83 {
85 
86  // give the home directory a prominent second place
87  QgsDirectoryItem *item = new QgsDirectoryItem( nullptr, tr( "Home" ), QDir::homePath(), "home:" + QDir::homePath() );
88  QStyle *style = QApplication::style();
89  QIcon homeIcon( style->standardPixmap( QStyle::SP_DirHomeIcon ) );
90  item->setIcon( homeIcon );
91  connectItem( item );
92  mRootItems << item;
93 
94  // add favorite directories
95  mFavorites = new QgsFavoritesItem( nullptr, tr( "Favorites" ) );
96  if ( mFavorites )
97  {
100  }
101 
102  // add drives
103  Q_FOREACH ( const QFileInfo &drive, QDir::drives() )
104  {
105  QString path = drive.absolutePath();
106 
107  if ( QgsDirectoryItem::hiddenPath( path ) )
108  continue;
109 
110  QgsDirectoryItem *item = new QgsDirectoryItem( nullptr, path, path );
111 
112  connectItem( item );
113  mRootItems << item;
114  }
115 
116 #ifdef Q_OS_MAC
117  QString path = QString( "/Volumes" );
118  QgsDirectoryItem *vols = new QgsDirectoryItem( nullptr, path, path );
119  connectItem( vols );
120  mRootItems << vols;
121 #endif
122 
123  // container for displaying providers as sorted groups (by QgsDataProvider::DataCapability enum)
124  QMap<int, QgsDataItem *> providerMap;
125 
126  Q_FOREACH ( QgsDataItemProvider *pr, QgsApplication::dataItemProviderRegistry()->providers() )
127  {
128  int capabilities = pr->capabilities();
129  if ( capabilities == QgsDataProvider::NoDataCapabilities )
130  {
131  QgsDebugMsgLevel( pr->name() + " does not have any dataCapabilities", 4 );
132  continue;
133  }
134 
135  QgsDataItem *item = pr->createDataItem( QLatin1String( "" ), nullptr ); // empty path -> top level
136  if ( item )
137  {
138  // Forward the signal from the root items to the model (and then to the app)
140  QgsDebugMsgLevel( "Add new top level item : " + item->name(), 4 );
141  connectItem( item );
142  providerMap.insertMulti( capabilities, item );
143  }
144  }
145 
146  // add as sorted groups by QgsDataProvider::DataCapability enum
147  Q_FOREACH ( int key, providerMap.uniqueKeys() )
148  {
149  QList<QgsDataItem *> providerGroup = providerMap.values( key );
150  if ( providerGroup.size() > 1 )
151  {
152  std::sort( providerGroup.begin(), providerGroup.end(), cmpByDataItemName_ );
153  }
154 
155  Q_FOREACH ( QgsDataItem *ditem, providerGroup )
156  {
157  mRootItems << ditem;
158  }
159  }
160 }
161 
163 {
164  Q_FOREACH ( QgsDataItem *item, mRootItems )
165  {
166  delete item;
167  }
168 
169  mRootItems.clear();
170 }
171 
173 {
174  if ( ! mInitialized )
175  {
178  addRootItems();
179  mInitialized = true;
180  }
181 }
182 
183 
184 Qt::ItemFlags QgsBrowserModel::flags( const QModelIndex &index ) const
185 {
186  if ( !index.isValid() )
187  return Qt::ItemFlags();
188 
189  Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
190 
191  QgsDataItem *ptr = reinterpret_cast< QgsDataItem * >( index.internalPointer() );
192  if ( ptr->hasDragEnabled() )
193  flags |= Qt::ItemIsDragEnabled;
194 
195  if ( ptr->acceptDrop() )
196  flags |= Qt::ItemIsDropEnabled;
197  return flags;
198 }
199 
200 QVariant QgsBrowserModel::data( const QModelIndex &index, int role ) const
201 {
202  if ( !index.isValid() )
203  return QVariant();
204 
205  QgsDataItem *item = dataItem( index );
206  if ( !item )
207  {
208  return QVariant();
209  }
210  else if ( role == Qt::DisplayRole )
211  {
212  return item->name();
213  }
214  else if ( role == Qt::ToolTipRole )
215  {
216  return item->toolTip();
217  }
218  else if ( role == Qt::DecorationRole && index.column() == 0 )
219  {
220  return item->icon();
221  }
222  else if ( role == QgsBrowserModel::PathRole )
223  {
224  return item->path();
225  }
226  else if ( role == QgsBrowserModel::CommentRole )
227  {
228  if ( item->type() == QgsDataItem::Layer )
229  {
230  QgsLayerItem *lyrItem = qobject_cast<QgsLayerItem *>( item );
231  return lyrItem->comments();
232  }
233  return QVariant();
234  }
235  else
236  {
237  // unsupported role
238  return QVariant();
239  }
240 }
241 
242 QVariant QgsBrowserModel::headerData( int section, Qt::Orientation orientation, int role ) const
243 {
244  Q_UNUSED( section );
245  if ( orientation == Qt::Horizontal && role == Qt::DisplayRole )
246  {
247  return QVariant( "header" );
248  }
249 
250  return QVariant();
251 }
252 
253 int QgsBrowserModel::rowCount( const QModelIndex &parent ) const
254 {
255  //QgsDebugMsg(QString("isValid = %1 row = %2 column = %3").arg(parent.isValid()).arg(parent.row()).arg(parent.column()));
256 
257  if ( !parent.isValid() )
258  {
259  // root item: its children are top level items
260  return mRootItems.count(); // mRoot
261  }
262  else
263  {
264  // ordinary item: number of its children
265  QgsDataItem *item = dataItem( parent );
266  //if ( item ) QgsDebugMsg(QString("path = %1 rowCount = %2").arg(item->path()).arg(item->rowCount()) );
267  return item ? item->rowCount() : 0;
268  }
269 }
270 
271 bool QgsBrowserModel::hasChildren( const QModelIndex &parent ) const
272 {
273  if ( !parent.isValid() )
274  return true; // root item: its children are top level items
275 
276  QgsDataItem *item = dataItem( parent );
277  return item && item->hasChildren();
278 }
279 
280 int QgsBrowserModel::columnCount( const QModelIndex &parent ) const
281 {
282  Q_UNUSED( parent );
283  return 1;
284 }
285 
286 QModelIndex QgsBrowserModel::findPath( const QString &path, Qt::MatchFlag matchFlag )
287 {
288  return findPath( this, path, matchFlag );
289 }
290 
291 QModelIndex QgsBrowserModel::findPath( QAbstractItemModel *model, const QString &path, Qt::MatchFlag matchFlag )
292 {
293  if ( !model )
294  return QModelIndex();
295 
296  QModelIndex index; // starting from root
297  bool foundChild = true;
298 
299  while ( foundChild )
300  {
301  foundChild = false; // assume that the next child item will not be found
302 
303  for ( int i = 0; i < model->rowCount( index ); i++ )
304  {
305  QModelIndex idx = model->index( i, 0, index );
306 
307  QString itemPath = model->data( idx, PathRole ).toString();
308  if ( itemPath == path )
309  {
310  QgsDebugMsgLevel( "Arrived " + itemPath, 4 );
311  return idx; // we have found the item we have been looking for
312  }
313 
314  // paths are slash separated identifier
315  if ( path.startsWith( itemPath + '/' ) )
316  {
317  foundChild = true;
318  index = idx;
319  break;
320  }
321  }
322  }
323 
324  if ( matchFlag == Qt::MatchStartsWith )
325  return index;
326 
327  QgsDebugMsgLevel( "path not found", 4 );
328  return QModelIndex(); // not found
329 }
330 
332 {
333  // TODO: put items creating currently children in threads to deleteLater (does not seem urget because reload() is not used in QGIS)
334  beginResetModel();
335  removeRootItems();
336  addRootItems();
337  endResetModel();
338 }
339 
340 QModelIndex QgsBrowserModel::index( int row, int column, const QModelIndex &parent ) const
341 {
342  if ( column < 0 || column >= columnCount() || row < 0 )
343  return QModelIndex();
344 
345  QgsDataItem *p = dataItem( parent );
346  const QVector<QgsDataItem *> &items = p ? p->children() : mRootItems;
347  QgsDataItem *item = items.value( row, nullptr );
348  return item ? createIndex( row, column, item ) : QModelIndex();
349 }
350 
351 QModelIndex QgsBrowserModel::parent( const QModelIndex &index ) const
352 {
353  QgsDataItem *item = dataItem( index );
354  if ( !item )
355  return QModelIndex();
356 
357  return findItem( item->parent() );
358 }
359 
361 {
362  const QVector<QgsDataItem *> &items = parent ? parent->children() : mRootItems;
363 
364  for ( int i = 0; i < items.size(); i++ )
365  {
366  if ( items[i] == item )
367  return createIndex( i, 0, item );
368 
369  QModelIndex childIndex = findItem( item, items[i] );
370  if ( childIndex.isValid() )
371  return childIndex;
372  }
373 
374  return QModelIndex();
375 }
376 
378 {
379  QgsDebugMsgLevel( "parent mPath = " + parent->path(), 3 );
380  QModelIndex idx = findItem( parent );
381  if ( !idx.isValid() )
382  return;
383  QgsDebugMsgLevel( "valid", 3 );
384  beginInsertRows( idx, first, last );
385  QgsDebugMsgLevel( "end", 3 );
386 }
388 {
389  QgsDebugMsgLevel( "Entered", 3 );
390  endInsertRows();
391 }
393 {
394  QgsDebugMsgLevel( "parent mPath = " + parent->path(), 3 );
395  QModelIndex idx = findItem( parent );
396  if ( !idx.isValid() )
397  return;
398  beginRemoveRows( idx, first, last );
399 }
401 {
402  QgsDebugMsgLevel( "Entered", 3 );
403  endRemoveRows();
404 }
406 {
407  QgsDebugMsgLevel( "Entered", 3 );
408  QModelIndex idx = findItem( item );
409  if ( !idx.isValid() )
410  return;
411  emit dataChanged( idx, idx );
412 }
414 {
415  if ( !item )
416  return;
417  QModelIndex idx = findItem( item );
418  if ( !idx.isValid() )
419  return;
420  QgsDebugMsgLevel( QString( "item %1 state changed %2 -> %3" ).arg( item->path() ).arg( oldState ).arg( item->state() ), 4 );
421  emit stateChanged( idx, oldState );
422 }
423 
425 {
426  connect( item, &QgsDataItem::beginInsertItems,
428  connect( item, &QgsDataItem::endInsertItems,
430  connect( item, &QgsDataItem::beginRemoveItems,
432  connect( item, &QgsDataItem::endRemoveItems,
434  connect( item, &QgsDataItem::dataChanged,
436  connect( item, &QgsDataItem::stateChanged,
438 
439  // if it's a collection item, also forwards connectionsChanged
440  QgsDataCollectionItem *collectionItem = dynamic_cast<QgsDataCollectionItem *>( item );
441  if ( collectionItem )
443 }
444 
445 QStringList QgsBrowserModel::mimeTypes() const
446 {
447  QStringList types;
448  // In theory the mime type convention is: application/x-vnd.<vendor>.<application>.<type>
449  // but it seems a bit over formalized. Would be an application/x-qgis-uri better?
450  types << QStringLiteral( "application/x-vnd.qgis.qgis.uri" );
451  return types;
452 }
453 
454 QMimeData *QgsBrowserModel::mimeData( const QModelIndexList &indexes ) const
455 {
457  Q_FOREACH ( const QModelIndex &index, indexes )
458  {
459  if ( index.isValid() )
460  {
461  QgsDataItem *ptr = reinterpret_cast< QgsDataItem * >( index.internalPointer() );
462  if ( ptr->type() == QgsDataItem::Project )
463  {
464  QMimeData *mimeData = new QMimeData();
465  QUrl url = QUrl::fromLocalFile( ptr->path() );
466  QList<QUrl> urls;
467  urls << url;
468  mimeData->setUrls( urls );
469  return mimeData;
470  }
471 
472  QgsMimeDataUtils::Uri uri = ptr->mimeUri();
473  if ( uri.isValid() )
474  lst.append( uri );
475  }
476  }
477  return QgsMimeDataUtils::encodeUriList( lst );
478 }
479 
480 bool QgsBrowserModel::dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent )
481 {
482  Q_UNUSED( row );
483  Q_UNUSED( column );
484 
485  QgsDataItem *destItem = dataItem( parent );
486  if ( !destItem )
487  {
488  QgsDebugMsgLevel( "DROP PROBLEM!", 4 );
489  return false;
490  }
491 
492  return destItem->handleDrop( data, action );
493 }
494 
495 QgsDataItem *QgsBrowserModel::dataItem( const QModelIndex &idx ) const
496 {
497  void *v = idx.internalPointer();
498  QgsDataItem *d = reinterpret_cast<QgsDataItem *>( v );
499  Q_ASSERT( !v || d );
500  return d;
501 }
502 
503 bool QgsBrowserModel::canFetchMore( const QModelIndex &parent ) const
504 {
505  QgsDataItem *item = dataItem( parent );
506  // if ( item )
507  // QgsDebugMsg( QString( "path = %1 canFetchMore = %2" ).arg( item->path() ).arg( item && ! item->isPopulated() ) );
508  return ( item && item->state() == QgsDataItem::NotPopulated );
509 }
510 
511 void QgsBrowserModel::fetchMore( const QModelIndex &parent )
512 {
513  QgsDataItem *item = dataItem( parent );
514 
515  if ( !item || item->state() == QgsDataItem::Populating || item->state() == QgsDataItem::Populated )
516  return;
517 
518  QgsDebugMsgLevel( "path = " + item->path(), 4 );
519 
520  item->populate();
521 }
522 
523 /* Refresh dir path */
524 void QgsBrowserModel::refresh( const QString &path )
525 {
526  QModelIndex index = findPath( path );
527  refresh( index );
528 }
529 
530 /* Refresh item */
531 void QgsBrowserModel::refresh( const QModelIndex &index )
532 {
533  QgsDataItem *item = dataItem( index );
534  if ( !item || item->state() == QgsDataItem::Populating )
535  return;
536 
537  QgsDebugMsgLevel( "Refresh " + item->path(), 4 );
538 
539  item->refresh();
540 }
541 
542 void QgsBrowserModel::addFavoriteDirectory( const QString &directory )
543 {
544  Q_ASSERT( mFavorites );
545  mFavorites->addDirectory( directory );
546 }
547 
548 void QgsBrowserModel::removeFavorite( const QModelIndex &index )
549 {
550  QgsDirectoryItem *item = dynamic_cast<QgsDirectoryItem *>( dataItem( index ) );
551  if ( !item )
552  return;
553 
554  mFavorites->removeDirectory( item );
555 }
556 
558 {
559  QgsSettings settings;
560  QStringList hiddenItems = settings.value( QStringLiteral( "browser/hiddenPaths" ),
561  QStringList() ).toStringList();
562  int idx = hiddenItems.indexOf( item->path() );
563  if ( idx != -1 )
564  {
565  hiddenItems.removeAt( idx );
566  }
567  else
568  {
569  hiddenItems << item->path();
570  }
571  settings.setValue( QStringLiteral( "browser/hiddenPaths" ), hiddenItems );
572  if ( item->parent() )
573  {
574  item->parent()->deleteChildItem( item );
575  }
576  else
577  {
578  int i = mRootItems.indexOf( item );
579  beginRemoveRows( QModelIndex(), i, i );
580  mRootItems.remove( i );
581  item->deleteLater();
582  endRemoveRows();
583  }
584 }
A Collection: logical collection of layers or subcollections, e.g.
Definition: qgsdataitem.h:475
void beginInsertItems(QgsDataItem *parent, int first, int last)
QString path() const
Definition: qgsdataitem.h:253
bool canFetchMore(const QModelIndex &parent) const override
QString name() const
Definition: qgsdataitem.h:251
void connectionsChanged()
Connections changed in the browser, forwarded to the widget and used to notify the provider dialogs o...
void dataChanged(QgsDataItem *item)
QString toolTip() const
Definition: qgsdataitem.h:265
void hidePath(QgsDataItem *item)
Hide the given path in the browser model.
QgsBrowserModel(QObject *parent=nullptr)
This class is a composition of two QSettings instances:
Definition: qgssettings.h:55
virtual QgsDataItem * createDataItem(const QString &path, QgsDataItem *parentItem)=0
Create a new instance of QgsDataItem (or null) for given path and parent item.
void addDirectory(const QString &directory)
Adds a new directory to the favorites group.
void connectionsChanged()
Emitted when the provider&#39;s connections of the child items have changed This signal is normally forwa...
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const override
Provides the number of rows of data exposed by the model.
void fetchMore(const QModelIndex &parent) override
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Used to supply item data to views and delegates.
virtual bool handleDrop(const QMimeData *, Qt::DropAction)
Attempts to process the mime data dropped on this item.
Definition: qgsdataitem.h:180
QModelIndex findPath(const QString &path, Qt::MatchFlag matchFlag=Qt::MatchExactly)
Return index of item with given path.
void beginRemoveItems(QgsDataItem *parent, int first, int last)
virtual QIcon icon()
void connectItem(QgsDataItem *item)
Type type() const
Definition: qgsdataitem.h:238
static QMimeData * encodeUriList(const UriList &layers)
void setIcon(const QIcon &icon)
Definition: qgsdataitem.h:261
bool isValid() const
Returns whether the object contains valid data.
void itemStateChanged(QgsDataItem *item, QgsDataItem::State oldState)
virtual QStringList mimeTypes() const override
Returns a list of mime that can describe model indexes.
bool hasChildren(const QModelIndex &parent=QModelIndex()) const override
void endRemoveItems()
State state() const
Item path used to access path in the tree, see QgsDataItem::mPath.
QString homePath
Definition: qgsproject.h:86
QgsDirectoryItem * mProjectHome
void setValue(const QString &key, const QVariant &value, const QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
static void deleteLater(QVector< QgsDataItem *> &items)
QgsDataItem * parent() const
Get item parent.
Definition: qgsdataitem.h:243
QgsFavoritesItem * mFavorites
void beginRemoveItems(QgsDataItem *parent, int first, int last)
#define QgsDebugMsgLevel(str, level)
Definition: qgslogger.h:38
virtual QModelIndex parent(const QModelIndex &index) const override
Returns the parent of the model item with the given index.
QVector< QgsDataItem * > mRootItems
void readProject(const QDomDocument &)
emitted when project is being read
Children not yet created.
Definition: qgsdataitem.h:104
Creating children in separate thread (populating or refreshing)
Definition: qgsdataitem.h:105
void initialize()
Delayed initialization, needed because the provider registry must be already populated.
QgsDataItem * dataItem(const QModelIndex &idx) const
void removeFavorite(const QModelIndex &index)
Removes a favorite directory from its corresponding model index.
virtual bool hasDragEnabled() const
Returns true if the item may be dragged.
Definition: qgsdataitem.h:197
virtual int capabilities()=0
Return combination of flags from QgsDataProvider::DataCapabilities.
virtual QgsMimeDataUtils::Uri mimeUri() const
Return mime URI for the data item.
Definition: qgsdataitem.h:205
QgsBrowserWatcher(QgsDataItem *item)
bool hasChildren()
static bool hiddenPath(const QString &path)
Check if the given path is hidden from the browser model.
void reload()
Reload the whole model.
A directory: contains subdirectories and layers.
Definition: qgsdataitem.h:492
Base class for all items in the model.
Definition: qgsdataitem.h:49
QVector< QgsDataItem * > children() const
Definition: qgsdataitem.h:249
QModelIndex findItem(QgsDataItem *item, QgsDataItem *parent=nullptr) const
void writeProject(QDomDocument &)
emitted when project is being written
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Provides views with information to show in their headers.
void beginInsertItems(QgsDataItem *parent, int first, int last)
Contains various Favorites directories.
Definition: qgsdataitem.h:606
void removeDirectory(QgsDirectoryItem *item)
Removes an existing directory from the favorites group.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), const Section section=NoSection) const
Returns the value for setting key.
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the index of the item in the model specified by the given row, column and parent index...
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:383
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const override
Provides the number of columns of data exposed by the model.
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
Handles the data supplied by a drag and drop operation that ended with the given action.
void stateChanged(const QModelIndex &index, QgsDataItem::State oldState)
Emitted when item children fetch was finished.
void refresh(const QString &path)
Refresh item specified by path.
QList< QgsMimeDataUtils::Uri > UriList
void endInsertItems()
virtual QMimeData * mimeData(const QModelIndexList &indexes) const override
Returns an object that contains serialized items of data corresponding to the list of indexes specifi...
Represents a QGIS project.
Definition: qgsdataitem.h:83
Item that represents a layer that can be opened with one of the providers.
Definition: qgsdataitem.h:373
virtual void deleteChildItem(QgsDataItem *child)
Removes and deletes a child item, emitting relevant signals to the model.
virtual QString name()=0
Human-readable name of the provider name.
void itemDataChanged(QgsDataItem *item)
void addFavoriteDirectory(const QString &directory)
Adds a directory to the favorites group.
virtual Qt::ItemFlags flags(const QModelIndex &index) const override
Used by other components to obtain information about each item provided by the model.
virtual void populate(const QVector< QgsDataItem *> &children)
Children created.
Definition: qgsdataitem.h:106
virtual bool acceptDrop()
Returns whether the item accepts drag and dropped layers - e.g.
Definition: qgsdataitem.h:173
virtual QString comments() const
Returns comments of the layer.
Definition: qgsdataitem.h:431
void addRootItems()
Populates the model.
static QgsDataItemProviderRegistry * dataItemProviderRegistry()
Returns the application&#39;s data item provider registry, which keeps a list of data item providers that...
virtual void refresh(const QVector< QgsDataItem *> &children)
Refresh the items from a specified list of child items.
This is the interface for those who want to add custom data items to the browser tree.
void stateChanged(QgsDataItem *item, QgsDataItem::State oldState)