[QGIS Commit] r11704 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Sep 23 10:49:02 EDT 2009
Author: jef
Date: 2009-09-23 10:49:00 -0400 (Wed, 23 Sep 2009)
New Revision: 11704
Modified:
trunk/qgis/src/app/qgsvectorlayerproperties.cpp
Log:
fix #1935
Modified: trunk/qgis/src/app/qgsvectorlayerproperties.cpp
===================================================================
--- trunk/qgis/src/app/qgsvectorlayerproperties.cpp 2009-09-22 23:26:15 UTC (rev 11703)
+++ trunk/qgis/src/app/qgsvectorlayerproperties.cpp 2009-09-23 14:49:00 UTC (rev 11704)
@@ -183,7 +183,7 @@
for ( int i = 0; i < 6; i++ )
tblAttributes->item( row, i )->setFlags( tblAttributes->item( row, i )->flags() & ~Qt::ItemIsEditable );
- QPushButton * pb = new QPushButton( editTypeButtonText( layer->editType( idx ) ) );
+ QPushButton *pb = new QPushButton( editTypeButtonText( layer->editType( idx ) ) );
tblAttributes->setCellWidget( row, 6, pb );
connect( pb, SIGNAL( pressed() ), this, SLOT( attributeTypeDialog( ) ) );
mButtonMap.insert( idx, pb );
@@ -200,16 +200,14 @@
void QgsVectorLayerProperties::attributeTypeDialog( )
{
- int index = -1;
- QMap<int, QPushButton*>::iterator it = mButtonMap.begin();
- for ( ; it != mButtonMap.end() ; it++ )
- {
- if ( it.value()->isDown() )
- {
- index = it.key();
- }
- }
+ QPushButton *pb = dynamic_cast<QPushButton *>( sender() );
+ if ( !pb )
+ return;
+ int index = mButtonMap.key( pb, -1 );
+ if ( index == -1 )
+ return;
+
QgsAttributeTypeDialog attributeTypeDialog( layer );
if ( mValueMaps.contains( index ) )
@@ -243,6 +241,7 @@
return;
QgsVectorLayer::EditType editType = attributeTypeDialog.editType();
+
mEditTypeMap.insert( index, editType );
QString buttonText;
@@ -258,9 +257,8 @@
default:
break;
}
- QPushButton *pb = dynamic_cast<QPushButton*>( tblAttributes->cellWidget( index, 6 ) );
- pb->setText( editTypeButtonText( editType ) );
+ pb->setText( editTypeButtonText( editType ) );
}
More information about the QGIS-commit
mailing list