blob: 07fef477df85031b96455ab19545639456d641fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#ifndef SEQUENTIALPAGEWIDGET_H
#define SEQUENTIALPAGEWIDGET_H
#include <QWidget>
class QPdfDocument;
class SequentialPageWidget : public QWidget
{
Q_OBJECT
public:
explicit SequentialPageWidget(QWidget *parent = 0);
~SequentialPageWidget();
void paintEvent(QPaintEvent * event);
qreal zoom() { return m_zoom; }
qreal yForPage(int page);
int topPageShowing() { return m_topPageShowing; }
int bottomPageShowing() { return m_bottomPageShowing; }
public slots:
void setDocument(QPdfDocument *doc);
void setZoom(qreal factor);
void invalidate();
signals:
void showingPageRange(int start, int end);
void zoomChanged(qreal factor);
private:
QSizeF pageSize(int page);
void render(int page);
private:
QPdfDocument *m_doc;
QHash<int, QPixmap> m_pageCache;
QBrush m_background;
int m_pageSpacing;
int m_topPageShowing;
int m_bottomPageShowing;
QSize m_totalSize;
qreal m_zoom;
qreal m_screenResolution; // pixels per point
};
#endif // SEQUENTIALPAGEWIDGET_H
|