From 3bf1c9c4f72c5e0685cd246c1218e95553bb96d5 Mon Sep 17 00:00:00 2001 From: ArsenArsen Date: Mon, 26 Jun 2017 17:58:36 +0200 Subject: [PATCH] Make moving items possible --- cropeditor/cropscene.cpp | 10 ++++++++++ recording/recordingformats.cpp | 6 ------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cropeditor/cropscene.cpp b/cropeditor/cropscene.cpp index 4b66581..fb860db 100644 --- a/cropeditor/cropscene.cpp +++ b/cropeditor/cropscene.cpp @@ -1,5 +1,6 @@ #include "cropscene.hpp" #include +#include #include #include #include @@ -103,6 +104,15 @@ void CropScene::fontAsk() { void CropScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) { 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 (drawingSelection) { drawingSelection->mouseDragEvent(e, this); diff --git a/recording/recordingformats.cpp b/recording/recordingformats.cpp index 2e449b6..115dcf1 100644 --- a/recording/recordingformats.cpp +++ b/recording/recordingformats.cpp @@ -30,12 +30,6 @@ RecordingFormats::RecordingFormats(formats::Recording f) { iFormat = QImage::Format_RGB888; path = tmpDir.absoluteFilePath("res." + formats::recordingFormatName(f).toLower()); finalizer = [&] { - qDebug() << "end"; - try { - enc->end(); - } catch (std::runtime_error e) { - qCritical() << "Encoder error: " << e.what(); - } delete enc; if (interrupt) { tmpDir.removeRecursively();