@@ -1860,192 +1860,114 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString&
1860
1860
editTypeElement.setAttribute ( " editable" , mFieldEditables [field.name ()] ? 1 : 0 );
1861
1861
editTypeElement.setAttribute ( " labelontop" , mLabelOnTop [field.name ()] ? 1 : 0 );
1862
1862
1863
- #if 0
1864
- switch (( EditType ) it.value() )
1865
- {
1866
- case ValueMap:
1867
- if ( mValueMaps.contains( it.key() ) )
1868
- {
1869
- const QMap<QString, QVariant> &map = mValueMaps[ it.key()];
1870
-
1871
- for ( QMap<QString, QVariant>::const_iterator vmit = map.begin(); vmit != map.end(); ++vmit )
1872
- {
1873
- QDomElement value = doc.createElement( "valuepair" );
1874
- value.setAttribute( "key", vmit.key() );
1875
- value.setAttribute( "value", vmit.value().toString() );
1876
- editTypeElement.appendChild( value );
1877
- }
1878
- }
1879
- break;
1880
-
1881
- case EditRange:
1882
- case SliderRange:
1883
- case DialRange:
1884
- if ( mRanges.contains( it.key() ) )
1885
- {
1886
- editTypeElement.setAttribute( "min", mRanges[ it.key()].mMin.toString() );
1887
- editTypeElement.setAttribute( "max", mRanges[ it.key()].mMax.toString() );
1888
- editTypeElement.setAttribute( "step", mRanges[ it.key()].mStep.toString() );
1889
- }
1890
- break;
1891
-
1892
- case CheckBox:
1893
- if ( mCheckedStates.contains( it.key() ) )
1894
- {
1895
- editTypeElement.setAttribute( "checked", mCheckedStates[ it.key()].first );
1896
- editTypeElement.setAttribute( "unchecked", mCheckedStates[ it.key()].second );
1897
- }
1898
- break;
1899
-
1900
- case ValueRelation:
1901
- if ( mValueRelations.contains( it.key() ) )
1902
- {
1903
- const ValueRelationData &data = mValueRelations[ it.key()];
1904
- editTypeElement.setAttribute( "layer", data.mLayer );
1905
- editTypeElement.setAttribute( "key", data.mKey );
1906
- editTypeElement.setAttribute( "value", data.mValue );
1907
- editTypeElement.setAttribute( "allowNull", data.mAllowNull ? "true" : "false" );
1908
- editTypeElement.setAttribute( "orderByValue", data.mOrderByValue ? "true" : "false" );
1909
- editTypeElement.setAttribute( "allowMulti", data.mAllowMulti ? "true" : "false" );
1910
- if ( !data.mFilterExpression.isNull() )
1911
- editTypeElement.setAttribute( "filterExpression", data.mFilterExpression );
1912
- }
1913
- break;
1914
-
1915
- case Calendar:
1916
- editTypeElement.setAttribute( "dateFormat", mDateFormats[ it.key()] );
1917
- break;
1918
-
1919
- case Photo:
1920
- case WebView:
1921
- editTypeElement.setAttribute( "widgetWidth", mWidgetSize[ it.key()].width() );
1922
- editTypeElement.setAttribute( "widgetHeight", mWidgetSize[ it.key()].height() );
1923
- break;
1924
1863
1925
- case LineEdit:
1926
- case UniqueValues:
1927
- case UniqueValuesEditable:
1928
- case Classification:
1929
- case FileName:
1930
- case Hidden:
1931
- case TextEdit:
1932
- case Enumeration:
1933
- case Immutable:
1934
- case UuidGenerator:
1935
- case Color:
1936
- case EditorWidgetV2: // Will get a signal and save there
1937
- break;
1938
- }
1864
+ editTypesElement.appendChild ( editTypeElement );
1939
1865
}
1940
- #endif
1941
-
1942
- editTypesElement.appendChild ( editTypeElement );
1943
- }
1944
1866
1945
- node.appendChild ( editTypesElement );
1867
+ node.appendChild ( editTypesElement );
1946
1868
1947
- QDomElement efField = doc.createElement ( " editform" );
1948
- QDomText efText = doc.createTextNode ( QgsProject::instance ()->writePath ( mEditForm ) );
1949
- efField.appendChild ( efText );
1950
- node.appendChild ( efField );
1869
+ QDomElement efField = doc.createElement ( " editform" );
1870
+ QDomText efText = doc.createTextNode ( QgsProject::instance ()->writePath ( mEditForm ) );
1871
+ efField.appendChild ( efText );
1872
+ node.appendChild ( efField );
1951
1873
1952
- QDomElement efiField = doc.createElement ( " editforminit" );
1953
- QDomText efiText = doc.createTextNode ( mEditFormInit );
1954
- efiField.appendChild ( efiText );
1955
- node.appendChild ( efiField );
1874
+ QDomElement efiField = doc.createElement ( " editforminit" );
1875
+ QDomText efiText = doc.createTextNode ( mEditFormInit );
1876
+ efiField.appendChild ( efiText );
1877
+ node.appendChild ( efiField );
1956
1878
1957
- QDomElement fFSuppElem = doc.createElement ( " featformsuppress" );
1958
- QDomText fFSuppText = doc.createTextNode ( QString::number ( featureFormSuppress () ) );
1959
- fFSuppElem .appendChild ( fFSuppText );
1960
- node.appendChild ( fFSuppElem );
1879
+ QDomElement fFSuppElem = doc.createElement ( " featformsuppress" );
1880
+ QDomText fFSuppText = doc.createTextNode ( QString::number ( featureFormSuppress () ) );
1881
+ fFSuppElem .appendChild ( fFSuppText );
1882
+ node.appendChild ( fFSuppElem );
1961
1883
1962
- QDomElement afField = doc.createElement ( " annotationform" );
1963
- QDomText afText = doc.createTextNode ( QgsProject::instance ()->writePath ( mAnnotationForm ) );
1964
- afField.appendChild ( afText );
1965
- node.appendChild ( afField );
1884
+ QDomElement afField = doc.createElement ( " annotationform" );
1885
+ QDomText afText = doc.createTextNode ( QgsProject::instance ()->writePath ( mAnnotationForm ) );
1886
+ afField.appendChild ( afText );
1887
+ node.appendChild ( afField );
1966
1888
1967
- // tab display
1968
- QDomElement editorLayoutElem = doc.createElement ( " editorlayout" );
1969
- switch ( mEditorLayout )
1970
- {
1971
- case UiFileLayout:
1972
- editorLayoutElem.appendChild ( doc.createTextNode ( " uifilelayout" ) );
1973
- break ;
1889
+ // tab display
1890
+ QDomElement editorLayoutElem = doc.createElement ( " editorlayout" );
1891
+ switch ( mEditorLayout )
1892
+ {
1893
+ case UiFileLayout:
1894
+ editorLayoutElem.appendChild ( doc.createTextNode ( " uifilelayout" ) );
1895
+ break ;
1974
1896
1975
- case TabLayout:
1976
- editorLayoutElem.appendChild ( doc.createTextNode ( " tablayout" ) );
1977
- break ;
1897
+ case TabLayout:
1898
+ editorLayoutElem.appendChild ( doc.createTextNode ( " tablayout" ) );
1899
+ break ;
1978
1900
1979
- case GeneratedLayout:
1980
- default :
1981
- editorLayoutElem.appendChild ( doc.createTextNode ( " generatedlayout" ) );
1982
- break ;
1983
- }
1901
+ case GeneratedLayout:
1902
+ default :
1903
+ editorLayoutElem.appendChild ( doc.createTextNode ( " generatedlayout" ) );
1904
+ break ;
1905
+ }
1984
1906
1985
- node.appendChild ( editorLayoutElem );
1907
+ node.appendChild ( editorLayoutElem );
1986
1908
1987
- // attribute aliases
1988
- if ( mAttributeAliasMap .size () > 0 )
1989
- {
1990
- QDomElement aliasElem = doc.createElement ( " aliases" );
1991
- QMap<QString, QString>::const_iterator a_it = mAttributeAliasMap .constBegin ();
1992
- for ( ; a_it != mAttributeAliasMap .constEnd (); ++a_it )
1909
+ // attribute aliases
1910
+ if ( mAttributeAliasMap .size () > 0 )
1993
1911
{
1994
- int idx = fieldNameIndex ( a_it.key () );
1995
- if ( idx < 0 )
1996
- continue ;
1912
+ QDomElement aliasElem = doc.createElement ( " aliases" );
1913
+ QMap<QString, QString>::const_iterator a_it = mAttributeAliasMap .constBegin ();
1914
+ for ( ; a_it != mAttributeAliasMap .constEnd (); ++a_it )
1915
+ {
1916
+ int idx = fieldNameIndex ( a_it.key () );
1917
+ if ( idx < 0 )
1918
+ continue ;
1997
1919
1998
- QDomElement aliasEntryElem = doc.createElement ( " alias" );
1999
- aliasEntryElem.setAttribute ( " field" , a_it.key () );
2000
- aliasEntryElem.setAttribute ( " index" , idx );
2001
- aliasEntryElem.setAttribute ( " name" , a_it.value () );
2002
- aliasElem.appendChild ( aliasEntryElem );
1920
+ QDomElement aliasEntryElem = doc.createElement ( " alias" );
1921
+ aliasEntryElem.setAttribute ( " field" , a_it.key () );
1922
+ aliasEntryElem.setAttribute ( " index" , idx );
1923
+ aliasEntryElem.setAttribute ( " name" , a_it.value () );
1924
+ aliasElem.appendChild ( aliasEntryElem );
1925
+ }
1926
+ node.appendChild ( aliasElem );
2003
1927
}
2004
- node.appendChild ( aliasElem );
2005
- }
2006
-
2007
- // exclude attributes WMS
2008
- QDomElement excludeWMSElem = doc.createElement ( " excludeAttributesWMS" );
2009
- QSet<QString>::const_iterator attWMSIt = mExcludeAttributesWMS .constBegin ();
2010
- for ( ; attWMSIt != mExcludeAttributesWMS .constEnd (); ++attWMSIt )
2011
- {
2012
- QDomElement attrElem = doc.createElement ( " attribute" );
2013
- QDomText attrText = doc.createTextNode ( *attWMSIt );
2014
- attrElem.appendChild ( attrText );
2015
- excludeWMSElem.appendChild ( attrElem );
2016
- }
2017
- node.appendChild ( excludeWMSElem );
2018
1928
2019
- // exclude attributes WFS
2020
- QDomElement excludeWFSElem = doc.createElement ( " excludeAttributesWFS" );
2021
- QSet<QString>::const_iterator attWFSIt = mExcludeAttributesWFS .constBegin ();
2022
- for ( ; attWFSIt != mExcludeAttributesWFS .constEnd (); ++attWFSIt )
2023
- {
2024
- QDomElement attrElem = doc.createElement ( " attribute" );
2025
- QDomText attrText = doc.createTextNode ( *attWFSIt );
2026
- attrElem.appendChild ( attrText );
2027
- excludeWFSElem.appendChild ( attrElem );
2028
- }
2029
- node.appendChild ( excludeWFSElem );
2030
-
2031
- // tabs and groups of edit form
2032
- if ( mAttributeEditorElements .size () > 0 )
2033
- {
2034
- QDomElement tabsElem = doc.createElement ( " attributeEditorForm" );
1929
+ // exclude attributes WMS
1930
+ QDomElement excludeWMSElem = doc.createElement ( " excludeAttributesWMS" );
1931
+ QSet<QString>::const_iterator attWMSIt = mExcludeAttributesWMS .constBegin ();
1932
+ for ( ; attWMSIt != mExcludeAttributesWMS .constEnd (); ++attWMSIt )
1933
+ {
1934
+ QDomElement attrElem = doc.createElement ( " attribute" );
1935
+ QDomText attrText = doc.createTextNode ( *attWMSIt );
1936
+ attrElem.appendChild ( attrText );
1937
+ excludeWMSElem.appendChild ( attrElem );
1938
+ }
1939
+ node.appendChild ( excludeWMSElem );
2035
1940
2036
- for ( QList< QgsAttributeEditorElement* >::const_iterator it = mAttributeEditorElements .begin (); it != mAttributeEditorElements .end (); ++it )
1941
+ // exclude attributes WFS
1942
+ QDomElement excludeWFSElem = doc.createElement ( " excludeAttributesWFS" );
1943
+ QSet<QString>::const_iterator attWFSIt = mExcludeAttributesWFS .constBegin ();
1944
+ for ( ; attWFSIt != mExcludeAttributesWFS .constEnd (); ++attWFSIt )
2037
1945
{
2038
- QDomElement attributeEditorWidgetElem = ( *it )->toDomElement ( doc );
2039
- tabsElem.appendChild ( attributeEditorWidgetElem );
1946
+ QDomElement attrElem = doc.createElement ( " attribute" );
1947
+ QDomText attrText = doc.createTextNode ( *attWFSIt );
1948
+ attrElem.appendChild ( attrText );
1949
+ excludeWFSElem.appendChild ( attrElem );
2040
1950
}
1951
+ node.appendChild ( excludeWFSElem );
2041
1952
2042
- node.appendChild ( tabsElem );
2043
- }
1953
+ // tabs and groups of edit form
1954
+ if ( mAttributeEditorElements .size () > 0 )
1955
+ {
1956
+ QDomElement tabsElem = doc.createElement ( " attributeEditorForm" );
2044
1957
2045
- // add attribute actions
2046
- mActions ->writeXML ( node, doc );
1958
+ for ( QList< QgsAttributeEditorElement* >::const_iterator it = mAttributeEditorElements .begin (); it != mAttributeEditorElements .end (); ++it )
1959
+ {
1960
+ QDomElement attributeEditorWidgetElem = ( *it )->toDomElement ( doc );
1961
+ tabsElem.appendChild ( attributeEditorWidgetElem );
1962
+ }
2047
1963
2048
- return true ;
1964
+ node.appendChild ( tabsElem );
1965
+ }
1966
+
1967
+ // add attribute actions
1968
+ mActions ->writeXML ( node, doc );
1969
+
1970
+ return true ;
2049
1971
}
2050
1972
2051
1973
bool QgsVectorLayer::readSld ( const QDomNode& node, QString& errorMessage )
0 commit comments