QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsbrowserdockwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsbrowserdockwidget.h
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 #ifndef QGSBROWSERDOCKWIDGET_H
16 #define QGSBROWSERDOCKWIDGET_H
17 
18 #include "ui_qgsbrowserdockwidgetbase.h"
19 #include "ui_qgsbrowserlayerpropertiesbase.h"
20 #include "ui_qgsbrowserdirectorypropertiesbase.h"
21 #include "ui_qgsbrowserpropertiesdialogbase.h"
22 
23 #include "qgsbrowsertreeview.h"
24 #include "qgsdockwidget.h"
25 #include "qgis_gui.h"
26 #include <QSortFilterProxyModel>
27 
28 class QgsBrowserGuiModel;
29 class QModelIndex;
30 class QgsDockBrowserTreeView;
31 class QgsLayerItem;
32 class QgsDataItem;
34 class QgsMessageBar;
36 
42 class GUI_EXPORT QgsBrowserDockWidget : public QgsDockWidget, private Ui::QgsBrowserDockWidgetBase
43 {
44  Q_OBJECT
45  public:
46 
53  explicit QgsBrowserDockWidget( const QString &name, QgsBrowserGuiModel *browserModel, QWidget *parent SIP_TRANSFERTHIS = nullptr );
54  ~QgsBrowserDockWidget() override;
55 
60  Q_DECL_DEPRECATED void addFavoriteDirectory( const QString &favDir, const QString &name = QString() ) SIP_DEPRECATED;
61 
71  void setMessageBar( QgsMessageBar *bar );
72 
80  QgsMessageBar *messageBar();
81 
94  void setDisabledDataItemsKeys( const QStringList &filter );
95 
96  public slots:
97 
106  Q_DECL_DEPRECATED bool addLayerAtIndex( const QModelIndex &index ) SIP_DEPRECATED;
107 
109  void showContextMenu( QPoint );
110 
115  Q_DECL_DEPRECATED void addFavorite() SIP_DEPRECATED;
116 
121  Q_DECL_DEPRECATED void addFavoriteDirectory() SIP_DEPRECATED;
122 
127  Q_DECL_DEPRECATED void removeFavorite() SIP_DEPRECATED;
128 
130  void refresh();
131 
133  void showFilterWidget( bool visible );
135  void enablePropertiesWidget( bool enable );
137  void setFilterSyntax( QAction * );
139  void setCaseSensitive( bool caseSensitive );
141  void setFilter();
143  void setActiveIndex( const QModelIndex &index );
145  void updateProjectHome();
146 
148  void addSelectedLayers();
150  void showProperties();
152  void hideItem();
153 
158  Q_DECL_DEPRECATED void toggleFastScan() SIP_DEPRECATED;
159 
160  // TODO QGIS 4.0: make these private
161 
163  void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
165  void splitterMoved();
166 
167  signals:
169  void openFile( const QString &fileName, const QString &fileTypeHint = QString() );
174 
175  protected:
177  void showEvent( QShowEvent *event ) override;
178 
179  private slots:
180  void itemDoubleClicked( const QModelIndex &index );
181  void onOptionsChanged();
182 
183  private:
185  void refreshModel( const QModelIndex &index );
187  void addLayer( QgsLayerItem *layerItem );
189  void clearPropertiesWidget();
191  void setPropertiesWidget();
192 
194  int selectedItemsCount();
196  QString settingsSection() { return objectName().toLower(); }
197 
198  QgsDataItemGuiContext createContext();
199 
200  QgsDockBrowserTreeView *mBrowserView = nullptr;
201  QgsBrowserGuiModel *mModel = nullptr;
202  QgsBrowserProxyModel *mProxyModel = nullptr;
203  QString mInitPath;
204  bool mPropertiesWidgetEnabled;
205  // height fraction
206  float mPropertiesWidgetHeight;
207 
208  QgsMessageBar *mMessageBar = nullptr;
209  QStringList mDisabledDataItemsKeys;
210 };
211 
212 #endif // QGSBROWSERDOCKWIDGET_H
The QgsBrowserDockWidget class.
void connectionsChanged()
Connections changed in the browser.
void handleDropUriList(const QgsMimeDataUtils::UriList &)
Emitted when drop uri list needs to be handled.
void openFile(const QString &fileName, const QString &fileTypeHint=QString())
Emitted when a file needs to be opened.
A model for showing available data sources and other items in a structured tree.
A QSortFilterProxyModel subclass for filtering and sorting browser model items.
Encapsulates the context in which a QgsDataItem is shown within the application GUI.
Base class for all items in the model.
Definition: qgsdataitem.h:46
QgsDockWidget subclass with more fine-grained control over how the widget is closed or opened.
Definition: qgsdockwidget.h:32
void showEvent(QShowEvent *event) override
Item that represents a layer that can be opened with one of the providers.
Definition: qgslayeritem.h:30
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:61
QList< QgsMimeDataUtils::Uri > UriList
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53