File indexing completed on 2024-04-28 04:33:44

0001 /*******************************************************************************
0002  * Copyright (C) 2020 by Steve Allewell                                        *
0003  * steve.allewell@gmail.com                                                    *
0004  *                                                                             *
0005  * This program is free software; you can redistribute it and/or modify        *
0006  * it under the terms of the GNU General Public License as published by        *
0007  * the Free Software Foundation; either version 2 of the License, or           *
0008  * (at your option) any later version.                                         *
0009  ******************************************************************************/
0010 
0011 
0012 #ifndef Thumbnail_H
0013 #define Thumbnail_H
0014 
0015 
0016 #include <QListWidgetItem>
0017 
0018 #include <poppler-qt5.h>
0019 
0020 
0021 class QImage;
0022 
0023 
0024 class Thumbnail : public QListWidgetItem
0025 {
0026 public:
0027     Thumbnail(Poppler::Page *pdfPage, QListWidget *parent);
0028     ~Thumbnail();
0029 
0030     QImage image() const;
0031 
0032     int heightForWidth(int width) const;
0033 
0034 protected:
0035 
0036 public slots:
0037     void renderPage();
0038     void setImage(const QImage &image);
0039 
0040 private:
0041     Poppler::Page   *m_pdfPage;
0042     QImage          m_image;
0043 };
0044 
0045 
0046 #endif