QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
29 class GUI_EXPORT QgsSublayersDialog : public QDialog, private Ui::QgsSublayersDialogBase
30 {
31  Q_OBJECT
32  public:
33 
39  {
40 
45 
50 
55 
59  PromptLoadAll
60  };
61  Q_ENUM( PromptMode )
62 
64  {
65  Ogr,
68  Mdal
69  };
70 
76  {
77  int layerId = -1 ;
78  QString layerName;
79  int count = -1 ;
80  QString type;
81  QString description;
82  };
83 
88  typedef QList<QgsSublayersDialog::LayerDefinition> LayerDefinitionList;
89 
91 
101  QgsSublayersDialog( ProviderType providerType,
102  const QString &name,
103  QWidget *parent SIP_TRANSFERTHIS = nullptr,
104  Qt::WindowFlags fl = nullptr,
105  const QString &dataSourceUri = QString() );
106 
107  ~QgsSublayersDialog() override;
108 
113  void populateLayerTable( const LayerDefinitionList &list );
114 
119  LayerDefinitionList selection();
120 
125  void setShowAddToGroupCheckbox( bool showAddToGroupCheckbox ) { mShowAddToGroupCheckbox = showAddToGroupCheckbox; }
126 
131  bool showAddToGroupCheckbox() const { return mShowAddToGroupCheckbox; }
132 
137  bool addToGroupCheckbox() const { return mCbxAddToGroup->isChecked(); }
138 
143  int countColumn() const { return mShowCount ? 2 : -1; }
144 
145  public slots:
146  int exec() override;
147 
148  private slots:
149  void layersTable_selectionChanged( const QItemSelection &, const QItemSelection & );
150  void mBtnDeselectAll_pressed();
151 
152  protected:
153 
157  QString mName;
158  QStringList mSelectedSubLayers;
159  bool mShowCount = false;
160  bool mShowType = false;
161  bool mShowDescription = false;
162 
163  private:
164 
165  bool mShowAddToGroupCheckbox = false;
166 };
167 
168 #endif
QgsSublayersDialog::PromptNever
@ PromptNever
never prompt, will not load anything
Definition: qgssublayersdialog.h:54
QgsSublayersDialog::PromptMode
PromptMode
Prompt behavior of the QgsSublayersDialog.
Definition: qgssublayersdialog.h:38
QgsSublayersDialog::addToGroupCheckbox
bool addToGroupCheckbox() const
If we should add layers in a group.
Definition: qgssublayersdialog.h:137
QgsSublayersDialog::PromptAlways
@ PromptAlways
always ask if there are existing sublayers
Definition: qgssublayersdialog.h:44
QgsSublayersDialog::ProviderType
ProviderType
Definition: qgssublayersdialog.h:63
QgsSublayersDialog::LayerDefinition::layerName
QString layerName
Name of the layer (not necessarily unique)
Definition: qgssublayersdialog.h:78
QgsSublayersDialog::setShowAddToGroupCheckbox
void setShowAddToGroupCheckbox(bool showAddToGroupCheckbox)
Set if we should display the add to group checkbox.
Definition: qgssublayersdialog.h:125
QgsSublayersDialog::mName
QString mName
Provider type name.
Definition: qgssublayersdialog.h:157
QgsSublayersDialog::Ogr
@ Ogr
Definition: qgssublayersdialog.h:65
QgsSublayersDialog::PromptIfNeeded
@ PromptIfNeeded
always ask if there are existing sublayers, but skip if there are bands for rasters
Definition: qgssublayersdialog.h:49
qgis_sip.h
QgsSublayersDialog::countColumn
int countColumn() const
Returns column with count or -1.
Definition: qgssublayersdialog.h:143
QgsSublayersDialog::LayerDefinition::description
QString description
Description. Added in QGIS 3.10.
Definition: qgssublayersdialog.h:81
QgsSublayersDialog::showAddToGroupCheckbox
bool showAddToGroupCheckbox() const
If we should display the add to group checkbox.
Definition: qgssublayersdialog.h:131
QgsSublayersDialog
Definition: qgssublayersdialog.h:29
QgsSublayersDialog::mSelectedSubLayers
QStringList mSelectedSubLayers
Definition: qgssublayersdialog.h:158
QgsSublayersDialog::Vsifile
@ Vsifile
Definition: qgssublayersdialog.h:67
QgsSublayersDialog::LayerDefinitionList
QList< QgsSublayersDialog::LayerDefinition > LayerDefinitionList
List of layer definitions for the purpose of this dialog.
Definition: qgssublayersdialog.h:88
QgsSublayersDialog::LayerDefinition::type
QString type
Extra type depending on the use (e.g. geometry type for vector sublayers)
Definition: qgssublayersdialog.h:80
QgsSublayersDialog::Gdal
@ Gdal
Definition: qgssublayersdialog.h:66
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:75