16#include "moc_qgsbrowserdockwidget.cpp"
31 QVBoxLayout *layout =
new QVBoxLayout();
32 layout->setContentsMargins( 0, 0, 0, 0 );
33 layout->setSpacing( 0 );
34 QWidget *container =
new QWidget();
35 container->setLayout( layout );
36 setWidget( container );
38 setWindowTitle( name );
41 layout->addWidget( mWidget );
57 mWidget->showContextMenu( pt );
62 const QModelIndex index = mWidget->mProxyModel->mapToSource( mWidget->mBrowserView->currentIndex() );
78 const QString directory = QFileDialog::getExistingDirectory(
this, tr(
"Add directory to favorites" ) );
79 if ( !directory.isEmpty() )
109 mWidget->mModel->
removeFavorite( mWidget->mProxyModel->mapToSource( mWidget->mBrowserView->currentIndex() ) );
114 mWidget->refreshModel( QModelIndex() );
119 QgsDebugMsgLevel( QStringLiteral(
"rowCount() = %1" ).arg( mWidget->mModel->
rowCount( mWidget->mProxyModel->mapToSource( index ) ) ), 2 );
120 QgsDataItem *item = mWidget->mModel->
dataItem( mWidget->mProxyModel->mapToSource( index ) );
124 QgsProjectItem *projectItem = qobject_cast<QgsProjectItem *>( item );
127 QApplication::setOverrideCursor( Qt::WaitCursor );
128 emit
openFile( projectItem->
path(), QStringLiteral(
"project" ) );
129 QApplication::restoreOverrideCursor();
135 QgsLayerItem *layerItem = qobject_cast<QgsLayerItem *>( item );
138 QApplication::setOverrideCursor( Qt::WaitCursor );
139 mWidget->addLayer( layerItem );
140 QApplication::restoreOverrideCursor();
149 mWidget->addSelectedLayers();
159 mWidget->showProperties();
164 const QModelIndex index = mWidget->mProxyModel->mapToSource( mWidget->mBrowserView->currentIndex() );
172 QStringList fastScanDirs = settings.
value( QStringLiteral(
"qgis/scanItemsFastScanUris" ), 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
#define QgsDebugMsgLevel(str, level)