Skip to content

Commit

Permalink
fix #5905
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 29, 2012
1 parent bddb759 commit 40dc7df
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 36 deletions.
23 changes: 0 additions & 23 deletions src/app/qgsattributetabledialog.cpp
Expand Up @@ -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 )
Expand Down
13 changes: 1 addition & 12 deletions src/app/qgsattributetabledialog.h
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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*/
Expand Down
2 changes: 1 addition & 1 deletion src/gui/attributetable/qgsattributetablemodel.cpp
Expand Up @@ -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() )
Expand Down

0 comments on commit 40dc7df

Please sign in to comment.