Bug report #4132

histogram gets needlessly refreshed twice - proposed fix

Added by Etienne Tourigny over 13 years ago. Updated about 12 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Rasters
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:14112

Description

If the Raster Histogram tab was previously selected in the Raster Properties dialog and the user opens the dialog again, the histogram is refreshed twice, leading to needless processing and delay.

Specifically, in file src/app/qgsrasterlayerproperties.cpp the function QgsRasterLayerProperties::refreshHistogram() function gets called twice, once by the QgsRasterLayerProperties constructor, and once by the on_tabBar_currentChanged() slot.

The histogram tab gets activated by this call
tabBar->setCurrentIndex( settings.value( "/Windows/RasterLayerProperties/row" ).toInt() );

A simple fix is to disable the call in the constructor (around line 280 in the master branch), and leave it in the on_tabBar_currentChanged() slot.

QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanvas* theCanvas, QWidget *parent, Qt::WFlags fl )
...

  setWindowTitle( tr( "Layer Properties - %1" ).arg( lyr->name() ) );
  // int myHistogramTab = 6;
  // if ( tabBar->currentIndex() == myHistogramTab )
  // {
  //   refreshHistogram();
  // }
  tableTransparency->horizontalHeader()->setResizeMode( 0, QHeaderView::Stretch );
  tableTransparency->horizontalHeader()->setResizeMode( 1, QHeaderView::Stretch );
} // QgsRasterLayerProperties ctor

History

#1 Updated by Giovanni Manghi almost 13 years ago

  • Target version set to Version 1.7.4

#2 Updated by Paolo Cavallini over 12 years ago

  • Crashes QGIS or corrupts data set to No
  • Affected QGIS version set to master
  • Target version changed from Version 1.7.4 to Version 1.8.0

#4 Updated by Paolo Cavallini about 12 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

#5 Updated by Giovanni Manghi about 12 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

Also available in: Atom PDF