File indexing completed on 2024-05-05 04:49:27

0001 /****************************************************************************************
0002  * Copyright (c) 2005 Eyal Lotem <eyal.lotem@gmail.com>                                 *
0003  * Copyright (c) 2007 Seb Ruiz <ruiz@kde.org>                                           *
0004  * Copyright (c) 2009 Pascal Pollet <pascal@bongosoft.de>                               *
0005  *                                                                                      *
0006  * This program is free software; you can redistribute it and/or modify it under        *
0007  * the terms of the GNU General Public License as published by the Free Software        *
0008  * Foundation; either version 2 of the License, or (at your option) any later           *
0009  * version.                                                                             *
0010  *                                                                                      *
0011  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0012  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0013  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0014  *                                                                                      *
0015  * You should have received a copy of the GNU General Public License along with         *
0016  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0017  ****************************************************************************************/
0018 
0019 #ifndef PIXMAPVIEWER_H
0020 #define PIXMAPVIEWER_H
0021 
0022 #include <QScrollArea>
0023 #include <QWidget>
0024 #include <QString>
0025 #include <QPixmap>
0026 
0027 class QPixmap;
0028 
0029 class PixmapViewer : public QWidget
0030 {
0031     Q_OBJECT
0032     Q_PROPERTY( qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged )
0033 
0034 public:
0035     explicit PixmapViewer( QWidget *parent, const QPixmap &pixmap, int screenNumber );
0036     ~PixmapViewer() override;
0037 
0038     qreal zoomFactor() const;
0039 
0040 public Q_SLOTS:
0041     void setZoomFactor( qreal f );
0042 
0043 Q_SIGNALS:
0044     void zoomFactorChanged( qreal );
0045 
0046 protected:
0047     void paintEvent( QPaintEvent *event ) override;
0048     void wheelEvent( QWheelEvent *event ) override;
0049 
0050 private:
0051     const QPixmap m_pixmap;
0052     qreal m_zoomFactor;
0053 };
0054 
0055 #endif