QGIS API Documentation 3.41.0-Master (cea29feecf2)
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:
47 QgsProviderSublayerDialogModel( QObject *parent = nullptr );
48
49 QVariant data( const QModelIndex &index, int role ) const override;
50 Qt::ItemFlags flags( const QModelIndex &index ) const override;
51
55 void setGeometryTypesResolved( bool resolved );
56
57 private:
58 bool mGeometryTypesResolved = false;
59};
60
68class GUI_EXPORT QgsProviderSublayersDialog : public QDialog, private Ui::QgsProviderSublayersDialogBase
69{
70 Q_OBJECT
71 public:
75 QgsProviderSublayersDialog( const QString &uri, const QString &providerKey, const QString &filePath, const QList<QgsProviderSublayerDetails> initialDetails = QList<QgsProviderSublayerDetails>(), const QList<Qgis::LayerType> &acceptableTypes = QList<Qgis::LayerType>(), QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
76
80 void setNonLayerItems( const QList<QgsProviderSublayerModel::NonLayerItem> &items );
81
83
87 QList<QgsProviderSublayerDetails> selectedLayers() const;
88
92 QList<QgsProviderSublayerModel::NonLayerItem> selectedNonLayerItems() const;
93
97 QString groupName() const;
98
102 void setGroupName( const QString &groupNameIn );
103
104 signals:
105
109 void layersAdded( const QList<QgsProviderSublayerDetails> &layers );
110
111 private slots:
112 void treeSelectionChanged( const QItemSelection &, const QItemSelection & );
113 void selectAll();
114
115 private:
116 QgsProviderSublayerDialogModel *mModel = nullptr;
117 QgsProviderSublayerProxyModel *mProxyModel = nullptr;
118 QPointer<QgsProviderSublayerTask> mTask;
119 QString mGroupName;
120 bool mBlockSelectionChanges = false;
121};
122
123#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