Skip to content
Permalink
Browse files

more qml fixes

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9748 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Dec 7, 2008
1 parent 3f73e57 commit 7bf2e0e1c5fa07db97e622b2cc473e91733ccb4d
Showing with 22 additions and 17 deletions.
  1. +18 −15 src/app/qgsvectorlayerproperties.cpp
  2. +4 −2 src/core/qgslabel.cpp
@@ -101,23 +101,9 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
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 );

loadRows();

reset();

if ( layer->dataProvider() )//enable spatial index button group if supported by provider
{
int capabilities = layer->dataProvider()->capabilities();
@@ -141,6 +127,22 @@ void QgsVectorLayerProperties::loadRows()
{
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 @@ void QgsVectorLayerProperties::reset( void )
//update the transparency percentage label
sliderTransparency_valueChanged( 255 - layer->getTransparency() );

loadRows();
} // reset()


@@ -712,7 +712,9 @@ bool QgsLabel::readLabelField( QDomElement &el, int attr, QString prefix = "fiel
}
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 @@ void QgsLabel::readXML( const QDomNode& node )
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 );

0 comments on commit 7bf2e0e

Please sign in to comment.
You can’t perform that action at this time.