Bugfixing: Output preview dialog crash and scrollbar update

This commit is contained in:
Jakub Melka
2021-03-14 16:46:57 +01:00
parent 9dcdf10d1a
commit c633b1b4b8

View File

@ -50,6 +50,7 @@ OutputPreviewDialog::OutputPreviewDialog(const pdf::PDFDocument* document, pdf::
connect(ui->redPaperColorEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged); connect(ui->redPaperColorEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged);
connect(ui->greenPaperColorEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged); connect(ui->greenPaperColorEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged);
connect(ui->bluePaperColorEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged); connect(ui->bluePaperColorEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged);
connect(ui->pageIndexScrollBar, &QScrollBar::valueChanged, this, &OutputPreviewDialog::updatePageImage);
connect(ui->inksTreeWidget->model(), &QAbstractItemModel::dataChanged, this, &OutputPreviewDialog::onInksChanged); connect(ui->inksTreeWidget->model(), &QAbstractItemModel::dataChanged, this, &OutputPreviewDialog::onInksChanged);
updatePageImage(); updatePageImage();
@ -295,6 +296,8 @@ void OutputPreviewDialog::onPageImageRendered()
{ {
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
if (m_future.isFinished())
{
RenderedImage result = m_future.result(); RenderedImage result = m_future.result();
m_future = QFuture<RenderedImage>(); m_future = QFuture<RenderedImage>();
m_futureWatcher->deleteLater(); m_futureWatcher->deleteLater();
@ -307,6 +310,7 @@ void OutputPreviewDialog::onPageImageRendered()
updatePageImage(); updatePageImage();
} }
} }
}
bool OutputPreviewDialog::isRenderingDone() const bool OutputPreviewDialog::isRenderingDone() const
{ {