Skip to content
Permalink
Browse files

rename QgsAttributeTypeDialog::setWidgetV2Config & QgsAttributeTypeDi…

…alog::setWidgetV2Type
  • Loading branch information
jef-n committed Aug 10, 2016
1 parent 6306fb8 commit f2d6209e9ed9d8f1ba48b4588c880665f3ff5bae
@@ -125,7 +125,7 @@ const QgsEditorWidgetConfig QgsAttributeTypeDialog::editorWidgetConfig()
return QgsEditorWidgetConfig();
}

void QgsAttributeTypeDialog::setWidgetV2Type( const QString& type )
void QgsAttributeTypeDialog::setWidgetType( const QString& type )
{
for ( int i = 0; i < selectionListWidget->count(); i++ )
{
@@ -147,7 +147,7 @@ void QgsAttributeTypeDialog::setWidgetV2Type( const QString& type )

if ( cfgWdg )
{
cfgWdg->setConfig( mWidgetV2Config );
cfgWdg->setConfig( mWidgetConfig );

stackedWidget->addWidget( cfgWdg );
stackedWidget->setCurrentWidget( cfgWdg );
@@ -160,9 +160,9 @@ void QgsAttributeTypeDialog::setWidgetV2Type( const QString& type )
}
}

void QgsAttributeTypeDialog::setWidgetV2Config( const QgsEditorWidgetConfig& config )
void QgsAttributeTypeDialog::setWidgetConfig( const QgsEditorWidgetConfig& config )
{
mWidgetV2Config = config;
mWidgetConfig = config;
}

bool QgsAttributeTypeDialog::fieldEditable() const
@@ -219,5 +219,5 @@ void QgsAttributeTypeDialog::on_selectionListWidget_currentRowChanged( int index
{
const QString editType = selectionListWidget->item( index )->data( Qt::UserRole ).toString();

setWidgetV2Type( editType );
setWidgetType( editType );
}
@@ -41,11 +41,11 @@ class APP_EXPORT QgsAttributeTypeDialog: public QDialog, private Ui::QgsAttribut

const QString editorWidgetText();

void setWidgetV2Type( const QString& type );
void setWidgetType( const QString& type );

const QgsEditorWidgetConfig editorWidgetConfig();

void setWidgetV2Config( const QgsEditorWidgetConfig& config );
void setWidgetConfig( const QgsEditorWidgetConfig& config );

/**
* Setter for checkbox to label on top
@@ -115,7 +115,7 @@ class APP_EXPORT QgsAttributeTypeDialog: public QDialog, private Ui::QgsAttribut
QgsVectorLayer *mLayer;
int mFieldIdx;

QgsEditorWidgetConfig mWidgetV2Config;
QgsEditorWidgetConfig mWidgetConfig;

//! Cached configuration dialog (lazy loaded)
QMap< QString, QgsEditorConfigWidget* > mEditorConfigWidgets;
@@ -323,7 +323,7 @@ void QgsFieldsProperties::setRow( int row, int idx, const QgsField& field )

FieldConfig cfg( mLayer, idx );
QPushButton *pb;
pb = new QPushButton( QgsEditorWidgetRegistry::instance()->name( cfg.mEditorWidgetV2Type ) );
pb = new QPushButton( QgsEditorWidgetRegistry::instance()->name( cfg.mEditorWidgetType ) );
cfg.mButton = pb;
mFieldsList->setCellWidget( row, attrEditTypeCol, pb );

@@ -545,8 +545,8 @@ void QgsFieldsProperties::attributeTypeDialog()
attributeTypeDialog.setExpression( cfg.mConstraint );
attributeTypeDialog.setExpressionDescription( cfg.mConstraintDescription );

attributeTypeDialog.setWidgetV2Config( cfg.mEditorWidgetV2Config );
attributeTypeDialog.setWidgetV2Type( cfg.mEditorWidgetV2Type );
attributeTypeDialog.setWidgetConfig( cfg.mEditorWidgetConfig );
attributeTypeDialog.setWidgetType( cfg.mEditorWidgetType );

if ( !attributeTypeDialog.exec() )
return;
@@ -557,8 +557,8 @@ void QgsFieldsProperties::attributeTypeDialog()
cfg.mConstraintDescription = attributeTypeDialog.expressionDescription();
cfg.mConstraint = attributeTypeDialog.expression();

cfg.mEditorWidgetV2Type = attributeTypeDialog.editorWidgetType();
cfg.mEditorWidgetV2Config = attributeTypeDialog.editorWidgetConfig();
cfg.mEditorWidgetType = attributeTypeDialog.editorWidgetType();
cfg.mEditorWidgetConfig = attributeTypeDialog.editorWidgetConfig();

pb->setText( attributeTypeDialog.editorWidgetText() );

@@ -932,8 +932,8 @@ void QgsFieldsProperties::apply()
mLayer->editFormConfig()->setExpressionDescription( i, cfg.mConstraintDescription );
mLayer->editFormConfig()->setExpression( i, cfg.mConstraint );

mLayer->editFormConfig()->setWidgetType( idx, cfg.mEditorWidgetV2Type );
mLayer->editFormConfig()->setWidgetConfig( idx, cfg.mEditorWidgetV2Config );
mLayer->editFormConfig()->setWidgetType( idx, cfg.mEditorWidgetType );
mLayer->editFormConfig()->setWidgetConfig( idx, cfg.mEditorWidgetConfig );

if ( mFieldsList->item( i, attrWMSCol )->checkState() == Qt::Unchecked )
{
@@ -1013,9 +1013,8 @@ QgsFieldsProperties::FieldConfig::FieldConfig( QgsVectorLayer* layer, int idx )
mNotNull = layer->editFormConfig()->notNull( idx );
mConstraint = layer->editFormConfig()->expression( idx );
mConstraintDescription = layer->editFormConfig()->expressionDescription( idx );
mEditorWidgetV2Type = layer->editFormConfig()->widgetType( idx );
mEditorWidgetV2Config = layer->editFormConfig()->widgetConfig( idx );

mEditorWidgetType = layer->editFormConfig()->widgetType( idx );
mEditorWidgetConfig = layer->editFormConfig()->widgetConfig( idx );
}

/*
@@ -102,8 +102,8 @@ class APP_EXPORT QgsFieldsProperties : public QWidget, private Ui_QgsFieldsPrope
QString mConstraint;
QString mConstraintDescription;
QPushButton* mButton;
QString mEditorWidgetV2Type;
QMap<QString, QVariant> mEditorWidgetV2Config;
QString mEditorWidgetType;
QMap<QString, QVariant> mEditorWidgetConfig;
};

public:
@@ -30,12 +30,12 @@ QString QgsEditFormConfig::widgetType( int fieldIdx ) const
if ( fieldIdx < 0 || fieldIdx >= mFields.count() )
return "TextEdit";

return mEditorWidgetV2Types.value( mFields.at( fieldIdx ).name(), "TextEdit" );
return mEditorWidgetTypes.value( mFields.at( fieldIdx ).name(), "TextEdit" );
}

QString QgsEditFormConfig::widgetType( const QString& fieldName ) const
{
return mEditorWidgetV2Types.value( fieldName, "TextEdit" );
return mEditorWidgetTypes.value( fieldName, "TextEdit" );
}

QgsEditorWidgetConfig QgsEditFormConfig::widgetConfig( int fieldIdx ) const
@@ -59,7 +59,7 @@ void QgsEditFormConfig::setFields( const QgsFields& fields )
void QgsEditFormConfig::setWidgetType( int attrIdx, const QString& widgetType )
{
if ( attrIdx >= 0 && attrIdx < mFields.count() )
mEditorWidgetV2Types[ mFields.at( attrIdx ).name()] = widgetType;
mEditorWidgetTypes[ mFields.at( attrIdx ).name()] = widgetType;
}

void QgsEditFormConfig::setWidgetConfig( int attrIdx, const QgsEditorWidgetConfig& config )
@@ -685,7 +685,7 @@ class CORE_EXPORT QgsEditFormConfig : public QObject
QMap< QString, bool> mLabelOnTop;
QMap< QString, bool> mNotNull;

QMap<QString, QString> mEditorWidgetV2Types;
QMap<QString, QString> mEditorWidgetTypes;
QMap<QString, QgsEditorWidgetConfig > mWidgetConfigs;

/** Defines the default layout to use for the attribute editor (Drag and drop, UI File, Generated) */

0 comments on commit f2d6209

Please sign in to comment.
You can’t perform that action at this time.