QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
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
20#include "qgis_gui.h"
21#include "qgsmimedatautils.h"
22#include "qgspanelwidget.h"
23
25class QgsDockBrowserTreeView;
26class QgsLayerItem;
27class QgsDataItem;
29class QgsMessageBar;
30class QgsMapCanvas;
32
33class QModelIndex;
34class QItemSelection;
35
41class GUI_EXPORT QgsBrowserWidget : public QgsPanelWidget, private Ui::QgsBrowserWidgetBase
42{
43 Q_OBJECT
44 public:
50 explicit QgsBrowserWidget( QgsBrowserGuiModel *browserModel, QWidget *parent SIP_TRANSFERTHIS = nullptr );
52
60 void setMessageBar( QgsMessageBar *bar );
61
68
77 void setMapCanvas( QgsMapCanvas *canvas );
78
86
97 void setDisabledDataItemsKeys( const QStringList &filter );
98
99 public slots:
100
106
112 void setActiveIndex( const QModelIndex &index ) SIP_SKIP;
113
117 void refresh();
118
119 // keep the stable API slim for now!
120#ifndef SIP_RUN
121
122 signals:
124 void openFile( const QString &fileName, const QString &fileTypeHint = QString() );
129
130#endif
131
132 protected:
133 void showEvent( QShowEvent *event ) override;
134
135 private slots:
136 void itemDoubleClicked( const QModelIndex &index );
137 void onOptionsChanged();
138
140 void showContextMenu( QPoint );
141
143 void showFilterWidget( bool visible );
145 void enablePropertiesWidget( bool enable );
146
147 void propertiesWidgetToggled( bool enabled );
148
150 void setFilterSyntax( QAction * );
152 void setCaseSensitive( bool caseSensitive );
154 void setFilter();
155
157 void addSelectedLayers();
159 void showProperties();
161 void hideItem();
162
163 private:
165 void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
167 void splitterMoved();
169 void refreshModel( const QModelIndex &index );
171 void addLayer( QgsLayerItem *layerItem );
173 void clearPropertiesWidget();
175 void setPropertiesWidget();
176
178 int selectedItemsCount();
180 QString settingsSection() { return objectName().toLower(); }
181
182 QgsDataItemGuiContext createContext();
183
184 QgsDockBrowserTreeView *mBrowserView = nullptr;
185 QgsBrowserGuiModel *mModel = nullptr;
186 QgsBrowserProxyModel *mProxyModel = nullptr;
187 QString mInitPath;
188
189 QgsMessageBar *mMessageBar = nullptr;
190 QgsMapCanvas *mMapCanvas = nullptr;
191 QStringList mDisabledDataItemsKeys;
192
194};
195
196#endif // QGSBROWSERWIDGET_H
A model for showing available data sources and other items in a structured tree.
A QSortFilterProxyModel subclass for filtering and sorting browser model items.
QgsBrowserWidget(QgsBrowserGuiModel *browserModel, QWidget *parent=nullptr)
Constructor for QgsBrowserWidget.
void updateProjectHome()
Update project home directory.
void setActiveIndex(const QModelIndex &index)
Sets the selection to index and expands it.
QgsMessageBar * messageBar()
Returns the message bar associated with the widget.
void connectionsChanged()
Connections changed in the browser.
void handleDropUriList(const QgsMimeDataUtils::UriList &)
Emitted when drop uri list needs to be handled.
void showEvent(QShowEvent *event) override
QgsMapCanvas * mapCanvas()
Returns the map canvas associated with the widget.
friend class QgsBrowserDockWidget
void setMapCanvas(QgsMapCanvas *canvas)
Sets a map canvas to use alongside the widget.
~QgsBrowserWidget() override
void setMessageBar(QgsMessageBar *bar)
Sets a message bar to use alongside the widget.
void openFile(const QString &fileName, const QString &fileTypeHint=QString())
Emitted when a file needs to be opened.
void refresh()
Refreshes the browser model and view.
void setDisabledDataItemsKeys(const QStringList &filter)
Sets the customization for data items based on item's data provider key.
Encapsulates the context in which a QgsDataItem is shown within the application GUI.
Base class for all items in the model.
Definition qgsdataitem.h:47
A browser 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
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:134