From de0815f45da51f4087fd882ac9f1c9b6bdfa1d44 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Wed, 26 Jan 2022 00:29:58 +0800 Subject: [PATCH] fix: print preview does not work --- articleview.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/articleview.cc b/articleview.cc index d6d97c0d..8dff5775 100644 --- a/articleview.cc +++ b/articleview.cc @@ -1682,7 +1682,15 @@ Config::InputPhrase ArticleView::getPhrase() const void ArticleView::print( QPrinter * printer ) const { - ui.definition->page()->print(printer, [](bool result) {}); + //ui.definition->page()->print(printer, [](bool result) {}); + QEventLoop loop; + bool result; + auto printPreview = [&](bool success) { result = success; loop.quit(); }; + ui.definition->page()->print(printer, std::move(printPreview)); + loop.exec(); + if (!result) { + qDebug()<<"print failed"; + } } void ArticleView::contextMenuRequested( QPoint const & pos )