QGIS API Documentation  3.0.2-Girona (307d082)
qgsbrowserdockwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsbrowserdockwidget.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 "qgsbrowserdockwidget.h"
16 #include "qgsbrowserdockwidget_p.h"
17 
18 #include <QAbstractTextDocumentLayout>
19 #include <QHeaderView>
20 #include <QTreeView>
21 #include <QMenu>
22 #include <QToolButton>
23 #include <QFileDialog>
24 #include <QPlainTextDocumentLayout>
25 #include <QSortFilterProxyModel>
26 
27 #include "qgsbrowsermodel.h"
28 #include "qgsbrowsertreeview.h"
29 #include "qgslogger.h"
30 #include "qgsrasterlayer.h"
31 #include "qgsvectorlayer.h"
32 #include "qgsproject.h"
33 #include "qgssettings.h"
34 #include "qgsnewnamedialog.h"
35 
36 // browser layer properties dialog
37 #include "qgsapplication.h"
38 #include "qgsmapcanvas.h"
39 
40 #include <QDragEnterEvent>
41 
42 QgsBrowserDockWidget::QgsBrowserDockWidget( const QString &name, QgsBrowserModel *browserModel, QWidget *parent )
43  : QgsDockWidget( parent )
44  , mModel( browserModel )
45  , mPropertiesWidgetEnabled( false )
46  , mPropertiesWidgetHeight( 0 )
47 {
48  setupUi( this );
49 
50  mContents->layout()->setContentsMargins( 0, 0, 0, 0 );
51  mContents->layout()->setMargin( 0 );
52  static_cast< QVBoxLayout * >( mContents->layout() )->setSpacing( 0 );
53 
54  setWindowTitle( name );
55 
56  mBrowserView = new QgsDockBrowserTreeView( this );
57  mLayoutBrowser->addWidget( mBrowserView );
58 
59  mWidgetFilter->hide();
60  mLeFilter->setPlaceholderText( tr( "Type here to filter visible items…" ) );
61  // icons from http://www.fatcow.com/free-icons License: CC Attribution 3.0
62 
63  QMenu *menu = new QMenu( this );
64  menu->setSeparatorsCollapsible( false );
65  mBtnFilterOptions->setMenu( menu );
66  QAction *action = new QAction( tr( "Case Sensitive" ), menu );
67  action->setData( "case" );
68  action->setCheckable( true );
69  action->setChecked( false );
70  connect( action, &QAction::toggled, this, &QgsBrowserDockWidget::setCaseSensitive );
71  menu->addAction( action );
72  QActionGroup *group = new QActionGroup( menu );
73  action = new QAction( tr( "Filter Pattern Syntax" ), group );
74  action->setSeparator( true );
75  menu->addAction( action );
76  action = new QAction( tr( "Normal" ), group );
77  action->setData( "normal" );
78  action->setCheckable( true );
79  action->setChecked( true );
80  menu->addAction( action );
81  action = new QAction( tr( "Wildcard(s)" ), group );
82  action->setData( "wildcard" );
83  action->setCheckable( true );
84  menu->addAction( action );
85  action = new QAction( tr( "Regular Expression" ), group );
86  action->setData( "regexp" );
87  action->setCheckable( true );
88  menu->addAction( action );
89 
90  connect( mActionRefresh, &QAction::triggered, this, &QgsBrowserDockWidget::refresh );
91  connect( mActionAddLayers, &QAction::triggered, this, &QgsBrowserDockWidget::addSelectedLayers );
92  connect( mActionCollapse, &QAction::triggered, mBrowserView, &QgsDockBrowserTreeView::collapseAll );
93  connect( mActionShowFilter, &QAction::triggered, this, &QgsBrowserDockWidget::showFilterWidget );
94  connect( mActionPropertiesWidget, &QAction::triggered, this, &QgsBrowserDockWidget::enablePropertiesWidget );
95  connect( mLeFilter, &QgsFilterLineEdit::returnPressed, this, &QgsBrowserDockWidget::setFilter );
96  connect( mLeFilter, &QgsFilterLineEdit::cleared, this, &QgsBrowserDockWidget::setFilter );
97  connect( mLeFilter, &QgsFilterLineEdit::textChanged, this, &QgsBrowserDockWidget::setFilter );
98  connect( group, &QActionGroup::triggered, this, &QgsBrowserDockWidget::setFilterSyntax );
99  connect( mBrowserView, &QgsDockBrowserTreeView::customContextMenuRequested, this, &QgsBrowserDockWidget::showContextMenu );
100  connect( mBrowserView, &QgsDockBrowserTreeView::doubleClicked, this, &QgsBrowserDockWidget::itemDoubleClicked );
101  connect( mSplitter, &QSplitter::splitterMoved, this, &QgsBrowserDockWidget::splitterMoved );
102 }
103 
105 {
106  QgsSettings settings;
107  settings.setValue( settingsSection() + "/propertiesWidgetEnabled", mPropertiesWidgetEnabled );
108  //settings.setValue(settingsSection() + "/propertiesWidgetHeight", mPropertiesWidget->size().height() );
109  settings.setValue( settingsSection() + "/propertiesWidgetHeight", mPropertiesWidgetHeight );
110 }
111 
112 void QgsBrowserDockWidget::showEvent( QShowEvent *e )
113 {
114  // delayed initialization of the model
115  if ( !mModel->initialized( ) )
116  {
117  mModel->initialize();
118  }
119  if ( ! mProxyModel )
120  {
121  mProxyModel = new QgsBrowserTreeFilterProxyModel( this );
122  mProxyModel->setBrowserModel( mModel );
123  mBrowserView->setSettingsSection( objectName().toLower() ); // to distinguish 2 or more instances of the browser
124  mBrowserView->setBrowserModel( mModel );
125  mBrowserView->setModel( mProxyModel );
126  mBrowserView->setSortingEnabled( true );
127  mBrowserView->sortByColumn( 0, Qt::AscendingOrder );
128  // provide a horizontal scroll bar instead of using ellipse (...) for longer items
129  mBrowserView->setTextElideMode( Qt::ElideNone );
130  mBrowserView->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
131  mBrowserView->header()->setStretchLastSection( false );
132 
133  // selectionModel is created when model is set on tree
134  connect( mBrowserView->selectionModel(), &QItemSelectionModel::selectionChanged,
136 
137  // Forward the model changed signals to the widget
138  connect( mModel, &QgsBrowserModel::connectionsChanged,
140 
141 
142  // objectName used by settingsSection() is not yet set in constructor
143  QgsSettings settings;
144  mPropertiesWidgetEnabled = settings.value( settingsSection() + "/propertiesWidgetEnabled", false ).toBool();
145  mActionPropertiesWidget->setChecked( mPropertiesWidgetEnabled );
146  mPropertiesWidget->setVisible( false ); // false until item is selected
147 
148  mPropertiesWidgetHeight = settings.value( settingsSection() + "/propertiesWidgetHeight" ).toFloat();
149  QList<int> sizes = mSplitter->sizes();
150  int total = sizes.value( 0 ) + sizes.value( 1 );
151  int height = ( int )total * mPropertiesWidgetHeight;
152  sizes.clear();
153  sizes << total - height << height;
154  mSplitter->setSizes( sizes );
155  }
156 
158 }
159 
160 void QgsBrowserDockWidget::itemDoubleClicked( const QModelIndex &index )
161 {
162  QgsDataItem *item = mModel->dataItem( mProxyModel->mapToSource( index ) );
163  if ( !item )
164  return;
165 
166  if ( item->handleDoubleClick() )
167  return;
168  else
169  addLayerAtIndex( index ); // default double-click handler
170 }
171 
172 void QgsBrowserDockWidget::renameFavorite()
173 {
174  QgsDataItem *dataItem = mModel->dataItem( mProxyModel->mapToSource( mBrowserView->currentIndex() ) );
175  if ( !dataItem )
176  return;
177 
178  QgsFavoriteItem *favorite = qobject_cast< QgsFavoriteItem * >( dataItem );
179  if ( !favorite )
180  return;
181 
182  QgsNewNameDialog dlg( tr( "favorite “%1”" ).arg( favorite->name() ), favorite->name() );
183  dlg.setWindowTitle( tr( "Rename Favorite" ) );
184  if ( dlg.exec() != QDialog::Accepted || dlg.name() == favorite->name() )
185  return;
186 
187  favorite->rename( dlg.name() );
188 }
189 
191 {
192  QModelIndex index = mProxyModel->mapToSource( mBrowserView->indexAt( pt ) );
193  QgsDataItem *item = mModel->dataItem( index );
194  if ( !item )
195  return;
196 
197  QMenu *menu = new QMenu( this );
198 
199  if ( item->type() == QgsDataItem::Directory )
200  {
201  QgsSettings settings;
202 
203  bool inFavDirs = item->parent() && item->parent()->type() == QgsDataItem::Favorites;
204  if ( item->parent() && !inFavDirs )
205  {
206  // only non-root directories can be added as favorites
207  menu->addAction( tr( "Add as a Favorite" ), this, SLOT( addFavorite() ) );
208  }
209  else if ( inFavDirs )
210  {
211  QAction *actionRename = new QAction( tr( "Rename Favorite…" ), this );
212  connect( actionRename, &QAction::triggered, this, &QgsBrowserDockWidget::renameFavorite );
213  menu->addAction( actionRename );
214  menu->addAction( tr( "Remove Favorite" ), this, SLOT( removeFavorite() ) );
215  menu->addSeparator();
216  }
217  menu->addAction( tr( "Properties…" ), this, SLOT( showProperties() ) );
218  menu->addAction( tr( "Hide from Browser" ), this, SLOT( hideItem() ) );
219  QAction *action = menu->addAction( tr( "Fast Scan this Directory" ), this, SLOT( toggleFastScan() ) );
220  action->setCheckable( true );
221  action->setChecked( settings.value( QStringLiteral( "qgis/scanItemsFastScanUris" ),
222  QStringList() ).toStringList().contains( item->path() ) );
223  }
224  else if ( item->type() == QgsDataItem::Layer )
225  {
226  menu->addAction( tr( "Add Selected Layer(s) to Canvas" ), this, SLOT( addSelectedLayers() ) );
227  menu->addAction( tr( "Properties…" ), this, SLOT( showProperties() ) );
228  }
229  else if ( item->type() == QgsDataItem::Favorites )
230  {
231  menu->addAction( tr( "Add a Directory…" ), this, SLOT( addFavoriteDirectory() ) );
232  }
233 
234  const QList<QMenu *> menus = item->menus( menu );
235  QList<QAction *> actions = item->actions( menu );
236 
237  if ( !menus.isEmpty() )
238  {
239  for ( QMenu *mn : menus )
240  {
241  menu->addMenu( mn );
242  }
243  }
244 
245  if ( !actions.isEmpty() )
246  {
247  if ( !menu->actions().isEmpty() )
248  menu->addSeparator();
249  // add action to the menu
250  menu->addActions( actions );
251  }
252 
253  if ( menu->actions().isEmpty() )
254  {
255  delete menu;
256  return;
257  }
258 
259  menu->popup( mBrowserView->mapToGlobal( pt ) );
260 }
261 
263 {
264  QModelIndex index = mProxyModel->mapToSource( mBrowserView->currentIndex() );
265  QgsDataItem *item = mModel->dataItem( index );
266  if ( !item )
267  return;
268 
269  QgsDirectoryItem *dirItem = dynamic_cast<QgsDirectoryItem *>( item );
270  if ( !dirItem )
271  return;
272 
273  addFavoriteDirectory( dirItem->dirPath() );
274 }
275 
277 {
278  QString directory = QFileDialog::getExistingDirectory( this, tr( "Add directory to favorites" ) );
279  if ( !directory.isEmpty() )
280  {
281  addFavoriteDirectory( directory );
282  }
283 }
284 
285 void QgsBrowserDockWidget::addFavoriteDirectory( const QString &favDir, const QString &name )
286 {
287  mModel->addFavoriteDirectory( favDir, name );
288 }
289 
291 {
292  mModel->removeFavorite( mProxyModel->mapToSource( mBrowserView->currentIndex() ) );
293 }
294 
296 {
297  refreshModel( QModelIndex() );
298 }
299 
300 void QgsBrowserDockWidget::refreshModel( const QModelIndex &index )
301 {
302  if ( mModel && mProxyModel )
303  {
304  QgsDataItem *item = mModel->dataItem( index );
305  if ( item )
306  {
307  QgsDebugMsg( "path = " + item->path() );
308  }
309  else
310  {
311  QgsDebugMsg( "invalid item" );
312  }
313 
314  if ( item && ( item->capabilities2() & QgsDataItem::Fertile ) )
315  {
316  mModel->refresh( index );
317  }
318 
319  for ( int i = 0; i < mModel->rowCount( index ); i++ )
320  {
321  QModelIndex idx = mModel->index( i, 0, index );
322  QModelIndex proxyIdx = mProxyModel->mapFromSource( idx );
323  QgsDataItem *child = mModel->dataItem( idx );
324 
325  // Check also expanded descendants so that the whole expanded path does not get collapsed if one item is collapsed.
326  // Fast items (usually root items) are refreshed so that when collapsed, it is obvious they are if empty (no expand symbol).
327  if ( mBrowserView->isExpanded( proxyIdx ) || mBrowserView->hasExpandedDescendant( proxyIdx ) || ( child && child->capabilities2() & QgsDataItem::Fast ) )
328  {
329  refreshModel( idx );
330  }
331  else
332  {
333  if ( child && ( child->capabilities2() & QgsDataItem::Fertile ) )
334  {
335  child->depopulate();
336  }
337  }
338  }
339  }
340 }
341 
342 void QgsBrowserDockWidget::addLayer( QgsLayerItem *layerItem )
343 {
344  if ( !layerItem )
345  return;
346 
348  list << layerItem->mimeUri();
349  emit handleDropUriList( list );
350 }
351 
352 void QgsBrowserDockWidget::addLayerAtIndex( const QModelIndex &index )
353 {
354  QgsDebugMsg( QString( "rowCount() = %1" ).arg( mModel->rowCount( mProxyModel->mapToSource( index ) ) ) );
355  QgsDataItem *item = mModel->dataItem( mProxyModel->mapToSource( index ) );
356 
357  if ( item && item->type() == QgsDataItem::Project )
358  {
359  QgsProjectItem *projectItem = qobject_cast<QgsProjectItem *>( item );
360  if ( projectItem )
361  {
362  QApplication::setOverrideCursor( Qt::WaitCursor );
363  emit openFile( projectItem->path() );
364  QApplication::restoreOverrideCursor();
365  }
366  }
367  if ( item && item->type() == QgsDataItem::Layer )
368  {
369  QgsLayerItem *layerItem = qobject_cast<QgsLayerItem *>( item );
370  if ( layerItem )
371  {
372  QApplication::setOverrideCursor( Qt::WaitCursor );
373  addLayer( layerItem );
374  QApplication::restoreOverrideCursor();
375  }
376  }
377 }
378 
380 {
381  QApplication::setOverrideCursor( Qt::WaitCursor );
382 
383  // get a sorted list of selected indexes
384  QModelIndexList list = mBrowserView->selectionModel()->selectedIndexes();
385  std::sort( list.begin(), list.end() );
386 
387  // If any of the layer items are QGIS we just open and exit the loop
388  Q_FOREACH ( const QModelIndex &index, list )
389  {
390  QgsDataItem *item = mModel->dataItem( mProxyModel->mapToSource( index ) );
391  if ( item && item->type() == QgsDataItem::Project )
392  {
393  QgsProjectItem *projectItem = qobject_cast<QgsProjectItem *>( item );
394  if ( projectItem )
395  emit openFile( projectItem->path() );
396 
397  QApplication::restoreOverrideCursor();
398  return;
399  }
400  }
401 
402  // add items in reverse order so they are in correct order in the layers dock
403  for ( int i = list.size() - 1; i >= 0; i-- )
404  {
405  QgsDataItem *item = mModel->dataItem( mProxyModel->mapToSource( list[i] ) );
406  if ( item && item->type() == QgsDataItem::Layer )
407  {
408  QgsLayerItem *layerItem = qobject_cast<QgsLayerItem *>( item );
409  if ( layerItem )
410  addLayer( layerItem );
411  }
412  }
413 
414  QApplication::restoreOverrideCursor();
415 }
416 
418 {
419  QModelIndex index = mProxyModel->mapToSource( mBrowserView->currentIndex() );
420  QgsDataItem *item = mModel->dataItem( index );
421  if ( ! item )
422  return;
423 
424  if ( item->type() == QgsDataItem::Directory )
425  {
426  mModel->hidePath( item );
427  }
428 }
429 
431 {
432  QModelIndex index = mProxyModel->mapToSource( mBrowserView->currentIndex() );
433  QgsDataItem *item = mModel->dataItem( index );
434  if ( ! item )
435  return;
436 
437  if ( item->type() == QgsDataItem::Layer || item->type() == QgsDataItem::Directory )
438  {
439  QgsBrowserPropertiesDialog *dialog = new QgsBrowserPropertiesDialog( settingsSection(), this );
440  dialog->setItem( item );
441  dialog->show();
442  }
443 }
444 
446 {
447  QModelIndex index = mProxyModel->mapToSource( mBrowserView->currentIndex() );
448  QgsDataItem *item = mModel->dataItem( index );
449  if ( ! item )
450  return;
451 
452  if ( item->type() == QgsDataItem::Directory )
453  {
454  QgsSettings settings;
455  QStringList fastScanDirs = settings.value( QStringLiteral( "qgis/scanItemsFastScanUris" ),
456  QStringList() ).toStringList();
457  int idx = fastScanDirs.indexOf( item->path() );
458  if ( idx != -1 )
459  {
460  fastScanDirs.removeAt( idx );
461  }
462  else
463  {
464  fastScanDirs << item->path();
465  }
466  settings.setValue( QStringLiteral( "qgis/scanItemsFastScanUris" ), fastScanDirs );
467  }
468 }
469 
471 {
472  mWidgetFilter->setVisible( visible );
473  if ( ! visible )
474  {
475  mLeFilter->setText( QString() );
476  setFilter();
477  }
478  else
479  {
480  mLeFilter->setFocus();
481  }
482 }
483 
485 {
486  QString filter = mLeFilter->text();
487  if ( mProxyModel )
488  mProxyModel->setFilter( filter );
489 }
490 
492 {
493  if ( mModel )
494  mModel->updateProjectHome();
495 }
496 
498 {
499  if ( !action || ! mProxyModel )
500  return;
501  mProxyModel->setFilterSyntax( action->data().toString() );
502 }
503 
504 void QgsBrowserDockWidget::setCaseSensitive( bool caseSensitive )
505 {
506  if ( ! mProxyModel )
507  return;
508  mProxyModel->setCaseSensitive( caseSensitive );
509 }
510 
511 int QgsBrowserDockWidget::selectedItemsCount()
512 {
513  QItemSelectionModel *selectionModel = mBrowserView->selectionModel();
514  if ( selectionModel )
515  {
516  return selectionModel->selectedIndexes().size();
517  }
518  return 0;
519 }
520 
521 void QgsBrowserDockWidget::selectionChanged( const QItemSelection &selected, const QItemSelection &deselected )
522 {
523  Q_UNUSED( selected );
524  Q_UNUSED( deselected );
525  if ( mPropertiesWidgetEnabled )
526  {
527  setPropertiesWidget();
528  }
529 }
530 
531 void QgsBrowserDockWidget::clearPropertiesWidget()
532 {
533  while ( mPropertiesLayout->count() > 0 )
534  {
535  delete mPropertiesLayout->itemAt( 0 )->widget();
536  }
537  mPropertiesWidget->setVisible( false );
538 }
539 
540 void QgsBrowserDockWidget::setPropertiesWidget()
541 {
542  clearPropertiesWidget();
543  QItemSelectionModel *selectionModel = mBrowserView->selectionModel();
544  if ( selectionModel )
545  {
546  QModelIndexList indexes = selectionModel->selectedIndexes();
547  if ( indexes.size() == 1 )
548  {
549  QModelIndex index = mProxyModel->mapToSource( indexes.value( 0 ) );
550  QgsDataItem *item = mModel->dataItem( index );
551  QgsBrowserPropertiesWidget *propertiesWidget = QgsBrowserPropertiesWidget::createWidget( item, mPropertiesWidget );
552  if ( propertiesWidget )
553  {
554  propertiesWidget->setCondensedMode( true );
555  mPropertiesLayout->addWidget( propertiesWidget );
556  }
557  }
558  }
559  mPropertiesWidget->setVisible( mPropertiesLayout->count() > 0 );
560 }
561 
563 {
564  mPropertiesWidgetEnabled = enable;
565  if ( enable && selectedItemsCount() == 1 )
566  {
567  setPropertiesWidget();
568  }
569  else
570  {
571  clearPropertiesWidget();
572  }
573 }
574 
576 {
577  QList<int> sizes = mSplitter->sizes();
578  float total = sizes.value( 0 ) + sizes.value( 1 );
579  mPropertiesWidgetHeight = total > 0 ? sizes.value( 1 ) / total : 0;
580 }
virtual QList< QMenu * > menus(QWidget *parent)
Returns the list of menus available for this item.
QString path() const
Definition: qgsdataitem.h:266
void toggleFastScan()
Toggle fast scan.
void addSelectedLayers()
Add selected layers to the project.
void connectionsChanged()
Connections changed in the browser, forwarded to the widget and used to notify the provider dialogs o...
void hidePath(QgsDataItem *item)
Hide the given path in the browser model.
This class is a composition of two QSettings instances:
Definition: qgssettings.h:57
void openFile(const QString &)
Emitted when a file needs to be opened.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Provides the number of rows of data exposed by the model.
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
void addFavoriteDirectory()
Add directory from file dialog to favorite.
Type type() const
Definition: qgsdataitem.h:238
virtual void depopulate()
Remove children recursively and set as not populated. This is used when refreshing collapsed items...
void enablePropertiesWidget(bool enable)
Enable/disable properties widget.
void hideItem()
Hide current item.
void showEvent(QShowEvent *event) override
Show event override.
bool initialized() const
Returns true if the model has been initialized.
void setFilter()
Apply filter to the model.
void setValue(const QString &key, const QVariant &value, const QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
QgsDataItem * parent() const
Get item parent.
Definition: qgsdataitem.h:243
void showContextMenu(QPoint)
Show context menu.
void addFavorite()
Add current item to favorite.
QgsDockWidget subclass with more fine-grained control over how the widget is closed or opened...
Definition: qgsdockwidget.h:31
virtual bool handleDoubleClick()
Called when a user double clicks on the item.
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.
void handleDropUriList(const QgsMimeDataUtils::UriList &)
Emitted when drop uri list needs to be handled.
void setFilterSyntax(QAction *)
Set filter syntax.
A directory: contains subdirectories and layers.
Definition: qgsdataitem.h:528
void showEvent(QShowEvent *event) override
void showProperties()
Show the layer properties.
Base class for all items in the model.
Definition: qgsdataitem.h:49
QgsBrowserDockWidget(const QString &name, QgsBrowserModel *browserModel, QWidget *parent=nullptr)
Constructor for QgsBrowserDockWidget.
void splitterMoved()
Splitter has been moved.
Can create children. Even items without this capability may have children, but cannot create them...
Definition: qgsdataitem.h:211
void setCaseSensitive(bool caseSensitive)
Set filter case sensitivity.
New name, for example new layer name dialog.
void removeFavorite()
Remove from favorite.
void addFavoriteDirectory(const QString &directory, const QString &name=QString())
Adds a directory to the favorites group.
void updateProjectHome()
Update project home directory.
QgsMimeDataUtils::Uri mimeUri() const override
Return mime URI for the data item.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), const Section section=NoSection) const
Returns the value for setting key.
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...
void cleared()
Emitted when the widget is cleared.
void showFilterWidget(bool visible)
Show/hide filter widget.
virtual QList< QAction * > actions(QWidget *parent)
Returns the list of actions available for this item.
QString dirPath() const
Definition: qgsdataitem.h:557
void refresh(const QString &path)
Refresh item specified by path.
QList< QgsMimeDataUtils::Uri > UriList
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:409
void connectionsChanged()
Connections changed in the browser.
void refresh()
Refresh browser view model (and view)
Data item that can be used to represent QGIS projects.
Definition: qgsdataitem.h:586
void addLayerAtIndex(const QModelIndex &index)
Add layer at index.
CreateChildren() is fast enough to be run in main thread when refreshing items, most root items (wms...
Definition: qgsdataitem.h:212
Represents a favorite item.
Definition: qgsdataitem.h:82
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
Selection has changed.
virtual Capabilities capabilities2() const
Definition: qgsdataitem.h:224