QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgssublayersdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssublayersdialog.h - dialog for selecting sublayers
3  ---------------------
4  begin : January 2009
5  copyright : (C) 2009 by Florian El Ahdab
6  email : felahdab 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 QGSSUBLAYERSDIALOG_H
17 #define QGSSUBLAYERSDIALOG_H
18 
19 #include <QDialog>
20 #include <QCheckBox>
21 #include "ui_qgssublayersdialogbase.h"
22 #include "qgis_sip.h"
23 #include "qgis_gui.h"
24 #include "qgis.h"
25 
31 class GUI_EXPORT QgsSublayersDialog : public QDialog, private Ui::QgsSublayersDialogBase
32 {
33  Q_OBJECT
34  public:
35 
41  {
42 
47 
52 
57 
61  PromptLoadAll
62  };
63  Q_ENUM( PromptMode )
64 
66  {
67  Ogr,
70  Mdal
71  };
72 
78  {
80  int layerId = -1;
81 
83  QString layerName;
84 
86  int count = -1;
87 
89  QString type;
90 
96  QString description;
97  };
98 
103  typedef QList<QgsSublayersDialog::LayerDefinition> LayerDefinitionList;
104 
106 
118  Q_DECL_DEPRECATED QgsSublayersDialog( ProviderType providerType,
119  const QString &name,
120  QWidget *parent SIP_TRANSFERTHIS = nullptr,
121  Qt::WindowFlags fl = Qt::WindowFlags(),
122  const QString &dataSourceUri = QString() ) SIP_DEPRECATED;
123 
124  ~QgsSublayersDialog() override;
125 
130  void populateLayerTable( const LayerDefinitionList &list );
131 
136  LayerDefinitionList selection();
137 
142  void setShowAddToGroupCheckbox( bool showAddToGroupCheckbox ) { mShowAddToGroupCheckbox = showAddToGroupCheckbox; }
143 
148  bool showAddToGroupCheckbox() const { return mShowAddToGroupCheckbox; }
149 
154  bool addToGroupCheckbox() const { return mCbxAddToGroup->isChecked(); }
155 
160  int countColumn() const { return mShowCount ? 2 : -1; }
161 
162  public slots:
163  int exec() override;
164 
165  private slots:
166  void layersTable_selectionChanged( const QItemSelection &, const QItemSelection & );
167  void mBtnDeselectAll_pressed();
168 
169  protected:
170 
174  QString mName;
175  QStringList mSelectedSubLayers;
176 
178  bool mShowCount = false;
180  bool mShowType = false;
182  bool mShowDescription = false;
183 
184  private:
186  bool mShowAddToGroupCheckbox = false;
187 };
188 
189 #endif
QgsSublayersDialog::PromptNever
@ PromptNever
never prompt, will not load anything
Definition: qgssublayersdialog.h:56
QgsSublayersDialog::PromptMode
PromptMode
Prompt behavior of the QgsSublayersDialog.
Definition: qgssublayersdialog.h:40
QgsSublayersDialog::addToGroupCheckbox
bool addToGroupCheckbox() const
If we should add layers in a group.
Definition: qgssublayersdialog.h:154
qgis.h
QgsSublayersDialog::PromptAlways
@ PromptAlways
always ask if there are existing sublayers
Definition: qgssublayersdialog.h:46
QgsSublayersDialog::ProviderType
ProviderType
Definition: qgssublayersdialog.h:65
QgsSublayersDialog::LayerDefinition::layerName
QString layerName
Name of the layer (not necessarily unique)
Definition: qgssublayersdialog.h:83
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
QgsSublayersDialog::mName
QString mName
Provider type name.
Definition: qgssublayersdialog.h:174
QgsSublayersDialog::Ogr
@ Ogr
Definition: qgssublayersdialog.h:67
QgsSublayersDialog::PromptIfNeeded
@ PromptIfNeeded
always ask if there are existing sublayers, but skip if there are bands for rasters
Definition: qgssublayersdialog.h:51
qgis_sip.h
QgsSublayersDialog::countColumn
int countColumn() const
Returns column with count or -1.
Definition: qgssublayersdialog.h:160
QgsSublayersDialog::LayerDefinition::description
QString description
Description.
Definition: qgssublayersdialog.h:96
QgsSublayersDialog::showAddToGroupCheckbox
bool showAddToGroupCheckbox() const
If we should display the add to group checkbox.
Definition: qgssublayersdialog.h:148
QgsSublayersDialog
Definition: qgssublayersdialog.h:31
QgsSublayersDialog::mSelectedSubLayers
QStringList mSelectedSubLayers
Definition: qgssublayersdialog.h:175
QgsSublayersDialog::Vsifile
@ Vsifile
Definition: qgssublayersdialog.h:69
QgsSublayersDialog::LayerDefinitionList
QList< QgsSublayersDialog::LayerDefinition > LayerDefinitionList
List of layer definitions for the purpose of this dialog.
Definition: qgssublayersdialog.h:103
QgsSublayersDialog::LayerDefinition::type
QString type
Extra type depending on the use (e.g. geometry type for vector sublayers)
Definition: qgssublayersdialog.h:89
QgsSublayersDialog::Gdal
@ Gdal
Definition: qgssublayersdialog.h:68
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsSublayersDialog::LayerDefinition
A structure that defines layers for the purpose of this dialog.
Definition: qgssublayersdialog.h:77