QGIS API Documentation 3.41.0-Master (d5b93354e9c)
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#include "qgsmimedatautils.h"
20#include "qgspanelwidget.h"
21#include "qgis_gui.h"
22
24class QgsDockBrowserTreeView;
25class QgsLayerItem;
26class QgsDataItem;
28class QgsMessageBar;
30
31class QModelIndex;
32class QItemSelection;
33
39class GUI_EXPORT QgsBrowserWidget : public QgsPanelWidget, private Ui::QgsBrowserWidgetBase
40{
41 Q_OBJECT
42 public:
48 explicit QgsBrowserWidget( QgsBrowserGuiModel *browserModel, QWidget *parent SIP_TRANSFERTHIS = nullptr );
50
58 void setMessageBar( QgsMessageBar *bar );
59
65 QgsMessageBar *messageBar();
66
77 void setDisabledDataItemsKeys( const QStringList &filter );
78
79 public slots:
80
85 void updateProjectHome() SIP_SKIP;
86
92 void setActiveIndex( const QModelIndex &index ) SIP_SKIP;
93
97 void refresh();
98
99 // keep the stable API slim for now!
100#ifndef SIP_RUN
101
102 signals:
104 void openFile( const QString &fileName, const QString &fileTypeHint = QString() );
109
110#endif
111
112 protected:
113 void showEvent( QShowEvent *event ) override;
114
115 private slots:
116 void itemDoubleClicked( const QModelIndex &index );
117 void onOptionsChanged();
118
120 void showContextMenu( QPoint );
121
123 void showFilterWidget( bool visible );
125 void enablePropertiesWidget( bool enable );
126
127 void propertiesWidgetToggled( bool enabled );
128
130 void setFilterSyntax( QAction * );
132 void setCaseSensitive( bool caseSensitive );
134 void setFilter();
135
137 void addSelectedLayers();
139 void showProperties();
141 void hideItem();
142
143 private:
145 void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
147 void splitterMoved();
149 void refreshModel( const QModelIndex &index );
151 void addLayer( QgsLayerItem *layerItem );
153 void clearPropertiesWidget();
155 void setPropertiesWidget();
156
158 int selectedItemsCount();
160 QString settingsSection() { return objectName().toLower(); }
161
162 QgsDataItemGuiContext createContext();
163
164 QgsDockBrowserTreeView *mBrowserView = nullptr;
165 QgsBrowserGuiModel *mModel = nullptr;
166 QgsBrowserProxyModel *mProxyModel = nullptr;
167 QString mInitPath;
168
169 QgsMessageBar *mMessageBar = nullptr;
170 QStringList mDisabledDataItemsKeys;
171
173};
174
175#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.
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