Skip to content
Permalink
Browse files
Merge pull request #364 from matthias-kuhn/attredit-aliases
Attredit aliases
  • Loading branch information
jef-n committed Jan 5, 2013
2 parents b2932de + 3f5f706 commit 12d1a28992cc111317ed149a0a380474385fb0b3
Showing with 49 additions and 43 deletions.
  1. +42 −42 src/core/qgsvectorlayer.cpp
  2. +7 −1 src/gui/qgsattributeeditor.cpp
@@ -102,6 +102,7 @@ QgsVectorLayer::QgsVectorLayer( QString vectorLayerPath,
, mLabel( 0 )
, mLabelOn( false )
, mVertexMarkerOnlyForSelection( false )
, mEditorLayout( GeneratedLayout )
, mFetching( false )
, mJoinBuffer( 0 )
, mDiagramRenderer( 0 )
@@ -3129,28 +3130,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();
@@ -3330,6 +3309,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();
@@ -3446,26 +3446,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() );
@@ -3608,6 +3588,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 )
{
@@ -1010,9 +1010,15 @@ QWidget* QgsAttributeEditor::createWidgetFromDef( const QgsAttributeEditorElemen
}
else
{
const QgsAttributeEditorField* fieldDef = dynamic_cast<const QgsAttributeEditorField*>( childDef );

//show attribute alias if available
QString myFieldName = vl->attributeDisplayName( fieldDef->idx() );
QLabel * mypLabel = new QLabel( myContainer );
gbLayout->addWidget( mypLabel, index, 0 );
mypLabel->setText( childDef->name() );
mypLabel->setText( myFieldName );

// add editor widget
gbLayout->addWidget( editor, index, 1 );
}

0 comments on commit 12d1a28

Please sign in to comment.