2017-04-23 15:05:48 +02:00
|
|
|
#include "cropview.hpp"
|
|
|
|
|
2017-05-06 13:21:12 +02:00
|
|
|
CropView::CropView(QGraphicsScene *scene) : QGraphicsView(scene) {
|
2017-05-09 17:26:00 +02:00
|
|
|
setFrameShape(QFrame::NoFrame); // Time taken to solve: A george99g and 38 minutes.
|
|
|
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
|
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
2017-06-18 19:04:25 +02:00
|
|
|
setWindowFlags(windowFlags() | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
2017-05-09 17:26:00 +02:00
|
|
|
setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::HighQualityAntialiasing);
|
|
|
|
setCursor(QCursor(Qt::CrossCursor));
|
2017-06-27 00:02:27 +02:00
|
|
|
setMouseTracking(true);
|
2017-06-29 14:37:08 +02:00
|
|
|
setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
2017-04-23 15:05:48 +02:00
|
|
|
}
|
|
|
|
|
2017-05-06 13:21:12 +02:00
|
|
|
void CropView::keyPressEvent(QKeyEvent *e) {
|
2017-05-09 17:26:00 +02:00
|
|
|
if (e->key() == Qt::Key_Escape) {
|
|
|
|
close();
|
|
|
|
e->accept();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
QGraphicsView::keyPressEvent(e);
|
2017-04-23 15:05:48 +02:00
|
|
|
}
|