Better fix for export infinite loop

This commit is contained in:
Eoin Mcloughlin
2016-10-31 18:09:59 +00:00
parent d6d9b73434
commit 6e83051204
2 changed files with 9 additions and 3 deletions

View File

@@ -113,8 +113,9 @@ void PlotView::contextMenuEvent(QContextMenuEvent * event)
save->setEnabled(src->sampleType() == typeid(std::complex<float>));
menu.addAction(save);
updateView(false);
menu.exec(event->globalPos());
updateViewRange(false);
if(menu.exec(event->globalPos()))
updateView(false);
}
void PlotView::cursorsMoved()
@@ -459,7 +460,7 @@ void PlotView::scrollContentsBy(int dx, int dy)
updateView();
}
void PlotView::updateView(bool reCenter)
void PlotView::updateViewRange(bool reCenter)
{
// Store old view for recentering
auto oldViewRange = viewRange;
@@ -476,7 +477,11 @@ void PlotView::updateView(bool reCenter)
horizontalScrollBar()->value() + (oldViewRange.length() - viewRange.length()) / 2
);
}
}
void PlotView::updateView(bool reCenter)
{
updateViewRange(reCenter);
horizontalScrollBar()->setMaximum(std::max(off_t(0), mainSampleSource->count() - ((width() - 1) * samplesPerLine())));
verticalScrollBar()->setMaximum(std::max(0, plotsHeight() - viewport()->height()));