QGIS API Documentation 3.43.0-Master (3ee7834ace6)
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
24class QgsDockBrowserTreeView;
25class QgsLayerItem;
26class QgsDataItem;
28class QgsMessageBar;
29class QgsMapCanvas;
31
32class QModelIndex;
33class QItemSelection;
34
40class GUI_EXPORT QgsBrowserWidget : public QgsPanelWidget, private Ui::QgsBrowserWidgetBase
41{
42 Q_OBJECT
43 public:
49 explicit QgsBrowserWidget( QgsBrowserGuiModel *browserModel, QWidget *parent SIP_TRANSFERTHIS = nullptr );
51
59 void setMessageBar( QgsMessageBar *bar );
60
66 QgsMessageBar *messageBar();
67
76 void setMapCanvas( QgsMapCanvas *canvas );
77
84 QgsMapCanvas *mapCanvas();
85
96 void setDisabledDataItemsKeys( const QStringList &filter );
97
98 public slots:
99
104 void updateProjectHome() SIP_SKIP;
105
111 void setActiveIndex( const QModelIndex &index ) SIP_SKIP;
112
116 void refresh();
117
118 // keep the stable API slim for now!
119#ifndef SIP_RUN
120
121 signals:
123 void openFile( const QString &fileName, const QString &fileTypeHint = QString() );
128
129#endif
130
131 protected:
132 void showEvent( QShowEvent *event ) override;
133
134 private slots:
135 void itemDoubleClicked( const QModelIndex &index );
136 void onOptionsChanged();
137
139 void showContextMenu( QPoint );
140
142 void showFilterWidget( bool visible );
144 void enablePropertiesWidget( bool enable );
145
146 void propertiesWidgetToggled( bool enabled );
147
149 void setFilterSyntax( QAction * );
151 void setCaseSensitive( bool caseSensitive );
153 void setFilter();
154
156 void addSelectedLayers();
158 void showProperties();
160 void hideItem();
161
162 private:
164 void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
166 void splitterMoved();
168 void refreshModel( const QModelIndex &index );
170 void addLayer( QgsLayerItem *layerItem );
172 void clearPropertiesWidget();
174 void setPropertiesWidget();
175
177 int selectedItemsCount();
179 QString settingsSection() { return objectName().toLower(); }
180
181 QgsDataItemGuiContext createContext();
182
183 QgsDockBrowserTreeView *mBrowserView = nullptr;
184 QgsBrowserGuiModel *mModel = nullptr;
185 QgsBrowserProxyModel *mProxyModel = nullptr;
186 QString mInitPath;
187
188 QgsMessageBar *mMessageBar = nullptr;
189 QgsMapCanvas *mMapCanvas = nullptr;
190 QStringList mDisabledDataItemsKeys;
191
193};
194
195#endif // QGSBROWSERWIDGET_H
A dock widget containing a QgsBrowserWidget for navigating and managing data sources.
A model for showing available data sources and other items in a structured tree.
A QSortFilterProxyModel subclass for filtering and sorting browser model items.
A widget showing a browser tree view along with toolbar and toggleable properties pane.
void connectionsChanged()
Connections changed in the browser.
void handleDropUriList(const QgsMimeDataUtils::UriList &)
Emitted when drop uri list needs to be handled.
~QgsBrowserWidget() override
void openFile(const QString &fileName, const QString &fileTypeHint=QString())
Emitted when a file needs to be opened.
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
Item that represents a layer that can be opened with one of the providers.
Map canvas is a class for displaying all GIS data types on a canvas.
A bar for displaying non-blocking messages to the user.
QList< QgsMimeDataUtils::Uri > UriList
Base class for any widget that can be shown as a inline panel.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:126