4 changes: 2 additions & 2 deletions src/app/attributetable/qgsattributetabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ void QgsAttributeTableDialog::addFeature()
return;

QgsFeature f;
QgsFeatureAction action( tr( "Geometryless feature added" ), f, mLayer, -1, this );
QgsFeatureAction action( tr( "Geometryless feature added" ), f, mLayer, -1, -1, this );
if ( action.addFeature() )
{
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount(), mModel->columnCount() ) );
Expand Down Expand Up @@ -839,7 +839,7 @@ void QgsAttributeTableAction::featureForm()
{
QgsFeature f = mModel->feature( mFieldIdx );

QgsFeatureAction action( tr( "Attributes changed" ), f, mModel->layer(), -1, this );
QgsFeatureAction action( tr( "Attributes changed" ), f, mModel->layer(), -1, -1, this );
if ( mModel->layer()->isEditable() )
action.editFeature();
else
Expand Down
4 changes: 2 additions & 2 deletions src/app/gps/qgsgpsinformationwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked( )

f->setGeometryAndOwnership( &wkb[0], size );

QgsFeatureAction action( tr( "Feature added" ), *f, vlayer, -1, this );
QgsFeatureAction action( tr( "Feature added" ), *f, vlayer, -1, -1, this );
if ( action.addFeature() )
{
if ( mCbxAutoCommit->isChecked() )
Expand Down Expand Up @@ -1060,7 +1060,7 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked( )
return; //unknown wkbtype
} // layerWKBType == QGis::WKBPolygon

QgsFeatureAction action( tr( "Feature added" ), *f, vlayer, -1, this );
QgsFeatureAction action( tr( "Feature added" ), *f, vlayer, -1, -1, this );
if ( action.addFeature() )
{
if ( mCbxAutoCommit->isChecked() )
Expand Down
9 changes: 9 additions & 0 deletions src/app/legend/qgslegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,11 +1003,20 @@ void QgsLegend::legendGroupRemove()
return;
}

// Turn off rendering to improve speed.
bool renderFlagState = mMapCanvas->renderFlag();
if ( renderFlagState )
mMapCanvas->setRenderFlag( false );

QgsLegendGroup* lg = dynamic_cast<QgsLegendGroup *>( currentItem() );
if ( lg )
{
removeGroup( lg );
}

// Turn on rendering (if it was on previously)
if ( renderFlagState )
mMapCanvas->setRenderFlag( true );
}

void QgsLegend::legendGroupSetCRS()
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisappinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,6 @@ bool QgisAppInterface::openFeatureForm( QgsVectorLayer *vlayer, QgsFeature &f, b
if ( !vlayer )
return false;

QgsFeatureAction action( tr( "Attributes changed" ), f, vlayer, -1, QgisApp::instance() );
QgsFeatureAction action( tr( "Attributes changed" ), f, vlayer, -1, -1, QgisApp::instance() );
return action.editFeature();
}
5 changes: 3 additions & 2 deletions src/app/qgsfeatureaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
#include <QPushButton>
#include <QSettings>

QgsFeatureAction::QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *layer, int action, QObject *parent )
QgsFeatureAction::QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *layer, int action, int defaultAttr, QObject *parent )
: QAction( name, parent )
, mLayer( layer )
, mFeature( f )
, mAction( action )
, mIdx( defaultAttr )
{
}

Expand Down Expand Up @@ -58,7 +59,7 @@ QgsAttributeDialog *QgsFeatureAction::newDialog( bool cloneFeature )
if ( !action.runable() )
continue;

QgsFeatureAction *a = new QgsFeatureAction( action.name(), *f, mLayer, i, dialog->dialog() );
QgsFeatureAction *a = new QgsFeatureAction( action.name(), *f, mLayer, i, -1, dialog->dialog() );
dialog->dialog()->addAction( a );
connect( a, SIGNAL( triggered() ), a, SLOT( execute() ) );

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsfeatureaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class QgsFeatureAction : public QAction
Q_OBJECT

public:
QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *vl, int action, QObject *parent );
QgsFeatureAction( const QString &name, QgsFeature &f, QgsVectorLayer *vl, int action, int defaultAttr, QObject *parent );

public slots:
void execute();
Expand Down
11 changes: 8 additions & 3 deletions src/app/qgsidentifyresults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )

mActionPopup = new QMenu();

int idx = 0;
QTreeWidgetItem *featItem = featureItem( item );
if ( featItem )
{
Expand All @@ -440,6 +441,11 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
mActionPopup->addAction( tr( "Copy attribute value" ), this, SLOT( copyAttributeValue() ) );
mActionPopup->addAction( tr( "Copy feature attributes" ), this, SLOT( copyFeatureAttributes() ) );
mActionPopup->addSeparator();

if ( item->parent() == featItem && item->childCount() == 0 )
{
idx = item->data( 0, Qt::UserRole + 1 ).toInt();
}
}

mActionPopup->addAction( tr( "Clear results" ), this, SLOT( clear() ) );
Expand All @@ -465,8 +471,7 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
if ( !action.runable() )
continue;

int idx = featItem->data( 0, Qt::UserRole + 1 ).toInt();
QgsFeatureAction *a = new QgsFeatureAction( action.name(), mFeatures[ idx ], vlayer, i, this );
QgsFeatureAction *a = new QgsFeatureAction( action.name(), mFeatures[ idx ], vlayer, i, idx, this );
mActionPopup->addAction( QgisApp::getThemeIcon( "/mAction.png" ), action.name(), a, SLOT( execute() ) );
}
}
Expand Down Expand Up @@ -882,7 +887,7 @@ void QgsIdentifyResults::featureForm()
if ( !vlayer->featureAtId( fid, f ) )
return;

QgsFeatureAction action( tr( "Attribute changes" ), f, vlayer, idx, this );
QgsFeatureAction action( tr( "Attribute changes" ), f, vlayer, idx, -1, this );
if ( vlayer->isEditable() )
{
if ( action.editFeature() )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptooladdfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ QgsMapToolAddFeature::~QgsMapToolAddFeature()

bool QgsMapToolAddFeature::addFeature( QgsVectorLayer *vlayer, QgsFeature *f )
{
QgsFeatureAction action( tr( "add feature" ), *f, vlayer, -1, this );
QgsFeatureAction action( tr( "add feature" ), *f, vlayer, -1, -1, this );
return action.addFeature();
}

Expand Down
1 change: 0 additions & 1 deletion src/core/qgsattributeaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ QString QgsAttributeAction::expandAction( QString action, const QgsAttributeMap
}
}


return expanded_action;
}

Expand Down
9 changes: 5 additions & 4 deletions src/gui/attributetable/qgsattributetablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ void QgsAttributeTableModel::attributeValueChanged( QgsFeatureId fid, int idx, c
{
if ( mFeatureMap.contains( fid ) )
{
mFeatureMap[ fid ].changeAttribute( fieldCol( idx ), value );
mFeatureMap[ fid ].changeAttribute( idx, value );
}

setData( index( idToRow( fid ), fieldCol( idx ) ), value, Qt::EditRole );
}

Expand Down Expand Up @@ -460,9 +461,9 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role ) cons
}
}

if ( role == Qt::DisplayRole && mValueMaps.contains( index.column() ) )
if ( role == Qt::DisplayRole && mValueMaps.contains( fieldId ) )
{
return mValueMaps[ index.column()]->key( val.toString(), QString( "(%1)" ).arg( val.toString() ) );
return mValueMaps[ fieldId ]->key( val.toString(), QString( "(%1)" ).arg( val.toString() ) );
}

return val.toString();
Expand Down Expand Up @@ -528,7 +529,7 @@ void QgsAttributeTableModel::executeAction( int action, const QModelIndex &idx )

for ( int i = 0; i < mAttributes.size(); i++ )
{
attributes.insert( i, data( index( idx.row(), i ), Qt::EditRole ) );
attributes.insert( mAttributes[i], data( index( idx.row(), i ), Qt::EditRole ) );
}

mLayer->actions()->doAction( action, attributes, fieldIdx( idx.column() ) );
Expand Down
5 changes: 2 additions & 3 deletions src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated()
mode = QgsGraduatedSymbolRendererV2::Quantile;

// create and set new renderer
QApplication::setOverrideCursor( Qt::WaitCursor );
QgsGraduatedSymbolRendererV2* r = QgsGraduatedSymbolRendererV2::createRenderer(
mLayer, attrName, classes, mode, mGraduatedSymbol, ramp );
QApplication::restoreOverrideCursor();
if ( !r )
{
QMessageBox::critical( this, tr( "Error" ), tr( "Renderer creation has failed." ) );
Expand Down Expand Up @@ -303,7 +305,6 @@ void QgsGraduatedSymbolRendererV2Widget::changeRange( int rangeIdx )
populateRanges();

}

}

void QgsGraduatedSymbolRendererV2Widget::addClass()
Expand Down Expand Up @@ -390,5 +391,3 @@ void QgsGraduatedSymbolRendererV2Widget::refreshSymbolView()
{
populateRanges();
}