QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
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 "ui_qgssublayersdialogbase.h"
20
21#include "qgis.h"
22#include "qgis_gui.h"
23#include "qgis_sip.h"
24
25#include <QCheckBox>
26#include <QDialog>
27
34class GUI_EXPORT QgsSublayersDialog : public QDialog, private Ui::QgsSublayersDialogBase
35{
36 Q_OBJECT
37 public:
65 Q_ENUM( PromptMode )
66
74
79 {
81 int layerId = -1;
82
84 QString layerName;
85
87 int count = -1;
88
90 QString type;
91
97 QString description;
98 };
99
103 typedef QList<QgsSublayersDialog::LayerDefinition> LayerDefinitionList;
104
106
118 Q_DECL_DEPRECATED QgsSublayersDialog( ProviderType providerType, const QString &name, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = Qt::WindowFlags(), const QString &dataSourceUri = QString() ) SIP_DEPRECATED;
119
120 ~QgsSublayersDialog() override;
121
125 void populateLayerTable( const LayerDefinitionList &list );
126
131
136
140 bool showAddToGroupCheckbox() const { return mShowAddToGroupCheckbox; }
141
145 bool addToGroupCheckbox() const { return mCbxAddToGroup->isChecked(); }
146
150 int countColumn() const { return mShowCount ? 2 : -1; }
151
152 public slots:
153 int exec() override;
154
155 private slots:
156 void layersTable_selectionChanged( const QItemSelection &, const QItemSelection & );
157 void mBtnDeselectAll_pressed();
158
159 protected:
163 QString mName;
165
167 bool mShowCount = false;
169 bool mShowType = false;
171 bool mShowDescription = false;
172
173 private:
175 bool mShowAddToGroupCheckbox = false;
176};
177
178#endif
bool mShowType
Whether to show type in the table.
QList< QgsSublayersDialog::LayerDefinition > LayerDefinitionList
List of layer definitions for the purpose of this dialog.
PromptMode
Prompt behavior of the QgsSublayersDialog.
@ PromptNever
never prompt, will not load anything
@ PromptAlways
always ask if there are existing sublayers
@ PromptIfNeeded
always ask if there are existing sublayers, but skip if there are bands for rasters
@ PromptLoadAll
never prompt, but load all sublayers
Q_DECL_DEPRECATED QgsSublayersDialog(ProviderType providerType, const QString &name, QWidget *parent=nullptr, Qt::WindowFlags fl=Qt::WindowFlags(), const QString &dataSourceUri=QString())
Constructor for QgsSublayersDialog.
bool showAddToGroupCheckbox() const
If we should display the add to group checkbox.
LayerDefinitionList selection()
Returns list of selected layers.
bool mShowCount
Whether to show number of features in the table.
void setShowAddToGroupCheckbox(bool showAddToGroupCheckbox)
Set if we should display the add to group checkbox.
bool mShowDescription
Whether to show description in the table.
void populateLayerTable(const LayerDefinitionList &list)
Populate the table with layers.
int countColumn() const
Returns column with count or -1.
bool addToGroupCheckbox() const
If we should add layers in a group.
QString mName
Provider type name.
#define SIP_DEPRECATED
Definition qgis_sip.h:114
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
A structure that defines layers for the purpose of this dialog.
QString layerName
Name of the layer (not necessarily unique).
QString type
Extra type depending on the use (e.g. geometry type for vector sublayers).
int count
Number of features (might be unused).
int layerId
Identifier of the layer (one unique layer id may have multiple types though).