Index: app/qgsattributetable.cpp =================================================================== --- app/qgsattributetable.cpp (revision 9293) +++ app/qgsattributetable.cpp (working copy) @@ -24,12 +24,15 @@ #include "qgslogger.h" #include "qgsvectordataprovider.h" #include "qgsvectorlayer.h" +#include "qgisapp.h" +#include "qgsmapcanvas.h" #include #include #include #include #include +#include QgsAttributeTableItemDelegate::QgsAttributeTableItemDelegate( QgsAttributeTable *table, QObject *parent ) @@ -464,18 +467,30 @@ } QgsFeatureList features; - if ( layer->selectedFeatureCount() == 0 ) + + QSettings settings; + int behaviour = settings.value( "/qgis/attributeTableBehaviour", 0 ).toInt(); + + if ( behaviour == 1 ) { - layer->select( layer->pendingAllAttributesList(), QgsRect(), false ); + // selected features + features = layer->selectedFeatures(); + } + else + { + QgsRect rect; + if ( behaviour == 2 ) + { + // current canvas + rect = QgisApp::instance()->mapCanvas()->extent(); + } + layer->select( layer->pendingAllAttributesList(), rect, false ); + QgsFeature f; while ( layer->getNextFeature( f ) ) features << f; } - else - { - features = layer->selectedFeatures(); - } setRowCount( features.size() ); @@ -559,7 +574,7 @@ for ( QList::iterator iter = selections.begin();iter != selections.end();++iter ) { removeselection = true; - while ( swaptorowisSelected() )//selections are not necessary stored in ascending order + while ( swaptorow < rowCount() && item( swaptorow, 0 )->isSelected() )//selections are not necessary stored in ascending order { ++swaptorow; } Index: app/qgsoptions.cpp =================================================================== --- app/qgsoptions.cpp (revision 9293) +++ app/qgsoptions.cpp (working copy) @@ -64,6 +64,14 @@ leProxyPassword->setText( settings.value( "proxy/proxyPassword", "" ).toString() ); // set the current theme cmbTheme->setItemText( cmbTheme->currentIndex(), settings.value( "/Themes" ).toString() ); + + // set the attribute table behaviour + cmbAttrTableBehaviour->clear(); + cmbAttrTableBehaviour->addItem( tr( "Show all features" ) ); + cmbAttrTableBehaviour->addItem( tr( "Show selected features" ) ); + cmbAttrTableBehaviour->addItem( tr( "Show features in current canvas" ) ); + cmbAttrTableBehaviour->setCurrentIndex( settings.value( "/qgis/attributeTableBehaviour", 0 ).toInt() ); + // set the display update threshold spinBoxUpdateThreshold->setValue( settings.value( "/Map/updateThreshold" ).toInt() ); //set the default projection behaviour radio buttongs @@ -257,6 +265,7 @@ settings.setValue( "/qgis/showLegendClassifiers", cbxLegendClassifiers->isChecked() ); settings.setValue( "/qgis/hideSplash", cbxHideSplash->isChecked() ); settings.setValue( "/qgis/dockAttributeTable", cbxAttributeTableDocked->isChecked() ); + settings.setValue( "/qgis/attributeTableBehaviour", cmbAttrTableBehaviour->currentIndex() ); settings.setValue( "/qgis/new_layers_visible", chkAddedVisibility->isChecked() ); settings.setValue( "/qgis/enable_anti_aliasing", chkAntiAliasing->isChecked() ); settings.setValue( "/qgis/use_qimage_to_render", !( chkUseQPixmap->isChecked() ) ); Index: gui/qgsmapcanvas.h =================================================================== --- gui/qgsmapcanvas.h (revision 9293) +++ gui/qgsmapcanvas.h (working copy) @@ -129,7 +129,7 @@ //! Returns the mapUnitsPerPixel (map units per pixel) for the canvas double mapUnitsPerPixel() const; - //! Returns the current zoom exent of the map canvas + //! Returns the current zoom extent of the map canvas QgsRect extent() const; //! Returns the combined exent for all layers on the map canvas QgsRect fullExtent() const; Index: ui/qgsoptionsbase.ui =================================================================== --- ui/qgsoptionsbase.ui (revision 9293) +++ ui/qgsoptionsbase.ui (working copy) @@ -220,6 +220,34 @@ + + + + + 0 + 0 + + + + Attribute table behaviour + + + cmbAttrTableBehaviour + + + + + + + false + + + + + + + +