QGIS API Documentation  2.99.0-Master (bdf46d7)
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 "qgscontexthelp.h"
23 #include "qgis_gui.h"
24 
28 class GUI_EXPORT QgsSublayersDialog : public QDialog, private Ui::QgsSublayersDialogBase
29 {
30  Q_OBJECT
31  public:
32 
34  {
35  Ogr,
37  Vsifile
38  };
39 
42  typedef struct LayerDefinition
43  {
44  LayerDefinition() : layerId( -1 ), count( -1 ) {}
45 
46  int layerId;
47  QString layerName;
48  int count;
49  QString type;
51 
54  typedef QList<LayerDefinition> LayerDefinitionList;
55 
56  QgsSublayersDialog( ProviderType providerType, const QString &name, QWidget *parent = nullptr, Qt::WindowFlags fl = 0 );
58 
61  void populateLayerTable( const LayerDefinitionList &list );
62 
65  LayerDefinitionList selection();
66 
69  void setShowAddToGroupCheckbox( bool showAddToGroupCheckbox ) { mShowAddToGroupCheckbox = showAddToGroupCheckbox; }
70 
73  bool showAddToGroupCheckbox() const { return mShowAddToGroupCheckbox; }
74 
77  bool addToGroupCheckbox() const { return mCheckboxAddToGroup->isChecked(); }
78 
79  public slots:
80  void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
81  int exec();
82 
83  protected:
84  QString mName;
85  QStringList mSelectedSubLayers;
86  bool mShowCount = false;
87  bool mShowType = false;
88 
89  private:
90 
91  bool mShowAddToGroupCheckbox = false;
92  QCheckBox *mCheckboxAddToGroup = nullptr;
93 };
94 
95 #endif
QString layerName
Name of the layer (not necessarily unique)
int layerId
Identifier of the layer (one unique layer id may have multiple types though)
QList< LayerDefinition > LayerDefinitionList
List of layer definitions for the purpose of this dialog.
QStringList mSelectedSubLayers
static void run(const QString &context)
int count
Number of features (might be unused)
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.
A structure that defines layers for the purpose of this dialog.