Skip to content
Permalink
Browse files
Save/Load attribute editor layout for layers without geometry
  • Loading branch information
m-kuhn committed Dec 21, 2012
1 parent 9287719 commit 3f5f70696f96d0d2ada32c0de50828852da3941f
Showing with 42 additions and 42 deletions.
  1. +42 −42 src/core/qgsvectorlayer.cpp
@@ -102,6 +102,7 @@ QgsVectorLayer::QgsVectorLayer( QString vectorLayerPath,
, mLabel( 0 )
, mLabelOn( false )
, mVertexMarkerOnlyForSelection( false )
, mEditorLayout( GeneratedLayout )
, mFetching( false )
, mJoinBuffer( 0 )
, mDiagramRenderer( 0 )
@@ -3134,28 +3135,6 @@ bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage
//also restore custom properties (for labeling-ng)
readCustomProperties( node, "labeling" );

// tab display
QDomNode editorLayoutNode = node.namedItem( "editorlayout" );
if ( editorLayoutNode.isNull() )
{
mEditorLayout = GeneratedLayout;
}
else
{
if ( editorLayoutNode.toElement().text() == "uifilelayout" )
{
mEditorLayout = UiFileLayout;
}
else if ( editorLayoutNode.toElement().text() == "tablayout" )
{
mEditorLayout = TabLayout;
}
else
{
mEditorLayout = GeneratedLayout;
}
}

// Test if labeling is on or off
QDomNode labelnode = node.namedItem( "label" );
QDomElement element = labelnode.toElement();
@@ -3335,6 +3314,27 @@ bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage
}
}

// tab display
QDomNode editorLayoutNode = node.namedItem( "editorlayout" );
if ( editorLayoutNode.isNull() )
{
mEditorLayout = GeneratedLayout;
}
else
{
if ( editorLayoutNode.toElement().text() == "uifilelayout" )
{
mEditorLayout = UiFileLayout;
}
else if ( editorLayoutNode.toElement().text() == "tablayout" )
{
mEditorLayout = TabLayout;
}
else
{
mEditorLayout = GeneratedLayout;
}
}

//Attributes excluded from WMS and WFS
mExcludeAttributesWMS.clear();
@@ -3451,26 +3451,6 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString&
//save customproperties (for labeling ng)
writeCustomProperties( node, doc );

// tab display
QDomElement editorLayoutElem = doc.createElement( "editorlayout" );
switch ( mEditorLayout )
{
case UiFileLayout:
editorLayoutElem.appendChild( doc.createTextNode( "uifilelayout" ) );
break;

case TabLayout:
editorLayoutElem.appendChild( doc.createTextNode( "tablayout" ) );
break;

case GeneratedLayout:
default:
editorLayoutElem.appendChild( doc.createTextNode( "generatedlayout" ) );
break;
}

node.appendChild( editorLayoutElem );

// add the display field
QDomElement dField = doc.createElement( "displayfield" );
QDomText dFieldText = doc.createTextNode( displayField() );
@@ -3613,6 +3593,26 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString&
afField.appendChild( afText );
node.appendChild( afField );

// tab display
QDomElement editorLayoutElem = doc.createElement( "editorlayout" );
switch ( mEditorLayout )
{
case UiFileLayout:
editorLayoutElem.appendChild( doc.createTextNode( "uifilelayout" ) );
break;

case TabLayout:
editorLayoutElem.appendChild( doc.createTextNode( "tablayout" ) );
break;

case GeneratedLayout:
default:
editorLayoutElem.appendChild( doc.createTextNode( "generatedlayout" ) );
break;
}

node.appendChild( editorLayoutElem );

//attribute aliases
if ( mAttributeAliasMap.size() > 0 )
{

0 comments on commit 3f5f706

Please sign in to comment.