16#ifndef QGSNEWVECTORTABLEDIALOG_H
17#define QGSNEWVECTORTABLEDIALOG_H
19#include "ui_qgsnewvectortabledialogbase.h"
29#include <QStyledItemDelegate>
31class QgsNewVectorTableFieldModel;
127 QgsNewVectorTableFieldModel *mFieldModel =
nullptr;
128 int mCurrentRow = -1;
130 QStringList mTableNames;
131 QStringList mValidationErrors;
133 QSet<QString> mIllegalFieldNames;
135 void updateButtons();
136 void selectRow(
int row );
141 void showEvent( QShowEvent *event )
override;
148class QgsNewVectorTableDialogFieldsDelegate :
public QStyledItemDelegate
152 QgsNewVectorTableDialogFieldsDelegate(
const QList<QgsVectorDataProvider::NativeType> &typeList, QObject *parent =
nullptr );
155 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
156 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
157 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
161 void onFieldTypeChanged(
int index );
164 const QList<QgsVectorDataProvider::NativeType> mTypeList;
183 QgsNewVectorTableFieldModel(
const QList<QgsVectorDataProvider::NativeType> &nativeTypes, QObject *parent =
nullptr );
186 int columnCount(
const QModelIndex & )
const override;
187 QVariant
data(
const QModelIndex &index,
int role )
const override;
188 bool setData(
const QModelIndex &index,
const QVariant &value,
int role )
override;
189 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
190 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
192 QList<QgsVectorDataProvider::NativeType> nativeTypes()
const;
193 QgsVectorDataProvider::NativeType nativeType(
const QString &typeName )
const;
194 QgsVectorDataProvider::NativeType nativeType(
int row )
const;
197 const QList<QgsVectorDataProvider::NativeType> mNativeTypes;
198 QString typeDesc(
const QString &typeName )
const;
199 QMetaType::Type type(
const QString &typeName )
const;
WkbType
The WKB type describes the number of dimensions a geometry has.
Provides common functionality for database based connections.
Represents a coordinate reference system (CRS).
A model which displays the list of fields in widgets (optionally associated with a vector layer).
int columnCount(const QModelIndex &parent) const override
QVariant data(const QModelIndex &index, int role) const override
Container of fields for a vector layer.
QString schemaName() const
Returns the schema name.
bool createSpatialIndex()
Returns true if spatialindex checkbox is checked.
void setGeometryType(Qgis::WkbType type)
Sets the geometry type.
QgsFields fields() const
Returns the fields.
QStringList validationErrors() const
Returns the validation errors or an empty list if the dialog is valid.
void setFields(const QgsFields &fields)
Sets the fields to fields.
QgsCoordinateReferenceSystem crs() const
Returns the CRS.
QString tableName() const
Returns the table name.
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the CRS to crs.
QString geometryColumnName() const
Returns the geometry column name.
void setSchemaName(const QString &name)
Sets the schema name.
Qgis::WkbType geometryType() const
Returns the geometry type.
QgsNewVectorTableDialog(QgsAbstractDatabaseProviderConnection *conn, QWidget *parent=nullptr)
QgsNewVectorTableDialog constructor.
void setTableName(const QString &name)
Sets the table name.
void showEvent(QShowEvent *event) override