QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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 
35  {
36  Ogr,
38  Vsifile
39  };
40 
46  {
47  int layerId = -1 ;
48  QString layerName;
49  int count = -1 ;
50  QString type;
51  QString description;
52  };
53 
58  typedef QList<QgsSublayersDialog::LayerDefinition> LayerDefinitionList;
59 
61  QgsSublayersDialog( ProviderType providerType,
62  const QString &name,
63  QWidget *parent SIP_TRANSFERTHIS = nullptr,
64  Qt::WindowFlags fl = nullptr );
65 
66  ~QgsSublayersDialog() override;
67 
72  void populateLayerTable( const LayerDefinitionList &list );
73 
78  LayerDefinitionList selection();
79 
84  void setShowAddToGroupCheckbox( bool showAddToGroupCheckbox ) { mShowAddToGroupCheckbox = showAddToGroupCheckbox; }
85 
90  bool showAddToGroupCheckbox() const { return mShowAddToGroupCheckbox; }
91 
96  bool addToGroupCheckbox() const { return mCheckboxAddToGroup->isChecked(); }
97 
102  int countColumn() const { return mShowCount ? 2 : -1; }
103 
104  public slots:
105  int exec() override;
106 
107  protected:
108  QString mName;
109  QStringList mSelectedSubLayers;
110  bool mShowCount = false;
111  bool mShowType = false;
112  bool mShowDescription = false;
113 
114  private:
115 
116  bool mShowAddToGroupCheckbox = false;
117  QCheckBox *mCheckboxAddToGroup = nullptr;
118 };
119 
120 #endif
QString layerName
Name of the layer (not necessarily unique)
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QList< QgsSublayersDialog::LayerDefinition > LayerDefinitionList
List of layer definitions for the purpose of this dialog.
QStringList mSelectedSubLayers
bool showAddToGroupCheckbox() const
If we should display the add to group checkbox.
void setShowAddToGroupCheckbox(bool showAddToGroupCheckbox)
Set if we should display the add to group checkbox.
QString type
Extra type depending on the use (e.g. geometry type for vector sublayers)
bool addToGroupCheckbox() const
If we should add layers in a group.
int countColumn() const
Returns column with count or -1.
A structure that defines layers for the purpose of this dialog.
QString description
Description. Added in QGIS 3.10.