QGIS API Documentation  3.6.0-Noosa (5873452)
qgsdatasourceselectdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdatasourceselectdialog.h - QgsDataSourceSelectDialog
3 
4  ---------------------
5  begin : 1.11.2018
6  copyright : (C) 2018 by Alessandro Pasotti
7  email : [email protected]
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 #ifndef QGSDATASOURCESELECTDIALOG_H
17 #define QGSDATASOURCESELECTDIALOG_H
18 
19 #include <QObject>
20 #include "ui_qgsdatasourceselectdialog.h"
21 
22 #include "qgis_gui.h"
23 #include "qgsmaplayer.h"
24 #include "qgsmimedatautils.h"
25 #include "qgsbrowsermodel.h"
26 #include "qgsbrowserproxymodel.h"
27 
28 
44 class GUI_EXPORT QgsDataSourceSelectDialog: public QDialog, private Ui::QgsDataSourceSelectDialog
45 {
46  Q_OBJECT
47 
48  public:
49 
58  QgsDataSourceSelectDialog( QgsBrowserModel *browserModel = nullptr,
59  bool setFilterByLayerType = false,
60  const QgsMapLayer::LayerType &layerType = QgsMapLayer::LayerType::VectorLayer,
61  QWidget *parent = nullptr );
62 
63 
64  ~QgsDataSourceSelectDialog() override;
65 
69  void setLayerTypeFilter( QgsMapLayer::LayerType layerType );
70 
74  QgsMimeDataUtils::Uri uri() const;
75 
77  void showFilterWidget( bool visible );
79  void setFilterSyntax( QAction * );
81  void setCaseSensitive( bool caseSensitive );
83  void setFilter();
85  void showEvent( QShowEvent *e ) override;
86 
87  private slots:
88 
90  void onLayerSelected( const QModelIndex &index );
91 
92  private:
93 
95  void refreshModel( const QModelIndex &index );
96 
97  QgsBrowserProxyModel mBrowserProxyModel;
98  std::unique_ptr<QgsBrowserModel> mBrowserModel;
99  bool mOwnModel = true;
101 
102 };
103 
104 #endif // QGSDATASOURCESELECTDIALOG_H
The QgsDataSourceSelectDialog class embeds the browser view to select an existing data source...
LayerType
Types of layers that can be added to a map.
Definition: qgsmaplayer.h:106
A QSortFilterProxyModel subclass for filtering and sorting browser model items.
A model for showing available data sources and other items in a structured tree.