fix: print preview does not work

This commit is contained in:
xiaoyifang 2022-01-26 00:29:58 +08:00
parent c035cdc4ae
commit de0815f45d

View file

@ -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 )