QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 "ui_qgsdatasourceselectdialog.h"
20 
21 #include "qgis_gui.h"
22 #include "qgsmaplayer.h"
23 #include "qgsmimedatautils.h"
24 #include "qgsbrowsermodel.h"
25 #include "qgsbrowserproxymodel.h"
26 
27 #include <QObject>
28 #include <QLabel>
29 
45 class GUI_EXPORT QgsDataSourceSelectDialog: public QDialog, private Ui::QgsDataSourceSelectDialog
46 {
47  Q_OBJECT
48 
49  public:
50 
59  QgsDataSourceSelectDialog( QgsBrowserModel *browserModel = nullptr,
60  bool setFilterByLayerType = false,
62  QWidget *parent = nullptr );
63 
64 
65  ~QgsDataSourceSelectDialog() override;
66 
70  void setLayerTypeFilter( QgsMapLayerType layerType );
71 
78  void setDescription( const QString &description );
79 
83  QgsMimeDataUtils::Uri uri() const;
84 
86  void showFilterWidget( bool visible );
88  void setFilterSyntax( QAction * );
90  void setCaseSensitive( bool caseSensitive );
92  void setFilter();
94  void showEvent( QShowEvent *e ) override;
95 
96  private slots:
97 
99  void onLayerSelected( const QModelIndex &index );
100 
101  void itemDoubleClicked( const QModelIndex &index );
102 
103  private:
104 
106  void refreshModel( const QModelIndex &index );
107 
108  QgsBrowserProxyModel mBrowserProxyModel;
109  std::unique_ptr<QgsBrowserModel> mBrowserModel;
110  bool mOwnModel = true;
112  QLabel *mDescriptionLabel = nullptr;
113 
114 };
115 
116 #endif // QGSDATASOURCESELECTDIALOG_H
The QgsDataSourceSelectDialog class embeds the browser view to select an existing data source...
A QSortFilterProxyModel subclass for filtering and sorting browser model items.
A model for showing available data sources and other items in a structured tree.
QgsMapLayerType
Types of layers that can be added to a map.
Definition: qgsmaplayer.h:65