Skip to content
Permalink
Browse files
Fix refresh of histogram when tab is already active
  • Loading branch information
timlinux committed Nov 21, 2011
1 parent 0589daf commit 8d465ecea54259d48cfca12aee37054dd81db516
Showing with 14 additions and 7 deletions.
  1. +1 −5 resources/html/chart.html
  2. +10 −2 src/app/qgsrasterlayerproperties.cpp
  3. +3 −0 src/app/qgsrasterlayerproperties.h
@@ -4,8 +4,6 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript" type="text/javascript" src="../js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="../js/jquery.flot.js"></script>
<!-- flot grow plugin: see http://jumware.com/Includes/jquery/Flot/Doc/JQuery.flot.grow.html -->
<script language="javascript" type="text/javascript" src="../js/jquery.flot.grow.js"></script>
<script language="javascript" type="text/javascript" src="../js/jquery.flot.navigate.js"></script>
</head>
<body>
@@ -16,9 +14,7 @@
{
var options = { series :
{
grow : { active : true },
points : { show : true },
grow : { stepMode : "maximum", steps: 120 },
points : { show : false },
lines : { show : true },
},
yaxis : { zoomRange: null, panRange: null },
@@ -68,6 +68,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
setupUi( this );
QString myChartPage = "file:///" + QgsApplication::pkgDataPath() + "/resources/html/chart.html";
mWebPlot->load(QUrl( myChartPage ));
connect( mWebPlot->page()->mainFrame(), SIGNAL( loadFinished( bool ) ), this, SLOT( histogramPageLoaded( bool ) ) );
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
connect( this, SIGNAL( accepted() ), this, SLOT( apply() ) );
connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
@@ -1853,6 +1854,14 @@ void QgsRasterLayerProperties::on_tabBar_currentChanged( int theTab )
}
}

void QgsRasterLayerProperties::histogramPageLoaded( bool theOkFlag )
{
if ( tabBar->currentIndex() == 6 && theOkFlag ) //yuk magick number
{
refreshHistogram();
}
}

void QgsRasterLayerProperties::refreshHistogram()
{
mHistogramProgress->show();
@@ -1876,7 +1885,6 @@ void QgsRasterLayerProperties::refreshHistogram()
//now draw actual graphs
//

bool myFirstIteration = true;
for ( int myIteratorInt = 1;
myIteratorInt <= myBandCountInt;
++myIteratorInt )
@@ -1896,7 +1904,7 @@ void QgsRasterLayerProperties::refreshHistogram()
myFirst = false;
}
mySeriesJS += "]);";
QgsDebugMsg( mySeriesJS );
//QgsDebugMsg( mySeriesJS );
mWebPlot->page()->mainFrame()->evaluateJavaScript( mySeriesJS );
}
disconnect( mRasterLayer, SIGNAL( progressUpdate( int ) ), mHistogramProgress, SLOT( setValue( int ) ) );
@@ -69,6 +69,9 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
void on_tabBar_currentChanged( int theTab );
/** \brief slot executed when user wishes to refresh raster histogram */
void refreshHistogram();
/** \brief slot executed when the web view for the histogram is loaded and ready to display charts
* @note added in 2.0 */
void histogramPageLoaded( bool theOkFlag );
/** \brief slow executed when user wishes to import transparency values */
void on_pbnImportTransparentPixelValues_clicked();
/** \brief slot executed when user presses "Remove Selected Row" button on the transparency page */

0 comments on commit 8d465ec

Please sign in to comment.