mirror of
https://github.com/YACReader/yacreader
synced 2026-04-12 15:49:53 -04:00
Trigger a rendering pass when the settings change
This commit is contained in:
@ -2,6 +2,7 @@
|
|||||||
#include "continuous_view_model.h"
|
#include "continuous_view_model.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "resize_image.h"
|
#include "resize_image.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
@ -78,6 +79,12 @@ QSize ContinuousPageWidget::sizeHint() const
|
|||||||
return QSize(width(), continuousViewModel->totalHeight());
|
return QSize(width(), continuousViewModel->totalHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContinuousPageWidget::invalidateScaledImageCache()
|
||||||
|
{
|
||||||
|
scaledPageCache.invalidateAll();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
void ContinuousPageWidget::onPageAvailable(int absolutePageIndex)
|
void ContinuousPageWidget::onPageAvailable(int absolutePageIndex)
|
||||||
{
|
{
|
||||||
if (!render || !continuousViewModel || absolutePageIndex < 0 || absolutePageIndex >= continuousViewModel->numPages()) {
|
if (!render || !continuousViewModel || absolutePageIndex < 0 || absolutePageIndex >= continuousViewModel->numPages()) {
|
||||||
|
|||||||
@ -28,6 +28,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onPageAvailable(int absolutePageIndex);
|
void onPageAvailable(int absolutePageIndex);
|
||||||
|
void invalidateScaledImageCache();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|||||||
@ -148,7 +148,7 @@ void MainWindowViewer::setupUI()
|
|||||||
connect(optionsDialog, &QDialog::accepted, viewer, &Viewer::updateOptions);
|
connect(optionsDialog, &QDialog::accepted, viewer, &Viewer::updateOptions);
|
||||||
connect(optionsDialog, &YACReaderOptionsDialog::optionsChanged, this, &MainWindowViewer::reloadOptions);
|
connect(optionsDialog, &YACReaderOptionsDialog::optionsChanged, this, &MainWindowViewer::reloadOptions);
|
||||||
connect(optionsDialog, &OptionsDialog::changedFilters, viewer, &Viewer::updateFilters);
|
connect(optionsDialog, &OptionsDialog::changedFilters, viewer, &Viewer::updateFilters);
|
||||||
connect(optionsDialog, &OptionsDialog::changedImageOptions, viewer, &Viewer::updatePage);
|
connect(optionsDialog, &OptionsDialog::changedImageOptions, viewer, &Viewer::onImageOptionsChanged);
|
||||||
|
|
||||||
optionsDialog->restoreOptions(settings);
|
optionsDialog->restoreOptions(settings);
|
||||||
// shortcutsDialog = new ShortcutsDialog(this);
|
// shortcutsDialog = new ShortcutsDialog(this);
|
||||||
|
|||||||
@ -358,6 +358,15 @@ void Viewer::goTo(unsigned int page)
|
|||||||
render->goTo(page);
|
render->goTo(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Viewer::onImageOptionsChanged()
|
||||||
|
{
|
||||||
|
if (continuousScroll) {
|
||||||
|
continuousWidget->invalidateScaledImageCache();
|
||||||
|
} else {
|
||||||
|
updatePage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Viewer::updatePage()
|
void Viewer::updatePage()
|
||||||
{
|
{
|
||||||
if (continuousScroll) {
|
if (continuousScroll) {
|
||||||
|
|||||||
@ -58,6 +58,7 @@ public slots:
|
|||||||
void goToLastPage();
|
void goToLastPage();
|
||||||
void goTo(unsigned int page);
|
void goTo(unsigned int page);
|
||||||
void updatePage();
|
void updatePage();
|
||||||
|
void onImageOptionsChanged();
|
||||||
void updateContentSize();
|
void updateContentSize();
|
||||||
void updateVerticalScrollBar();
|
void updateVerticalScrollBar();
|
||||||
void updateOptions();
|
void updateOptions();
|
||||||
|
|||||||
Reference in New Issue
Block a user