30 QVBoxLayout *layout =
new QVBoxLayout();
31 layout->setContentsMargins( 0, 0, 0, 0 );
32 layout->setSpacing( 0 );
33 QWidget *container =
new QWidget();
34 container->setLayout( layout );
35 setWidget( container );
37 setWindowTitle( name );
40 layout->addWidget( mWidget );
56 mWidget->showContextMenu( pt );
61 const QModelIndex index = mWidget->mProxyModel->mapToSource( mWidget->mBrowserView->currentIndex() );
77 const QString directory = QFileDialog::getExistingDirectory(
this, tr(
"Add directory to favorites" ) );
78 if ( !directory.isEmpty() )
108 mWidget->mModel->
removeFavorite( mWidget->mProxyModel->mapToSource( mWidget->mBrowserView->currentIndex() ) );
113 mWidget->refreshModel( QModelIndex() );
118 QgsDebugMsg( QStringLiteral(
"rowCount() = %1" ).arg( mWidget->mModel->
rowCount( mWidget->mProxyModel->mapToSource( index ) ) ) );
119 QgsDataItem *item = mWidget->mModel->
dataItem( mWidget->mProxyModel->mapToSource( index ) );
123 QgsProjectItem *projectItem = qobject_cast<QgsProjectItem *>( item );
126 QApplication::setOverrideCursor( Qt::WaitCursor );
127 emit
openFile( projectItem->
path(), QStringLiteral(
"project" ) );
128 QApplication::restoreOverrideCursor();
134 QgsLayerItem *layerItem = qobject_cast<QgsLayerItem *>( item );
137 QApplication::setOverrideCursor( Qt::WaitCursor );
138 mWidget->addLayer( layerItem );
139 QApplication::restoreOverrideCursor();
148 mWidget->addSelectedLayers();
158 mWidget->showProperties();
163 const QModelIndex index = mWidget->mProxyModel->mapToSource( mWidget->mBrowserView->currentIndex() );
171 QStringList fastScanDirs = settings.
value( QStringLiteral(
"qgis/scanItemsFastScanUris" ),
172 QStringList() ).toStringList();
173 const int idx = fastScanDirs.indexOf( item->
path() );
176 fastScanDirs.removeAt( idx );
180 fastScanDirs << item->
path();
182 settings.
setValue( QStringLiteral(
"qgis/scanItemsFastScanUris" ), fastScanDirs );
188 mWidget->showFilterWidget( visible );
193 mWidget->setFilter();
203 mWidget->setFilterSyntax( action );
208 mWidget->setCaseSensitive( caseSensitive );
213 mWidget->selectionChanged( selected, deselected );
218 mWidget->enablePropertiesWidget( enable );
@ Layer
Represents a map layer.
@ Project
Represents a QGIS project.
@ Directory
Represents a file directory.
A model for showing available data sources and other items in a structured tree.
QgsDataItem * dataItem(const QModelIndex &idx) const
Returns the data item at the specified index, or nullptr if no item exists at the index.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
void addFavoriteDirectory(const QString &directory, const QString &name=QString())
Adds a directory to the favorites group.
void removeFavorite(const QModelIndex &index)
Removes a favorite directory from its corresponding model index.
Base class for all items in the model.
Qgis::BrowserItemType type() const
A directory: contains subdirectories and layers.
QString dirPath() const
Returns the full path to the directory the item represents.
Item that represents a layer that can be opened with one of the providers.
A bar for displaying non-blocking messages to the user.
Data item that can be used to represent QGIS projects.
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH