16 #ifndef QGSNEWVECTORTABLEDIALOG_H
17 #define QGSNEWVECTORTABLEDIALOG_H
19 #include <QStyledItemDelegate>
29 #include "ui_qgsnewvectortabledialogbase.h"
31 class QgsNewVectorTableFieldModel;
61 void setSchemaName(
const QString &name );
66 void setTableName(
const QString &name );
86 QString tableName()
const;
91 QString schemaName()
const;
96 QString geometryColumnName()
const;
111 void setFields(
const QgsFields &fields );
117 bool createSpatialIndex();
122 QStringList validationErrors()
const;
127 QgsNewVectorTableFieldModel *mFieldModel =
nullptr;
128 int mCurrentRow = -1;
130 QStringList mTableNames;
131 QStringList mValidationErrors;
133 void updateButtons();
134 void selectRow(
int row );
139 void showEvent( QShowEvent *event )
override;
147 class QgsNewVectorTableDialogFieldsDelegate:
public QStyledItemDelegate
151 QgsNewVectorTableDialogFieldsDelegate(
const QList< QgsVectorDataProvider::NativeType> &typeList, QObject *parent =
nullptr );
154 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
155 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
156 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
160 void onFieldTypeChanged(
int index );
164 const QList< QgsVectorDataProvider::NativeType> mTypeList;
184 QgsNewVectorTableFieldModel(
const QList< QgsVectorDataProvider::NativeType> &nativeTypes, QObject *parent =
nullptr );
187 int columnCount(
const QModelIndex & )
const override;
188 QVariant
data(
const QModelIndex &index,
int role )
const override;
189 bool setData(
const QModelIndex &index,
const QVariant &value,
int role )
override;
190 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
191 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
193 QList<QgsVectorDataProvider::NativeType> nativeTypes()
const;
199 const QList< QgsVectorDataProvider::NativeType> mNativeTypes;
200 QString typeDesc(
const QString &
typeName )
const;
201 QVariant::Type type(
const QString &
typeName )
const;
The QgsAbstractDatabaseProviderConnection class provides common functionality for DB based connection...
This class represents a coordinate reference system (CRS).
The QgsFieldModel class is a model to display the list of fields in widgets (optionally associated wi...
int columnCount(const QModelIndex &parent) const override
QVariant data(const QModelIndex &index, int role) const override
Container of fields for a vector layer.
The QgsNewVectorTableDialog class is a provider-agnostic database vector and aspatial table designer ...
Type
The WKB type describes the number of dimensions a geometry has.
const QgsCoordinateReferenceSystem & crs