Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/LtsWidgets/LtsImageCropper/lts_image_cropper.h
T
torstenandCopilot d6b6ffce7c Apply clang-format to Lts/Common and DTC/enum headers
- Formatted all CodeGen module files (9 files)
- Formatted LtsAppDescriptor module files
- Formatted LtsAppManager/AppChooser files
- Applied clang-format to all DTC and enum headers across modules
- Removed coordTransTests from CommonUnitTestsPlaceholder (moved to tests/)

Cosmetic changes only, no functional modifications.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-19 14:46:29 +02:00

72 lines
1.4 KiB
C++

#pragma once
#include "ltswidgets_export.h"
#include <QGraphicsView>
#include <QObject>
namespace LtsWidgets
{
class LTSWIDGETS_EXPORT LtsImageCropper : public QGraphicsView
{
Q_OBJECT
Q_PROPERTY(QPixmap pixMap READ pixmap WRITE setPixmap)
Q_PROPERTY(double multiplier READ multiplier WRITE setMultiplier)
Q_PROPERTY(double maxZoom READ maxZoom WRITE setMaxZoom)
public:
LtsImageCropper(QWidget* parent = nullptr, const QSize& size = {}, const QPixmap& pixmap = {});
~LtsImageCropper();
void setPixmap(const QPixmap& pixmap);
void setImage(const QImage& image);
void setMultiplier(double multiplier);
void setMaxZoom(double maxZoom)
{
m_maxScale = maxZoom;
}
QPixmap pixmap()
{
return grab();
}
QImage image();
double multiplier() const
{
return m_multiplier;
}
double maxZoom() const
{
return m_maxScale;
}
private:
QGraphicsScene* m_scene = nullptr;
QGraphicsPixmapItem* m_pixmapItem = nullptr;
double m_currentZoom;
double m_minScale;
double m_maxScale;
double m_stepScale;
double m_multiplier;
void calculateScaleStep();
protected:
void wheelEvent(QWheelEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
void mouseReleaseEvent(QMouseEvent* event) override;
};
} // namespace LtsWidgets