mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Printing: force redrawing of the profile
If the first dive we end up rendering is the dive currently shown, the info overlay would end up being printed which looks really silly. See #590 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
99859d9a07
commit
2d77788cb2
3 changed files with 8 additions and 12 deletions
|
@ -183,7 +183,7 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
|
|||
|
||||
// draw a profile
|
||||
painter.translate((scaledW + padW) * col, (scaledH + padH) * row + yOffsetProfile);
|
||||
profile->plotDive(dive);
|
||||
profile->plotDive(dive, true); // make sure the profile is actually redrawn
|
||||
profile->render(&painter, QRect(0, 0, scaledW, scaledH - tableH - padPT));
|
||||
painter.setTransform(origTransform);
|
||||
|
||||
|
@ -202,7 +202,8 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
|
|||
profile->setFrameStyle(profileFrameStyle);
|
||||
profile->setPrintMode(false);
|
||||
profile->resize(originalSize);
|
||||
profile->plotDive();
|
||||
// we need to force a redraw of the profile so it switches back from print mode
|
||||
profile->plotDive(0, true);
|
||||
}
|
||||
|
||||
/* we create a table that has a fixed height, but can stretch to fit certain width */
|
||||
|
|
|
@ -69,7 +69,6 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
|||
backgroundFile(":poster"),
|
||||
toolTipItem(new ToolTipItem()),
|
||||
isPlotZoomed(prefs.zoomed_plot),
|
||||
forceReplot(false),
|
||||
profileYAxis(new DepthAxis()),
|
||||
gasYAxis(new PartialGasPressureAxis()),
|
||||
temperatureAxis(new TemperatureAxis()),
|
||||
|
@ -254,8 +253,7 @@ void ProfileWidget2::setupItemOnScene()
|
|||
void ProfileWidget2::replot()
|
||||
{
|
||||
dataModel->clear();
|
||||
forceReplot = true;
|
||||
plotDive(); // simply plot the displayed_dive again
|
||||
plotDive(0, true); // simply plot the displayed_dive again
|
||||
}
|
||||
|
||||
void ProfileWidget2::setupItemSizes()
|
||||
|
@ -354,7 +352,7 @@ void ProfileWidget2::setupSceneAndFlags()
|
|||
}
|
||||
|
||||
// Currently just one dive, but the plan is to enable All of the selected dives.
|
||||
void ProfileWidget2::plotDive(struct dive *d)
|
||||
void ProfileWidget2::plotDive(struct dive *d, bool force)
|
||||
{
|
||||
static bool firstCall = true;
|
||||
QTime measureDuration; // let's measure how long this takes us (maybe we'll turn of TTL calculation later
|
||||
|
@ -371,11 +369,9 @@ void ProfileWidget2::plotDive(struct dive *d)
|
|||
// computer of the same dive, so we check the unique id of the dive
|
||||
// and the selected dive computer number against the ones we are
|
||||
// showing (can't compare the dive pointers as those might change).
|
||||
if (d->id == displayed_dive.id && dc_number == dataModel->dcShown() && !forceReplot)
|
||||
if (d->id == displayed_dive.id && dc_number == dataModel->dcShown() && !force)
|
||||
return;
|
||||
|
||||
forceReplot = false;
|
||||
|
||||
// this copies the dive and makes copies of all the relevant additional data
|
||||
copy_dive(d, &displayed_dive);
|
||||
} else {
|
||||
|
@ -961,7 +957,7 @@ void ProfileWidget2::deleteCurrentDC()
|
|||
delete_current_divecomputer();
|
||||
mark_divelist_changed(true);
|
||||
// we need to force it since it's likely the same dive and same dc_number - but that's a different dive computer now
|
||||
forceReplot = true;
|
||||
MainWindow::instance()->graphics()->plotDive(0, true);
|
||||
MainWindow::instance()->refreshDisplay();
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
};
|
||||
|
||||
ProfileWidget2(QWidget *parent = 0);
|
||||
void plotDive(struct dive *d = 0);
|
||||
void plotDive(struct dive *d = 0, bool force = false);
|
||||
virtual bool eventFilter(QObject *, QEvent *);
|
||||
void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, DivePlotDataModel *model, int vData, int hData, int zValue);
|
||||
void setPrintMode(bool mode, bool grayscale = false);
|
||||
|
@ -135,7 +135,6 @@ private:
|
|||
QString backgroundFile;
|
||||
ToolTipItem *toolTipItem;
|
||||
bool isPlotZoomed;
|
||||
bool forceReplot;
|
||||
// All those here should probably be merged into one structure,
|
||||
// So it's esyer to replicate for more dives later.
|
||||
// In the meantime, keep it here.
|
||||
|
|
Loading…
Add table
Reference in a new issue