Make moving items possible
This commit is contained in:
parent
4b8b763024
commit
3bf1c9c4f7
@ -1,5 +1,6 @@
|
|||||||
#include "cropscene.hpp"
|
#include "cropscene.hpp"
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
|
#include <QDebug>
|
||||||
#include <QFontDialog>
|
#include <QFontDialog>
|
||||||
#include <QGraphicsPolygonItem>
|
#include <QGraphicsPolygonItem>
|
||||||
#include <QGraphicsSceneContextMenuEvent>
|
#include <QGraphicsSceneContextMenuEvent>
|
||||||
@ -103,6 +104,15 @@ void CropScene::fontAsk() {
|
|||||||
|
|
||||||
void CropScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
void CropScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||||
auto buttons = e->buttons();
|
auto buttons = e->buttons();
|
||||||
|
if (e->modifiers() & Qt::ControlModifier && buttons == Qt::LeftButton) {
|
||||||
|
QTransform stupidThing = views()[0]->transform();
|
||||||
|
auto item = itemAt(e->screenPos(), stupidThing);
|
||||||
|
if (item && item != polyItem && item != rect && item->zValue() != -1) {
|
||||||
|
QPointF delta = e->scenePos() - e->lastScenePos();
|
||||||
|
item->moveBy(delta.x(), delta.y());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (buttons == Qt::LeftButton || prevButtons == Qt::NoButton) {
|
if (buttons == Qt::LeftButton || prevButtons == Qt::NoButton) {
|
||||||
if (drawingSelection) {
|
if (drawingSelection) {
|
||||||
drawingSelection->mouseDragEvent(e, this);
|
drawingSelection->mouseDragEvent(e, this);
|
||||||
|
@ -30,12 +30,6 @@ RecordingFormats::RecordingFormats(formats::Recording f) {
|
|||||||
iFormat = QImage::Format_RGB888;
|
iFormat = QImage::Format_RGB888;
|
||||||
path = tmpDir.absoluteFilePath("res." + formats::recordingFormatName(f).toLower());
|
path = tmpDir.absoluteFilePath("res." + formats::recordingFormatName(f).toLower());
|
||||||
finalizer = [&] {
|
finalizer = [&] {
|
||||||
qDebug() << "end";
|
|
||||||
try {
|
|
||||||
enc->end();
|
|
||||||
} catch (std::runtime_error e) {
|
|
||||||
qCritical() << "Encoder error: " << e.what();
|
|
||||||
}
|
|
||||||
delete enc;
|
delete enc;
|
||||||
if (interrupt) {
|
if (interrupt) {
|
||||||
tmpDir.removeRecursively();
|
tmpDir.removeRecursively();
|
||||||
|
Loading…
Reference in New Issue
Block a user