KShare/cropeditor/cropview.cpp
ArsenArsen b8880b1c03 Magnifier!
Stolen from ShareX.

Jaex didn't say I can't!
2017-06-27 00:02:27 +02:00

21 lines
750 B
C++

#include "cropview.hpp"
CropView::CropView(QGraphicsScene *scene) : QGraphicsView(scene) {
setFrameShape(QFrame::NoFrame); // Time taken to solve: A george99g and 38 minutes.
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setWindowFlags(windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::HighQualityAntialiasing);
setCursor(QCursor(Qt::CrossCursor));
setMouseTracking(true);
}
void CropView::keyPressEvent(QKeyEvent *e) {
if (e->key() == Qt::Key_Escape) {
close();
e->accept();
return;
}
QGraphicsView::keyPressEvent(e);
}