From c633b1b4b832c55f39119a42d0f087925ae823c9 Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Sun, 14 Mar 2021 16:46:57 +0100 Subject: [PATCH] Bugfixing: Output preview dialog crash and scrollbar update --- .../outputpreviewdialog.cpp | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Pdf4QtViewerPlugins/OutputPreviewPlugin/outputpreviewdialog.cpp b/Pdf4QtViewerPlugins/OutputPreviewPlugin/outputpreviewdialog.cpp index 8e36df0..cd3ecf3 100644 --- a/Pdf4QtViewerPlugins/OutputPreviewPlugin/outputpreviewdialog.cpp +++ b/Pdf4QtViewerPlugins/OutputPreviewPlugin/outputpreviewdialog.cpp @@ -50,6 +50,7 @@ OutputPreviewDialog::OutputPreviewDialog(const pdf::PDFDocument* document, pdf:: connect(ui->redPaperColorEdit, QOverload::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged); connect(ui->greenPaperColorEdit, QOverload::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged); connect(ui->bluePaperColorEdit, QOverload::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged); + connect(ui->pageIndexScrollBar, &QScrollBar::valueChanged, this, &OutputPreviewDialog::updatePageImage); connect(ui->inksTreeWidget->model(), &QAbstractItemModel::dataChanged, this, &OutputPreviewDialog::onInksChanged); updatePageImage(); @@ -295,16 +296,19 @@ void OutputPreviewDialog::onPageImageRendered() { QApplication::restoreOverrideCursor(); - RenderedImage result = m_future.result(); - m_future = QFuture(); - m_futureWatcher->deleteLater(); - m_futureWatcher = nullptr; - - ui->imageLabel->setPixmap(QPixmap::fromImage(result.image)); - - if (m_needUpdateImage) + if (m_future.isFinished()) { - updatePageImage(); + RenderedImage result = m_future.result(); + m_future = QFuture(); + m_futureWatcher->deleteLater(); + m_futureWatcher = nullptr; + + ui->imageLabel->setPixmap(QPixmap::fromImage(result.image)); + + if (m_needUpdateImage) + { + updatePageImage(); + } } }