Remove update 'flicker' when tab selected

The recent patch to reduce redraws when rides are selected
causes each tab to redraw whenever the tab IS selected. This
patch reduces this by remembering the current ride plotted.

It also fixes the "double draw" in GoogleMapControl and AllPlot
when selected for the first time.
This commit is contained in:
Mark Liversedge
2010-04-04 21:38:54 +01:00
committed by Robert Carlsen
parent 07623bf94f
commit 1751d8bf12
8 changed files with 40 additions and 11 deletions

View File

@@ -156,12 +156,13 @@ GoogleMapControl::GoogleMapControl(MainWindow *mw)
void
GoogleMapControl::rideSelected()
{
if (parent->activeTab() != this)
return;
RideItem * ride = parent->rideItem();
if (parent->activeTab() != this) return;
if (!ride)
RideItem * ride = parent->rideItem();
if (ride == current || !ride || !ride->ride())
return;
else
current = ride;
int zone =ride->zoneRange();
if(zone < 0)
@@ -177,8 +178,6 @@ GoogleMapControl::rideSelected()
double prevLon = 0;
double prevLat = 0;
if (ride == NULL || ride->ride() == NULL) return;
foreach(RideFilePoint *rfp,ride->ride()->dataPoints())
{
RideFilePoint curRfp = *rfp;
@@ -204,8 +203,15 @@ GoogleMapControl::rideSelected()
void GoogleMapControl::resizeEvent(QResizeEvent * )
{
newRideToLoad = true;
loadRide();
static bool first = true;
if (parent->activeTab() != this) return;
if (first == true) {
first = false;
} else {
newRideToLoad = true;
loadRide();
}
}
void GoogleMapControl::loadStarted()