QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgsprovidersublayersdialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprovidersublayersdialog.h
3 ---------------------
4 begin : July 2021
5 copyright : (C) 2021 by Nyall Dawson
6 email : nyall dot dawson 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
16#ifndef QGSPROVIDERSUBLAYERSDIALOG_H
17#define QGSPROVIDERSUBLAYERSDIALOG_H
18
19#include <QDialog>
20#include <QCheckBox>
21#include <QPointer>
22
23#include "qgis_gui.h"
24#include "ui_qgsprovidersublayersdialogbase.h"
27
31
40{
41 Q_OBJECT
42
43 public:
44
48 QgsProviderSublayerDialogModel( QObject *parent = nullptr );
49
50 QVariant data( const QModelIndex &index, int role ) const override;
51 Qt::ItemFlags flags( const QModelIndex &index ) const override;
52
56 void setGeometryTypesResolved( bool resolved );
57
58 private:
59
60 bool mGeometryTypesResolved = false;
61
62
63};
64
72class GUI_EXPORT QgsProviderSublayersDialog : public QDialog, private Ui::QgsProviderSublayersDialogBase
73{
74 Q_OBJECT
75 public:
76
80 QgsProviderSublayersDialog( const QString &uri,
81 const QString &providerKey,
82 const QString &filePath,
83 const QList< QgsProviderSublayerDetails> initialDetails = QList< QgsProviderSublayerDetails>(),
84 const QList< Qgis::LayerType > &acceptableTypes = QList< Qgis::LayerType >(),
85 QWidget *parent SIP_TRANSFERTHIS = nullptr,
86 Qt::WindowFlags fl = Qt::WindowFlags() );
87
91 void setNonLayerItems( const QList< QgsProviderSublayerModel::NonLayerItem > &items );
92
94
98 QList< QgsProviderSublayerDetails > selectedLayers() const;
99
103 QList< QgsProviderSublayerModel::NonLayerItem > selectedNonLayerItems() const;
104
108 QString groupName() const;
109
113 void setGroupName( const QString &groupNameIn );
114
115 signals:
116
120 void layersAdded( const QList< QgsProviderSublayerDetails > &layers );
121
122 private slots:
123 void treeSelectionChanged( const QItemSelection &, const QItemSelection & );
124 void selectAll();
125
126 private:
127
128 QgsProviderSublayerDialogModel *mModel = nullptr;
129 QgsProviderSublayerProxyModel *mProxyModel = nullptr;
130 QPointer< QgsProviderSublayerTask > mTask;
131 QString mGroupName;
132 bool mBlockSelectionChanges = false;
133
134};
135
136#endif // QGSPROVIDERSUBLAYERSDIALOG_H
A model for representing the sublayers present in a URI for the QgsProviderSublayersDialog.
A model for representing the sublayers present in a URI.
QVariant data(const QModelIndex &index, int role) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
A QSortFilterProxyModel for filtering and sorting a QgsProviderSublayerModel.
A QgsTask which retrieves sublayer details for a URI.
Dialog for selecting provider sublayers.
void layersAdded(const QList< QgsProviderSublayerDetails > &layers)
Emitted when sublayers selected from the dialog should be added to the project.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53