QGIS API Documentation  3.6.0-Noosa (5873452)
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 "qgsbrowserdockwidget_p.h"
27 #include "qgis_gui.h"
28 #include <QSortFilterProxyModel>
29 
30 class QgsBrowserModel;
31 class QModelIndex;
32 class QgsDockBrowserTreeView;
33 class QgsLayerItem;
34 class QgsDataItem;
36 class QgsMessageBar;
38 
44 class GUI_EXPORT QgsBrowserDockWidget : public QgsDockWidget, private Ui::QgsBrowserDockWidgetBase
45 {
46  Q_OBJECT
47  public:
48 
55  explicit QgsBrowserDockWidget( const QString &name, QgsBrowserModel *browserModel, QWidget *parent SIP_TRANSFERTHIS = nullptr );
56  ~QgsBrowserDockWidget() override;
57 
62  Q_DECL_DEPRECATED void addFavoriteDirectory( const QString &favDir, const QString &name = QString() ) SIP_DEPRECATED;
63 
73  void setMessageBar( QgsMessageBar *bar );
74 
82  QgsMessageBar *messageBar();
83 
84  public slots:
85 
94  Q_DECL_DEPRECATED bool addLayerAtIndex( const QModelIndex &index ) SIP_DEPRECATED;
95 
97  void showContextMenu( QPoint );
98 
103  Q_DECL_DEPRECATED void addFavorite() SIP_DEPRECATED;
104 
109  Q_DECL_DEPRECATED void addFavoriteDirectory() SIP_DEPRECATED;
110 
115  Q_DECL_DEPRECATED void removeFavorite() SIP_DEPRECATED;
116 
118  void refresh();
119 
121  void showFilterWidget( bool visible );
123  void enablePropertiesWidget( bool enable );
125  void setFilterSyntax( QAction * );
127  void setCaseSensitive( bool caseSensitive );
129  void setFilter();
131  void updateProjectHome();
132 
134  void addSelectedLayers();
136  void showProperties();
138  void hideItem();
139 
144  Q_DECL_DEPRECATED void toggleFastScan() SIP_DEPRECATED;
145 
146  // TODO QGIS 4.0: make these private
147 
149  void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
151  void splitterMoved();
152 
153  signals:
155  void openFile( const QString &fileName, const QString &fileTypeHint = QString() );
157  void handleDropUriList( const QgsMimeDataUtils::UriList & );
159  void connectionsChanged();
160 
161  protected:
163  void showEvent( QShowEvent *event ) override;
164 
165  private slots:
166  void itemDoubleClicked( const QModelIndex &index );
167 
168  private:
170  void refreshModel( const QModelIndex &index );
172  void addLayer( QgsLayerItem *layerItem );
174  void clearPropertiesWidget();
176  void setPropertiesWidget();
177 
179  int selectedItemsCount();
181  QString settingsSection() { return objectName().toLower(); }
182 
183  QgsDataItemGuiContext createContext();
184 
185  QgsDockBrowserTreeView *mBrowserView = nullptr;
186  QgsBrowserModel *mModel = nullptr;
187  QgsBrowserProxyModel *mProxyModel = nullptr;
188  QString mInitPath;
189  bool mPropertiesWidgetEnabled;
190  // height fraction
191  float mPropertiesWidgetHeight;
192 
193  QgsMessageBar *mMessageBar = nullptr;
194 
195 };
196 
197 
198 
199 #endif // QGSBROWSERDOCKWIDGET_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:45
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:99
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
A model for showing available data sources and other items in a structured tree.
Item that represents a layer that can be opened with one of the providers.
Definition: qgsdataitem.h:436