mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-16 00:05:45 -04:00
fix edit widget deprecation warnings and sync sip bindings
This commit is contained in:
parent
d1da612300
commit
0903684314
@ -118,9 +118,12 @@ class QgsVectorLayer : QgsMapLayer
|
||||
{
|
||||
GeneratedLayout,
|
||||
TabLayout,
|
||||
UiFileLayout,
|
||||
UiFileLayout
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated Use the editorWidgetV2() system instead
|
||||
*/
|
||||
enum EditType
|
||||
{
|
||||
LineEdit,
|
||||
@ -758,16 +761,38 @@ class QgsVectorLayer : QgsMapLayer
|
||||
*
|
||||
* @return The id for the editor widget or a NULL string if not applicable
|
||||
*/
|
||||
const QString editorWidgetV2( int fieldIdx );
|
||||
const QString editorWidgetV2( int fieldIdx ) const;
|
||||
|
||||
/**
|
||||
* Get the id for the editor widget used to represent the field at the given index
|
||||
*
|
||||
* @param fieldName The name of the field
|
||||
*
|
||||
* @return The id for the editor widget or a NULL string if not applicable
|
||||
*
|
||||
* @note python method name editorWidgetV2ByName
|
||||
*/
|
||||
const QString editorWidgetV2( const QString& fieldName ) const /PyName=editorWidgetV2ByName/;
|
||||
|
||||
/**
|
||||
* Get the configuration for the editor widget used to represent the field at the given index
|
||||
*
|
||||
* @param fieldIdx The index of the field
|
||||
*
|
||||
* @return The id for the editor widget or a NULL string if not configured
|
||||
* @return The configuration for the editor widget or an empty config if the field does not exist
|
||||
*/
|
||||
const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx );
|
||||
const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx ) const;
|
||||
|
||||
/**
|
||||
* Get the configuration for the editor widget used to represent the field at the given index
|
||||
*
|
||||
* @param fieldName The name of the field
|
||||
*
|
||||
* @return The configuration for the editor widget or an empty config if the field does not exist
|
||||
*
|
||||
* @note python method name is editorWidgetV2ConfigByName
|
||||
*/
|
||||
const QgsEditorWidgetConfig editorWidgetV2Config( const QString& fieldName ) const /PyName=editorWidgetV2ConfigByName/;
|
||||
|
||||
/**
|
||||
* Returns a list of tabs holding groups and fields
|
||||
@ -841,11 +866,19 @@ class QgsVectorLayer : QgsMapLayer
|
||||
*/
|
||||
bool rollBack( bool deleteBuffer = true );
|
||||
|
||||
/**get edit type*/
|
||||
EditType editType( int idx );
|
||||
/**
|
||||
* Get edit type
|
||||
*
|
||||
* @deprecated Use @see{editorWidgetV2} instead
|
||||
*/
|
||||
EditType editType( int idx ) /Deprecated/;
|
||||
|
||||
/**set edit type*/
|
||||
void setEditType( int idx, EditType edit );
|
||||
/**
|
||||
* Get edit type
|
||||
*
|
||||
* @deprecated Use @see{setEditorWidgetV2} instead
|
||||
*/
|
||||
void setEditType( int idx, EditType edit ) /Deprecated/;
|
||||
|
||||
/** get the active layout for the attribute editor for this layer (added in 1.9) */
|
||||
EditorLayout editorLayout();
|
||||
@ -853,12 +886,28 @@ class QgsVectorLayer : QgsMapLayer
|
||||
/** set the active layout for the attribute editor for this layer (added in 1.9) */
|
||||
void setEditorLayout( EditorLayout editorLayout );
|
||||
|
||||
/**
|
||||
* Set the editor widget type for a field
|
||||
*
|
||||
* @param attrIdx Index of the field
|
||||
* @param widgetType Type id of the editor widget to use
|
||||
*/
|
||||
void setEditorWidgetV2( int attrIdx, const QString& widgetType );
|
||||
|
||||
/**
|
||||
* Set the editor widget config for a field
|
||||
*
|
||||
* @param attrIdx Index of the field
|
||||
* @param config The config to set for this field
|
||||
*/
|
||||
void setEditorWidgetV2Config( int attrIdx, const QMap<QString, QVariant>& config );
|
||||
|
||||
/** set string representing 'true' for a checkbox (added in 1.4) */
|
||||
void setCheckedState( int idx, QString checked, QString notChecked );
|
||||
/**
|
||||
* Set string representing 'true' for a checkbox (added in 1.4)
|
||||
*
|
||||
* @deprecated Use @see{setEditorWidgetV2Config} instead
|
||||
*/
|
||||
void setCheckedState( int idx, QString checked, QString notChecked ) /Deprecated/;
|
||||
|
||||
/** get edit form (added in 1.4) */
|
||||
QString editForm();
|
||||
@ -886,16 +935,25 @@ class QgsVectorLayer : QgsMapLayer
|
||||
/** set python function for edit form initialization (added in 1.4) */
|
||||
void setEditFormInit( QString function );
|
||||
|
||||
/**access value map*/
|
||||
QMap<QString, QVariant> valueMap( int idx );
|
||||
/**
|
||||
* Access value map
|
||||
* @deprecated Use @see{editorWidgetV2Config} instead
|
||||
*/
|
||||
QMap<QString, QVariant> valueMap( int idx ) /Deprecated/;
|
||||
|
||||
/**access range */
|
||||
/**
|
||||
* Access range widget config data
|
||||
*
|
||||
* @deprecated Use @see{editorWidgetV2Config} instead
|
||||
*/
|
||||
RangeData range( int idx ) /Deprecated/;
|
||||
|
||||
/**access relations
|
||||
/**
|
||||
* Access value relation widget data
|
||||
*
|
||||
* @note added in 1.8
|
||||
**/
|
||||
ValueRelationData valueRelation( int idx ) /Deprecated/;
|
||||
*/
|
||||
ValueRelationData valueRelation( int idx );
|
||||
|
||||
/**
|
||||
* Get relations, where the foreign key is on this layer
|
||||
@ -905,13 +963,21 @@ class QgsVectorLayer : QgsMapLayer
|
||||
*/
|
||||
QList<QgsRelation> referencingRelations( int idx );
|
||||
|
||||
/**access date format
|
||||
/**
|
||||
* Access date format
|
||||
*
|
||||
* @note added in 1.9
|
||||
*
|
||||
* @deprecated Use @see{setEditorWdigetV2Config} instead
|
||||
*/
|
||||
QString dateFormat( int idx ) /Deprecated/;
|
||||
|
||||
/**access widget size for photo and webview widget
|
||||
/**
|
||||
* Access widget size for photo and webview widget
|
||||
*
|
||||
* @note added in 1.9
|
||||
*
|
||||
* @deprecated Use @see{setEditorWdigetV2Config} instead
|
||||
*/
|
||||
QSize widgetSize( int idx ) /Deprecated/;
|
||||
|
||||
@ -1110,6 +1176,9 @@ class QgsVectorLayer : QgsMapLayer
|
||||
/** This signal is emitted when modifications has been done on layer */
|
||||
void layerModified();
|
||||
|
||||
/** Is emitted, when layer is checked for modifications. Use for last-minute additions */
|
||||
void beforeModifiedCheck() const;
|
||||
|
||||
/** Is emitted, when editing on this layer has started*/
|
||||
void editingStarted();
|
||||
|
||||
@ -1179,6 +1248,27 @@ class QgsVectorLayer : QgsMapLayer
|
||||
/** Signal emitted when setLayerTransparency() is called */
|
||||
void layerTransparencyChanged( int layerTransparency );
|
||||
|
||||
/**
|
||||
* Signal emitted when a new edit command has been started
|
||||
*
|
||||
* @param text Description for this edit command
|
||||
*/
|
||||
void editCommandStarted( const QString& text );
|
||||
|
||||
/**
|
||||
* Signal emitted, when an edit command successfully ended
|
||||
* @note This does not mean it is also committed, only that it is written
|
||||
* to the edit buffer. See {@link beforeCommitChanges()}
|
||||
*/
|
||||
void editCommandEnded();
|
||||
|
||||
/**
|
||||
* Signal emitted, whan an edit command is destroyed
|
||||
* @note This is not a rollback, it is only related to the current edit command.
|
||||
* See {@link beforeRollBack()}
|
||||
*/
|
||||
void editCommandDestroyed();
|
||||
|
||||
protected:
|
||||
/** Set the extent */
|
||||
void setExtent( const QgsRectangle &rect );
|
||||
|
@ -90,8 +90,8 @@ void QgsMergeAttributesDialog::createTableWidgetContents()
|
||||
int col = 0;
|
||||
for ( int idx = 0; idx < fields.count(); ++idx )
|
||||
{
|
||||
if ( mVectorLayer->editType( idx ) == QgsVectorLayer::Hidden ||
|
||||
mVectorLayer->editType( idx ) == QgsVectorLayer::Immutable )
|
||||
if ( mVectorLayer->editorWidgetV2( idx ) == "Hidden" ||
|
||||
mVectorLayer->editorWidgetV2( idx ) == "Immutable" )
|
||||
continue;
|
||||
|
||||
mTableWidget->setColumnCount( col + 1 );
|
||||
|
@ -1120,6 +1120,8 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
|
||||
* @param fieldName The name of the field
|
||||
*
|
||||
* @return The id for the editor widget or a NULL string if not applicable
|
||||
*
|
||||
* @note python method name editorWidgetV2ByName
|
||||
*/
|
||||
const QString editorWidgetV2( const QString& fieldName ) const;
|
||||
|
||||
@ -1138,6 +1140,8 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
|
||||
* @param fieldName The name of the field
|
||||
*
|
||||
* @return The configuration for the editor widget or an empty config if the field does not exist
|
||||
*
|
||||
* @note python method name is editorWidgetV2ConfigByName
|
||||
*/
|
||||
const QgsEditorWidgetConfig editorWidgetV2Config( const QString& fieldName ) const;
|
||||
|
||||
@ -1252,7 +1256,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
|
||||
/**
|
||||
* Set string representing 'true' for a checkbox (added in 1.4)
|
||||
*
|
||||
* @deprecated Use @see{setEditorWdigetV2Config} instead
|
||||
* @deprecated Use @see{setEditorWidgetV2Config} instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED void setCheckedState( int idx, QString checked, QString notChecked );
|
||||
|
||||
@ -1284,14 +1288,14 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
|
||||
|
||||
/**
|
||||
* Access value map
|
||||
* @deprecated Use @see{editorWdigetV2Config} instead
|
||||
* @deprecated Use @see{editorWidgetV2Config} instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED QMap<QString, QVariant> valueMap( int idx );
|
||||
|
||||
/**
|
||||
* Access range widget config data
|
||||
*
|
||||
* @deprecated Use @see{editorWdigetV2Config} instead
|
||||
* @deprecated Use @see{editorWidgetV2Config} instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED RangeData range( int idx );
|
||||
|
||||
|
@ -469,8 +469,7 @@ void QgsServerProjectParser::addLayerProjectSettings( QDomElement& layerElem, QD
|
||||
attributeElem.setAttribute( "typeName", field.typeName() );
|
||||
|
||||
//edit type to text
|
||||
QgsVectorLayer::EditType typeEnum = vLayer->editType( idx );
|
||||
attributeElem.setAttribute( "editType", editTypeString( typeEnum ) );
|
||||
attributeElem.setAttribute( "editType", vLayer->editorWidgetV2( idx ) );
|
||||
attributeElem.setAttribute( "comment", field.comment() );
|
||||
attributeElem.setAttribute( "length", field.length() );
|
||||
attributeElem.setAttribute( "precision", field.precision() );
|
||||
|
@ -2903,12 +2903,12 @@ QString QgsWMSServer::replaceValueMapAndRelation( QgsVectorLayer* vl, int idx, c
|
||||
return attributeVal;
|
||||
}
|
||||
|
||||
QgsVectorLayer::EditType type = vl->editType( idx );
|
||||
if ( type == QgsVectorLayer::ValueMap )
|
||||
QString type = vl->editorWidgetV2( idx );
|
||||
if ( type == "ValueMap" )
|
||||
{
|
||||
QMap<QString, QVariant> valueMap = vl->valueMap( idx );
|
||||
QMap<QString, QVariant>::const_iterator vmapIt = valueMap.constBegin();
|
||||
for ( ; vmapIt != valueMap.constEnd(); ++vmapIt )
|
||||
QgsEditorWidgetConfig cfg( vl->editorWidgetV2Config( idx ) );
|
||||
QMap<QString, QVariant>::const_iterator vmapIt = cfg.constBegin();
|
||||
for ( ; vmapIt != cfg.constEnd(); ++vmapIt )
|
||||
{
|
||||
if ( vmapIt.value().toString() == attributeVal )
|
||||
{
|
||||
@ -2916,17 +2916,17 @@ QString QgsWMSServer::replaceValueMapAndRelation( QgsVectorLayer* vl, int idx, c
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( type == QgsVectorLayer::ValueRelation )
|
||||
else if ( type == "ValueRelation" )
|
||||
{
|
||||
QgsVectorLayer::ValueRelationData vrdata = vl->valueRelation( idx );
|
||||
QgsVectorLayer* layer = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( vrdata.mLayer ) );
|
||||
QgsEditorWidgetConfig cfg( vl->editorWidgetV2Config( idx ) );
|
||||
QgsVectorLayer* layer = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( cfg.value( "Layer" ).toString() ) );
|
||||
if ( !layer )
|
||||
{
|
||||
return attributeVal;
|
||||
}
|
||||
|
||||
QString outputString;
|
||||
if ( vrdata.mAllowMulti )
|
||||
if ( cfg.value( "AllowMulti" ).toBool() )
|
||||
{
|
||||
QString valueString = attributeVal;
|
||||
QStringList valueList = valueString.remove( QChar( '{' ) ).remove( QChar( '}' ) ).split( "," );
|
||||
@ -2936,7 +2936,12 @@ QString QgsWMSServer::replaceValueMapAndRelation( QgsVectorLayer* vl, int idx, c
|
||||
{
|
||||
outputString += ";";
|
||||
}
|
||||
outputString += relationValue( valueList.at( i ), layer, vrdata.mKey, vrdata.mValue );
|
||||
outputString += relationValue(
|
||||
valueList.at( i ),
|
||||
layer,
|
||||
cfg.value( "Key" ).toString(),
|
||||
cfg.value( "Value" ).toString()
|
||||
);
|
||||
}
|
||||
}
|
||||
return outputString;
|
||||
|
Loading…
x
Reference in New Issue
Block a user