From 1a66b804a2d39c08c6539f921e23cf3bf1308ea8 Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Sat, 30 Dec 2023 16:45:27 +0100 Subject: [PATCH] Issue #139: Changing page layout reset the current page --- .../sources/pdfdrawspacecontroller.cpp | 17 +++++++++++++++++ RELEASES.txt | 1 + 2 files changed, 18 insertions(+) diff --git a/Pdf4QtLibWidgets/sources/pdfdrawspacecontroller.cpp b/Pdf4QtLibWidgets/sources/pdfdrawspacecontroller.cpp index 239795e..6c0db60 100644 --- a/Pdf4QtLibWidgets/sources/pdfdrawspacecontroller.cpp +++ b/Pdf4QtLibWidgets/sources/pdfdrawspacecontroller.cpp @@ -1328,7 +1328,24 @@ void PDFDrawWidgetProxy::setPageLayout(PageLayout pageLayout) { if (getPageLayout() != pageLayout) { + std::optional pageIndex; + + if (m_widget) + { + std::vector currentPages = m_widget->getDrawWidget()->getCurrentPages(); + if (!currentPages.empty()) + { + pageIndex = currentPages.front(); + } + } + m_controller->setPageLayout(pageLayout); + + if (pageIndex.has_value()) + { + goToPage(*pageIndex); + } + Q_EMIT pageLayoutChanged(); } } diff --git a/RELEASES.txt b/RELEASES.txt index a68d0bf..d202b20 100644 --- a/RELEASES.txt +++ b/RELEASES.txt @@ -1,4 +1,5 @@ CURRENT: + - Issue #139: Changing page layout reset the current page - Issue #137: Redaction - Cannot convert '#000000' to color value - Issue #134: Add search bar for actions - Issue #133: Rectangle selector when choosing the page of the PDF