QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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 QgsBrowserGuiModel;
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, QgsBrowserGuiModel *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 setActiveIndex( const QModelIndex &index );
133  void updateProjectHome();
134 
136  void addSelectedLayers();
138  void showProperties();
140  void hideItem();
141 
146  Q_DECL_DEPRECATED void toggleFastScan() SIP_DEPRECATED;
147 
148  // TODO QGIS 4.0: make these private
149 
151  void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
153  void splitterMoved();
154 
155  signals:
157  void openFile( const QString &fileName, const QString &fileTypeHint = QString() );
159  void handleDropUriList( const QgsMimeDataUtils::UriList & );
161  void connectionsChanged();
162 
163  protected:
165  void showEvent( QShowEvent *event ) override;
166 
167  private slots:
168  void itemDoubleClicked( const QModelIndex &index );
169 
170  private:
172  void refreshModel( const QModelIndex &index );
174  void addLayer( QgsLayerItem *layerItem );
176  void clearPropertiesWidget();
178  void setPropertiesWidget();
179 
181  int selectedItemsCount();
183  QString settingsSection() { return objectName().toLower(); }
184 
185  QgsDataItemGuiContext createContext();
186 
187  QgsDockBrowserTreeView *mBrowserView = nullptr;
188  QgsBrowserGuiModel *mModel = nullptr;
189  QgsBrowserProxyModel *mProxyModel = nullptr;
190  QString mInitPath;
191  bool mPropertiesWidgetEnabled;
192  // height fraction
193  float mPropertiesWidgetHeight;
194 
195  QgsMessageBar *mMessageBar = nullptr;
196 
197 };
198 
199 
200 
201 #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:452