Warning, file /graphics/kxstitch/src/Preview.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * Copyright (C) 2010-2022 by Stephen 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 #ifndef Preview_H
0012 #define Preview_H
0013 
0014 #include <QPixmap>
0015 #include <QWidget>
0016 
0017 #include "Renderer.h"
0018 
0019 class Document;
0020 
0021 class Preview : public QWidget
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit Preview(QWidget *);
0027     virtual ~Preview() = default;
0028 
0029     void setDocument(Document *);
0030     Document *document();
0031 
0032     void readDocumentSettings();
0033     void drawContents();
0034 
0035 public slots:
0036     void setVisibleCells(const QRect &);
0037 
0038     void loadSettings();
0039 
0040 signals:
0041     void clicked(QPoint);
0042     void clicked(QRect);
0043 
0044 protected:
0045     virtual void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
0046     virtual void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
0047     virtual void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
0048     virtual void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
0049 
0050 private:
0051     QPoint contentToCell(const QPoint &content) const;
0052 
0053     Document *m_document;
0054     Renderer m_renderer;
0055     QRect m_visible;
0056     QPoint m_start;
0057     QPoint m_tracking;
0058     QPoint m_end;
0059     QRect m_rubberBand;
0060     double m_cellWidth;
0061     double m_cellHeight;
0062     double m_previewWidth;
0063     double m_previewHeight;
0064     double m_zoomFactor;
0065 
0066     QPixmap m_cachedContents;
0067 };
0068 
0069 #endif // Preview_H