rm ingored

This commit is contained in:
2024-11-22 23:26:07 +03:00
parent 5450d1756f
commit 63e4c1382f
65 changed files with 0 additions and 7599 deletions

View File

@@ -1,48 +0,0 @@
#include <QApplication>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QPixmap>
#include <QWheelEvent>
#include <QMouseEvent>
#include <QtMath>
#include "imageredactor.h"
ImageRedactor::ImageRedactor(QWidget *parent) : QGraphicsView(parent) {
scene = new QGraphicsScene(this);
setScene(scene);
// Load the image
QPixmap pixmap("image.jpg");
item = new QGraphicsPixmapItem(pixmap);
scene->addItem(item);
// Set the initial zoom level
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
}
void ImageRedactor::wheelEvent(QWheelEvent *event) {
// Zoom in/out
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
double angle = event->angleDelta().y();
double factor = qPow(1.2, angle / 240.0);
scale(factor, factor);
}
void ImageRedactor::mousePressEvent(QMouseEvent *event)
{
// Pan the image
if (event->button() == Qt::LeftButton)
{
setDragMode(QGraphicsView::ScrollHandDrag);
}
}
void ImageRedactor::mouseReleaseEvent(QMouseEvent *event)
{
// Reset the drag mode
if (event->button() == Qt::LeftButton)
{
setDragMode(QGraphicsView::NoDrag);
}
}

View File

@@ -1,27 +0,0 @@
#ifndef IMAGEREDACTOR_H
#define IMAGEREDACTOR_H
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QWheelEvent>
#include <QMouseEvent>
class ImageRedactor : public QGraphicsView
{
Q_OBJECT
public:
ImageRedactor(QWidget *parent = nullptr);
protected:
void wheelEvent(QWheelEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
private:
QGraphicsScene *scene;
QGraphicsPixmapItem *item;
};
#endif // IMAGEREDACTOR_H