Skip to content
Permalink
Browse files

fix #5905

  • Loading branch information
jef-n committed Jun 29, 2012
1 parent bddb759 commit 40dc7df7d77e93cc862da11750aae774c56479bd
@@ -680,33 +680,10 @@ void QgsAttributeTableDialog::editingToggled()
mRemoveAttribute->setEnabled( canDeleteAttributes && mLayer->isEditable() );
mAddFeature->setEnabled( canAddFeatures && mLayer->isEditable() && mLayer->geometryType() == QGis::NoGeometry );

// (probably reload data if user stopped editing - possible revert)
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, mModel->columnCount() - 1 ) );

// not necessary to set table read only if layer is not editable
// because model always reflects actual state when returning item flags
}

// not used now
void QgsAttributeTableDialog::startEditing()
{
mLayer->startEditing();
}

// not used now
void QgsAttributeTableDialog::submit()
{
mLayer->commitChanges();
}

// not used now
void QgsAttributeTableDialog::revert()
{
mLayer->rollBack();
mModel->revert();
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, mModel->columnCount() - 1 ) );
}

void QgsAttributeTableDialog::on_mAddAttribute_clicked()
{
if ( !mLayer )
@@ -66,14 +66,6 @@ class QgsAttributeTableDialog : public QDialog, private Ui::QgsAttributeTableDia
void finished();

private slots:
/**
* submits the data
*/
void submit();
/**
* Reverts the changes
*/
void revert();
/**
* Launches search
*/
@@ -148,10 +140,7 @@ class QgsAttributeTableDialog : public QDialog, private Ui::QgsAttributeTableDia
* Shows advanced actions
*/
void showAdvanced();
/**
* Starts editing mode
*/
void startEditing();

/**Opens dialog to add new attribute*/
void on_mAddAttribute_clicked();
/**Opens dialog to remove attribute*/
@@ -388,7 +388,7 @@ QVariant QgsAttributeTableModel::headerData( int section, Qt::Orientation orient
{
return QVariant( section );
}
else if ( section < mFieldCount )
else if ( section >= 0 && section < mFieldCount )
{
QString attributeName = mLayer->attributeAlias( mAttributes[section] );
if ( attributeName.isEmpty() )

0 comments on commit 40dc7df

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