summaryrefslogtreecommitdiffstats
path: root/examples/widgets/pdfviewer/sequentialpagewidget.h
blob: 44b27faadc1ccc407bbc2e8c1795d032571afd7d (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
#ifndef SEQUENTIALPAGEWIDGET_H
#define SEQUENTIALPAGEWIDGET_H

#include <QWidget>
#include <QDebug>

class QPdfDocument;

class SequentialPageWidget : public QWidget
{
    Q_OBJECT
public:
    explicit SequentialPageWidget(QWidget *parent = 0);
    ~SequentialPageWidget();

    void paintEvent(QPaintEvent * event);

public slots:
    void setDocument(QPdfDocument *doc);
    void setZoom(qreal factor);
    void invalidate();

signals:
    void showingPageRange(int start, int end);

private:
    QSizeF pageSize(int page);
    void render(int page);

private:
    QPdfDocument *m_doc;
    QHash<int, QPixmap> m_pageCache;
    QBrush m_background;
    int m_pageSpacing;
    QSize m_totalSize;
    qreal m_zoom;
    qreal m_screenResolution; // pixels per point
};

#endif // SEQUENTIALPAGEWIDGET_H