QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsbrowserwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsbrowserwidget.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 QGSBROWSERWIDGET_H
16 #define QGSBROWSERWIDGET_H
17 
18 #include "ui_qgsbrowserwidgetbase.h"
19 #include "qgsmimedatautils.h"
20 #include "qgspanelwidget.h"
21 #include "qgis_gui.h"
22 
23 class QgsBrowserGuiModel;
24 class QgsDockBrowserTreeView;
25 class QgsLayerItem;
26 class QgsDataItem;
28 class QgsMessageBar;
30 
31 class QModelIndex;
32 class QItemSelection;
33 
39 class GUI_EXPORT QgsBrowserWidget : public QgsPanelWidget, private Ui::QgsBrowserWidgetBase
40 {
41  Q_OBJECT
42  public:
43 
49  explicit QgsBrowserWidget( QgsBrowserGuiModel *browserModel, QWidget *parent SIP_TRANSFERTHIS = nullptr );
50  ~QgsBrowserWidget() override;
51 
59  void setMessageBar( QgsMessageBar *bar );
60 
66  QgsMessageBar *messageBar();
67 
78  void setDisabledDataItemsKeys( const QStringList &filter );
79 
80  public slots:
81 
86  void updateProjectHome() SIP_SKIP;
87 
93  void setActiveIndex( const QModelIndex &index ) SIP_SKIP;
94 
98  void refresh();
99 
100  // keep the stable API slim for now!
101 #ifndef SIP_RUN
102 
103  signals:
105  void openFile( const QString &fileName, const QString &fileTypeHint = QString() );
107  void handleDropUriList( const QgsMimeDataUtils::UriList & );
109  void connectionsChanged();
110 
111 #endif
112 
113  protected:
114  void showEvent( QShowEvent *event ) override;
115 
116  private slots:
117  void itemDoubleClicked( const QModelIndex &index );
118  void onOptionsChanged();
119 
121  void showContextMenu( QPoint );
122 
124  void showFilterWidget( bool visible );
126  void enablePropertiesWidget( bool enable );
127 
128  void propertiesWidgetToggled( bool enabled );
129 
131  void setFilterSyntax( QAction * );
133  void setCaseSensitive( bool caseSensitive );
135  void setFilter();
136 
138  void addSelectedLayers();
140  void showProperties();
142  void hideItem();
143 
144  private:
146  void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
148  void splitterMoved();
150  void refreshModel( const QModelIndex &index );
152  void addLayer( QgsLayerItem *layerItem );
154  void clearPropertiesWidget();
156  void setPropertiesWidget();
157 
159  int selectedItemsCount();
161  QString settingsSection() { return objectName().toLower(); }
162 
163  QgsDataItemGuiContext createContext();
164 
165  QgsDockBrowserTreeView *mBrowserView = nullptr;
166  QgsBrowserGuiModel *mModel = nullptr;
167  QgsBrowserProxyModel *mProxyModel = nullptr;
168  QString mInitPath;
169 
170  QgsMessageBar *mMessageBar = nullptr;
171  QStringList mDisabledDataItemsKeys;
172 
173  friend class QgsBrowserDockWidget;
174 };
175 
176 #endif // QGSBROWSERWIDGET_H
qgsmimedatautils.h
QgsMimeDataUtils::UriList
QList< QgsMimeDataUtils::Uri > UriList
Definition: qgsmimedatautils.h:164
QgsBrowserProxyModel
A QSortFilterProxyModel subclass for filtering and sorting browser model items.
Definition: qgsbrowserproxymodel.h:32
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:29
QgsMessageBar
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:60
QgsDataItemGuiContext
Encapsulates the context in which a QgsDataItem is shown within the application GUI.
Definition: qgsdataitemguiprovider.h:40
QgsLayerItem
Item that represents a layer that can be opened with one of the providers.
Definition: qgslayeritem.h:29
QgsBrowserDockWidget
A dock widget containing a QgsBrowserWidget for navigating and managing data sources.
Definition: qgsbrowserdockwidget.h:31
qgspanelwidget.h
QgsDataItem
Base class for all items in the model.
Definition: qgsdataitem.h:45
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsBrowserGuiModel
A model for showing available data sources and other items in a structured tree.
Definition: qgsbrowserguimodel.h:36
QgsBrowserWidget
A widget showing a browser tree view along with toolbar and toggleable properties pane.
Definition: qgsbrowserwidget.h:39