QGIS API Documentation  3.12.1-BucureČ™ti (121cc00ff0)
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 "qgsdataitem.h"
24 #include "qgsbrowsertreeview.h"
25 #include "qgsdockwidget.h"
26 #include "qgis_gui.h"
27 #include <QSortFilterProxyModel>
28 
29 class QgsBrowserGuiModel;
30 class QModelIndex;
31 class QgsDockBrowserTreeView;
32 class QgsLayerItem;
33 class QgsDataItem;
35 class QgsMessageBar;
37 
43 class GUI_EXPORT QgsBrowserDockWidget : public QgsDockWidget, private Ui::QgsBrowserDockWidgetBase
44 {
45  Q_OBJECT
46  public:
47 
54  explicit QgsBrowserDockWidget( const QString &name, QgsBrowserGuiModel *browserModel, QWidget *parent SIP_TRANSFERTHIS = nullptr );
55  ~QgsBrowserDockWidget() override;
56 
61  Q_DECL_DEPRECATED void addFavoriteDirectory( const QString &favDir, const QString &name = QString() ) SIP_DEPRECATED;
62 
72  void setMessageBar( QgsMessageBar *bar );
73 
81  QgsMessageBar *messageBar();
82 
95  void setDisabledDataItemsKeys( const QStringList &filter );
96 
97  public slots:
98 
107  Q_DECL_DEPRECATED bool addLayerAtIndex( const QModelIndex &index ) SIP_DEPRECATED;
108 
110  void showContextMenu( QPoint );
111 
116  Q_DECL_DEPRECATED void addFavorite() SIP_DEPRECATED;
117 
122  Q_DECL_DEPRECATED void addFavoriteDirectory() SIP_DEPRECATED;
123 
128  Q_DECL_DEPRECATED void removeFavorite() SIP_DEPRECATED;
129 
131  void refresh();
132 
134  void showFilterWidget( bool visible );
136  void enablePropertiesWidget( bool enable );
138  void setFilterSyntax( QAction * );
140  void setCaseSensitive( bool caseSensitive );
142  void setFilter();
144  void setActiveIndex( const QModelIndex &index );
146  void updateProjectHome();
147 
149  void addSelectedLayers();
151  void showProperties();
153  void hideItem();
154 
159  Q_DECL_DEPRECATED void toggleFastScan() SIP_DEPRECATED;
160 
161  // TODO QGIS 4.0: make these private
162 
164  void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
166  void splitterMoved();
167 
168  signals:
170  void openFile( const QString &fileName, const QString &fileTypeHint = QString() );
172  void handleDropUriList( const QgsMimeDataUtils::UriList & );
174  void connectionsChanged();
175 
176  protected:
178  void showEvent( QShowEvent *event ) override;
179 
180  private slots:
181  void itemDoubleClicked( const QModelIndex &index );
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
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:45
A model for showing available data sources and other items in a structured tree.
QgsDockWidget subclass with more fine-grained control over how the widget is closed or opened...
Definition: qgsdockwidget.h:31
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
void showEvent(QShowEvent *event) override
Base class for all items in the model.
Definition: qgsdataitem.h:49
Encapsulates the context in which a QgsDataItem is shown within the application GUI.
The QgsBrowserDockWidget class.
A QSortFilterProxyModel subclass for filtering and sorting browser model items.
QList< QgsMimeDataUtils::Uri > UriList
Item that represents a layer that can be opened with one of the providers.
Definition: qgsdataitem.h:485