File indexing completed on 2024-04-28 15:51:45
0001 /* 0002 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0003 0004 */ 0005 0006 #ifndef MAGNIFIERVIEW_H 0007 #define MAGNIFIERVIEW_H 0008 0009 #include "core/observer.h" 0010 #include "core/page.h" 0011 #include <QWidget> 0012 0013 class MagnifierView : public QWidget, public Okular::DocumentObserver 0014 { 0015 Q_OBJECT 0016 0017 public: 0018 explicit MagnifierView(Okular::Document *document, QWidget *parent = nullptr); 0019 ~MagnifierView() override; 0020 0021 void notifySetup(const QVector<Okular::Page *> &pages, int setupFlags) override; 0022 void notifyPageChanged(int page, int flags) override; 0023 void notifyCurrentPageChanged(int previous, int current) override; 0024 bool canUnloadPixmap(int page) const override; 0025 0026 void updateView(const Okular::NormalizedPoint &p, const Okular::Page *page); 0027 void move(int x, int y); 0028 0029 protected: 0030 void paintEvent(QPaintEvent *e) override; 0031 0032 private: 0033 Okular::NormalizedRect normalizedView() const; 0034 void requestPixmap(); 0035 void drawTicks(QPainter *p); 0036 0037 private: 0038 Okular::Document *m_document; 0039 Okular::NormalizedPoint m_viewpoint; 0040 const Okular::Page *m_page; 0041 int m_current; 0042 QVector<Okular::Page *> m_pages; 0043 }; 0044 0045 #endif // MAGNIFIERVIEW_H