diff options
Diffstat (limited to 'examples/pdfwidgets/pdfviewer/mainwindow.cpp')
-rw-r--r-- | examples/pdfwidgets/pdfviewer/mainwindow.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/examples/pdfwidgets/pdfviewer/mainwindow.cpp b/examples/pdfwidgets/pdfviewer/mainwindow.cpp index d865a8bdd..8ef7a075e 100644 --- a/examples/pdfwidgets/pdfviewer/mainwindow.cpp +++ b/examples/pdfwidgets/pdfviewer/mainwindow.cpp @@ -87,6 +87,8 @@ void MainWindow::open(const QUrl &docLocation) { if (docLocation.isLocalFile()) { m_document->load(docLocation.toLocalFile()); + const auto documentTitle = m_document->metaData(QPdfDocument::Title).toString(); + setWindowTitle(!documentTitle.isEmpty() ? documentTitle : QStringLiteral("PDF Viewer")); } else { qCDebug(lcExample) << docLocation << "is not a valid local file"; QMessageBox::critical(this, tr("Failed to open"), tr("%1 is not a valid local file").arg(docLocation.toString())); |