Qt World Summit: Register Today!

Print QWebEngineView

  • good day
    I implement printing in my program, it is necessary to capture the current window and print
    If the program is deployed, then all the text on the tab is printed completely, but if you reduce the program window until the scroll appears, part of the text is not displayed on the printed sheet.

    Is there a solution for my problem?

        m_WebEngineView = new QWebEngineView(ui->tabReport);
        QVBoxLayout* layout = static_cast<QVBoxLayout*>(ui->tabReport->layout());
    void MainWindow::on_act_print_triggered()
        QPrinter printer(QPrinter::ScreenResolution);
        QPrintPreviewDialog preview(&printer, this);
        QPrintDialog *dlg = new QPrintDialog(&printer, this);
        if (m_WebEngineView->hasSelection())
        dlg->setWindowTitle(tr("Print Document"));
        if (dlg->exec() == QDialog::Accepted)
        delete dlg;

Log in to reply