mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Issue #139: Changing page layout reset the current page
This commit is contained in:
@ -1328,7 +1328,24 @@ void PDFDrawWidgetProxy::setPageLayout(PageLayout pageLayout)
|
||||
{
|
||||
if (getPageLayout() != pageLayout)
|
||||
{
|
||||
std::optional<PDFInteger> pageIndex;
|
||||
|
||||
if (m_widget)
|
||||
{
|
||||
std::vector<PDFInteger> currentPages = m_widget->getDrawWidget()->getCurrentPages();
|
||||
if (!currentPages.empty())
|
||||
{
|
||||
pageIndex = currentPages.front();
|
||||
}
|
||||
}
|
||||
|
||||
m_controller->setPageLayout(pageLayout);
|
||||
|
||||
if (pageIndex.has_value())
|
||||
{
|
||||
goToPage(*pageIndex);
|
||||
}
|
||||
|
||||
Q_EMIT pageLayoutChanged();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user