mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
fix:qt6.2 print preview
This commit is contained in:
parent
9c6ac4afea
commit
913e4128ca
|
@ -1705,7 +1705,6 @@ Config::InputPhrase ArticleView::getPhrase() const
|
||||||
|
|
||||||
void ArticleView::print( QPrinter * printer ) const
|
void ArticleView::print( QPrinter * printer ) const
|
||||||
{
|
{
|
||||||
#if( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
|
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
bool result;
|
bool result;
|
||||||
auto printPreview = [ & ]( bool success )
|
auto printPreview = [ & ]( bool success )
|
||||||
|
@ -1713,16 +1712,17 @@ void ArticleView::print( QPrinter * printer ) const
|
||||||
result = success;
|
result = success;
|
||||||
loop.quit();
|
loop.quit();
|
||||||
};
|
};
|
||||||
|
#if( QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) )
|
||||||
ui.definition->page()->print( printer, std::move( printPreview ) );
|
ui.definition->page()->print( printer, std::move( printPreview ) );
|
||||||
|
#else
|
||||||
|
connect( ui.definition, &QWebEngineView::printFinished, &loop, std::move( printPreview ) );
|
||||||
|
ui.definition->print( printer );
|
||||||
|
#endif
|
||||||
loop.exec();
|
loop.exec();
|
||||||
if( !result )
|
if( !result )
|
||||||
{
|
{
|
||||||
qDebug() << "print failed";
|
qDebug() << "print failed";
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
ui.definition->print( printer );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArticleView::contextMenuRequested( QPoint const & pos )
|
void ArticleView::contextMenuRequested( QPoint const & pos )
|
||||||
|
|
Loading…
Reference in a new issue