QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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:
43
49 explicit QgsBrowserWidget( QgsBrowserGuiModel *browserModel, QWidget *parent SIP_TRANSFERTHIS = nullptr );
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() );
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
174};
175
176#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.
Definition: qgslayeritem.h:31
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:61
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