[QGIS Commit] r9748 - in trunk/qgis/src: app core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Dec 6 23:10:56 EST 2008


Author: jef
Date: 2008-12-06 23:10:56 -0500 (Sat, 06 Dec 2008)
New Revision: 9748

Modified:
   trunk/qgis/src/app/qgsvectorlayerproperties.cpp
   trunk/qgis/src/core/qgslabel.cpp
Log:
more qml fixes

Modified: trunk/qgis/src/app/qgsvectorlayerproperties.cpp
===================================================================
--- trunk/qgis/src/app/qgsvectorlayerproperties.cpp	2008-12-07 03:10:00 UTC (rev 9747)
+++ trunk/qgis/src/app/qgsvectorlayerproperties.cpp	2008-12-07 04:10:56 UTC (rev 9748)
@@ -101,23 +101,9 @@
   actionDialog = new QgsAttributeActionDialog( layer->actions(), fields, actionOptionsFrame );
   actionLayout->addWidget( actionDialog );
 
-  tblAttributes->setColumnCount( 8 );
-  tblAttributes->setRowCount( fields.size() );
-  tblAttributes->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr( "id" ) ) );
-  tblAttributes->setHorizontalHeaderItem( 1, new QTableWidgetItem( tr( "name" ) ) );
-  tblAttributes->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "type" ) ) );
-  tblAttributes->setHorizontalHeaderItem( 3, new QTableWidgetItem( tr( "length" ) ) );
-  tblAttributes->setHorizontalHeaderItem( 4, new QTableWidgetItem( tr( "precision" ) ) );
-  tblAttributes->setHorizontalHeaderItem( 5, new QTableWidgetItem( tr( "comment" ) ) );
-  tblAttributes->setHorizontalHeaderItem( 6, new QTableWidgetItem( tr( "edit widget" ) ) );
-  tblAttributes->setHorizontalHeaderItem( 7, new QTableWidgetItem( tr( "values" ) ) );
 
-  tblAttributes->setSelectionBehavior( QAbstractItemView::SelectRows );
-  tblAttributes->setSelectionMode( QAbstractItemView::MultiSelection );
+  reset();
 
-  loadRows();
-
-  reset();
   if ( layer->dataProvider() )//enable spatial index button group if supported by provider
   {
     int capabilities = layer->dataProvider()->capabilities();
@@ -141,6 +127,22 @@
 {
   const QgsFieldMap &fields = layer->pendingFields();
 
+  tblAttributes->clear();
+
+  tblAttributes->setColumnCount( 8 );
+  tblAttributes->setRowCount( fields.size() );
+  tblAttributes->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr( "id" ) ) );
+  tblAttributes->setHorizontalHeaderItem( 1, new QTableWidgetItem( tr( "name" ) ) );
+  tblAttributes->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "type" ) ) );
+  tblAttributes->setHorizontalHeaderItem( 3, new QTableWidgetItem( tr( "length" ) ) );
+  tblAttributes->setHorizontalHeaderItem( 4, new QTableWidgetItem( tr( "precision" ) ) );
+  tblAttributes->setHorizontalHeaderItem( 5, new QTableWidgetItem( tr( "comment" ) ) );
+  tblAttributes->setHorizontalHeaderItem( 6, new QTableWidgetItem( tr( "edit widget" ) ) );
+  tblAttributes->setHorizontalHeaderItem( 7, new QTableWidgetItem( tr( "values" ) ) );
+
+  tblAttributes->setSelectionBehavior( QAbstractItemView::SelectRows );
+  tblAttributes->setSelectionMode( QAbstractItemView::MultiSelection );
+
   int row = 0;
   for ( QgsFieldMap::const_iterator it = fields.begin(); it != fields.end(); it++, row++ )
     setRow( row, it.key(), it.value() );
@@ -450,6 +452,7 @@
   //update the transparency percentage label
   sliderTransparency_valueChanged( 255 - layer->getTransparency() );
 
+  loadRows();
 } // reset()
 
 

Modified: trunk/qgis/src/core/qgslabel.cpp
===================================================================
--- trunk/qgis/src/core/qgslabel.cpp	2008-12-07 03:10:00 UTC (rev 9747)
+++ trunk/qgis/src/core/qgslabel.cpp	2008-12-07 04:10:56 UTC (rev 9748)
@@ -712,7 +712,9 @@
   }
   else if ( el.hasAttribute( prefix ) )
   {
-    mLabelFieldIdx[attr] = el.attribute( prefix ).toInt();
+    QString value = el.attribute( prefix );
+    mLabelFieldIdx[attr] = value.isEmpty() ? -1 : value.toInt();
+    return true;
   }
 
   mLabelFieldIdx[attr] = -1;
@@ -768,7 +770,7 @@
   else
   {
     el = scratchNode.toElement();
-    if ( !el.hasAttribute( "unitfieldname" ) )
+    if ( !el.hasAttribute( "unitfield" ) && !el.hasAttribute( "unitfieldname" ) )
     {
       type = QgsLabelAttributes::unitsCode( el.attribute( "units", "" ) );
       mLabelAttributes->setSize( el.attribute( "value", "0.0" ).toDouble(), type );



More information about the QGIS-commit mailing list