QGIS API Documentation  3.4.15-Madeira (e83d02e274)
qgsbrowserdockwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsbrowserdockwidget.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 QGSBROWSERDOCKWIDGET_H
16 #define QGSBROWSERDOCKWIDGET_H
17 
18 #include "ui_qgsbrowserdockwidgetbase.h"
19 #include "ui_qgsbrowserlayerpropertiesbase.h"
20 #include "ui_qgsbrowserdirectorypropertiesbase.h"
21 #include "ui_qgsbrowserpropertiesdialogbase.h"
22 
23 #include "qgsdataitem.h"
24 #include "qgsbrowsertreeview.h"
25 #include "qgsdockwidget.h"
26 #include "qgsbrowserdockwidget_p.h"
27 #include "qgis_gui.h"
28 #include <QSortFilterProxyModel>
29 
30 class QgsBrowserModel;
31 class QModelIndex;
32 class QgsDockBrowserTreeView;
33 class QgsLayerItem;
34 class QgsDataItem;
36 
42 class GUI_EXPORT QgsBrowserDockWidget : public QgsDockWidget, private Ui::QgsBrowserDockWidgetBase
43 {
44  Q_OBJECT
45  public:
46 
53  explicit QgsBrowserDockWidget( const QString &name, QgsBrowserModel *browserModel, QWidget *parent SIP_TRANSFERTHIS = nullptr );
54  ~QgsBrowserDockWidget() override;
56  void addFavoriteDirectory( const QString &favDir, const QString &name = QString() );
57 
58  public slots:
60  void addLayerAtIndex( const QModelIndex &index );
62  void showContextMenu( QPoint );
63 
65  void addFavorite();
67  void addFavoriteDirectory();
69  void removeFavorite();
70 
72  void refresh();
73 
75  void showFilterWidget( bool visible );
77  void enablePropertiesWidget( bool enable );
79  void setFilterSyntax( QAction * );
81  void setCaseSensitive( bool caseSensitive );
83  void setFilter();
85  void updateProjectHome();
86 
88  void addSelectedLayers();
90  void showProperties();
92  void hideItem();
94  void toggleFastScan();
95 
97  void selectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
99  void splitterMoved();
100 
101  signals:
103  void openFile( const QString &fileName, const QString &fileTypeHint = QString() );
105  void handleDropUriList( const QgsMimeDataUtils::UriList & );
107  void connectionsChanged();
108 
109  protected:
111  void showEvent( QShowEvent *event ) override;
112 
113  private slots:
114  void itemDoubleClicked( const QModelIndex &index );
115  void renameFavorite();
116 
117  private:
119  void refreshModel( const QModelIndex &index );
121  void addLayer( QgsLayerItem *layerItem );
123  void clearPropertiesWidget();
125  void setPropertiesWidget();
126 
128  int selectedItemsCount();
130  QString settingsSection() { return objectName().toLower(); }
131 
132  QgsDockBrowserTreeView *mBrowserView = nullptr;
133  QgsBrowserModel *mModel = nullptr;
134  QgsBrowserProxyModel *mProxyModel = nullptr;
135  QString mInitPath;
136  bool mPropertiesWidgetEnabled;
137  // height fraction
138  float mPropertiesWidgetHeight;
139 
140 };
141 
142 
143 
144 #endif // QGSBROWSERDOCKWIDGET_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
QgsDockWidget subclass with more fine-grained control over how the widget is closed or opened...
Definition: qgsdockwidget.h:31
void showEvent(QShowEvent *event) override
Base class for all items in the model.
Definition: qgsdataitem.h:49
The QgsBrowserDockWidget class.
A QSortFilterProxyModel subclass for filtering and sorting browser model items.
QList< QgsMimeDataUtils::Uri > UriList
A model for showing available data sources and other items in a structured tree.
Item that represents a layer that can be opened with one of the providers.
Definition: qgsdataitem.h:435