Skip to content

Commit 8d465ec

Browse files
committedNov 21, 2011
Fix refresh of histogram when tab is already active
1 parent 0589daf commit 8d465ec

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed
 

‎resources/html/chart.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
55
<script language="javascript" type="text/javascript" src="../js/jquery.js"></script>
66
<script language="javascript" type="text/javascript" src="../js/jquery.flot.js"></script>
7-
<!-- flot grow plugin: see http://jumware.com/Includes/jquery/Flot/Doc/JQuery.flot.grow.html -->
8-
<script language="javascript" type="text/javascript" src="../js/jquery.flot.grow.js"></script>
97
<script language="javascript" type="text/javascript" src="../js/jquery.flot.navigate.js"></script>
108
</head>
119
<body>
@@ -16,9 +14,7 @@
1614
{
1715
var options = { series :
1816
{
19-
grow : { active : true },
20-
points : { show : true },
21-
grow : { stepMode : "maximum", steps: 120 },
17+
points : { show : false },
2218
lines : { show : true },
2319
},
2420
yaxis : { zoomRange: null, panRange: null },

‎src/app/qgsrasterlayerproperties.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
6868
setupUi( this );
6969
QString myChartPage = "file:///" + QgsApplication::pkgDataPath() + "/resources/html/chart.html";
7070
mWebPlot->load(QUrl( myChartPage ));
71+
connect( mWebPlot->page()->mainFrame(), SIGNAL( loadFinished( bool ) ), this, SLOT( histogramPageLoaded( bool ) ) );
7172
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
7273
connect( this, SIGNAL( accepted() ), this, SLOT( apply() ) );
7374
connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
@@ -1853,6 +1854,14 @@ void QgsRasterLayerProperties::on_tabBar_currentChanged( int theTab )
18531854
}
18541855
}
18551856

1857+
void QgsRasterLayerProperties::histogramPageLoaded( bool theOkFlag )
1858+
{
1859+
if ( tabBar->currentIndex() == 6 && theOkFlag ) //yuk magick number
1860+
{
1861+
refreshHistogram();
1862+
}
1863+
}
1864+
18561865
void QgsRasterLayerProperties::refreshHistogram()
18571866
{
18581867
mHistogramProgress->show();
@@ -1876,7 +1885,6 @@ void QgsRasterLayerProperties::refreshHistogram()
18761885
//now draw actual graphs
18771886
//
18781887

1879-
bool myFirstIteration = true;
18801888
for ( int myIteratorInt = 1;
18811889
myIteratorInt <= myBandCountInt;
18821890
++myIteratorInt )
@@ -1896,7 +1904,7 @@ void QgsRasterLayerProperties::refreshHistogram()
18961904
myFirst = false;
18971905
}
18981906
mySeriesJS += "]);";
1899-
QgsDebugMsg( mySeriesJS );
1907+
//QgsDebugMsg( mySeriesJS );
19001908
mWebPlot->page()->mainFrame()->evaluateJavaScript( mySeriesJS );
19011909
}
19021910
disconnect( mRasterLayer, SIGNAL( progressUpdate( int ) ), mHistogramProgress, SLOT( setValue( int ) ) );

‎src/app/qgsrasterlayerproperties.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
6969
void on_tabBar_currentChanged( int theTab );
7070
/** \brief slot executed when user wishes to refresh raster histogram */
7171
void refreshHistogram();
72+
/** \brief slot executed when the web view for the histogram is loaded and ready to display charts
73+
* @note added in 2.0 */
74+
void histogramPageLoaded( bool theOkFlag );
7275
/** \brief slow executed when user wishes to import transparency values */
7376
void on_pbnImportTransparentPixelValues_clicked();
7477
/** \brief slot executed when user presses "Remove Selected Row" button on the transparency page */

0 commit comments

Comments
 (0)
Please sign in to comment.