Skip to content

Commit

Permalink
more qml fixes
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9748 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Dec 7, 2008
1 parent 3f73e57 commit 7bf2e0e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
33 changes: 18 additions & 15 deletions src/app/qgsvectorlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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() );
Expand Down Expand Up @@ -450,6 +452,7 @@ void QgsVectorLayerProperties::reset( void )
//update the transparency percentage label
sliderTransparency_valueChanged( 255 - layer->getTransparency() );

loadRows();
} // reset()


Expand Down
6 changes: 4 additions & 2 deletions src/core/qgslabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 7bf2e0e

Please sign in to comment.