Refractor ImageScrollArea

This commit is contained in:
2024-09-17 12:30:49 +02:00
parent efd3ff35f3
commit 30960033c5
8 changed files with 273 additions and 340 deletions
+26 -17
View File
@@ -1,32 +1,41 @@
#ifndef IMAGESCROLLAREA_H
#define IMAGESCROLLAREA_H
#include <QScrollArea>
#include <QLabel>
#include "imagewidget.h"
class ImageScrollArea : public QScrollArea
class ImageScrollArea : public QWidget
{
Q_OBJECT
QPoint m_lastPos;
QLabel *m_label;
QPixmap m_pixmap;
float m_scale;
QScrollBar *m_verticalScrollBar;
QScrollBar *m_horizontalScrollBar;
ImageWidget *m_imageWidget;
public:
explicit ImageScrollArea(QWidget *parent = 0);
void setImage(const QPixmap &img);
void setScale(float scale);
explicit ImageScrollArea(Database *database, QWidget *parent = nullptr);
~ImageScrollArea();
void allocateThumbnails(const QStringList &paths);
void showThumbnail(bool enable);
void setBayerMask(int mask);
protected:
void updateScrollbars(int valueH, int stepH, int maxH, int valueV, int stepV, int maxV);
public slots:
void zoomIn();
void zoomOut();
void bestFit();
void oneToOne();
protected:
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
void imageLoaded(Image *image);
void thumbnailLoaded(const Image *image);
void setMTFParams(const MTFParam &params);
void invert(bool enable);
void superPixel(bool enable);
void falseColor(bool enable);
QImage renderToImage();
protected slots:
void scrollEvent();
signals:
void fileDropped(const QString &path);
void status(const QString &value, const QString &pixelCoords, const QString &celestialCoords);
void scrollBarsUpdate(int valueH, int stepH, int maxH, int valueV, int stepV, int maxV);
};
#endif // IMAGESCROLLAREA_H