diff --git a/tools/chatgui/src/avatars/avatarcrop.cpp b/tools/chatgui/src/avatars/avatarcrop.cpp index 437fac667..8a4e986a3 100644 --- a/tools/chatgui/src/avatars/avatarcrop.cpp +++ b/tools/chatgui/src/avatars/avatarcrop.cpp @@ -67,13 +67,16 @@ protected: offset *= zoom/previous; clamp(); update(); e->accept(); } void mousePressEvent(QMouseEvent* e) override { + DEBUG_TRACE(DEBUG_CATEGORY_MEDIA, "avatar crop press: button=%x image=%d", unsigned(e->button()), !image.isNull()); if (e->button() == Qt::LeftButton && !image.isNull()) { last = e->pos(); dragging = true; setCursor(Qt::ClosedHandCursor); } } void mouseMoveEvent(QMouseEvent* e) override { + DEBUG_TRACE(DEBUG_CATEGORY_MEDIA, "avatar crop move: dragging=%d buttons=%x x=%d y=%d", dragging, unsigned(e->buttons()), e->pos().x(), e->pos().y()); if (!(e->buttons() & Qt::LeftButton)) { dragging = false; setCursor(Qt::OpenHandCursor); } if (dragging) { offset += e->pos()-last; last = e->pos(); clamp(); update(); } } void mouseReleaseEvent(QMouseEvent* e) override { + DEBUG_TRACE(DEBUG_CATEGORY_MEDIA, "avatar crop release: button=%x dragging=%d", unsigned(e->button()), dragging); if (e->button() == Qt::LeftButton) { dragging = false; setCursor(Qt::OpenHandCursor); } } private: diff --git a/tools/chatgui/tests/test_avatar_crop.cpp b/tools/chatgui/tests/test_avatar_crop.cpp index ca5d27c9b..f00907a91 100644 --- a/tools/chatgui/tests/test_avatar_crop.cpp +++ b/tools/chatgui/tests/test_avatar_crop.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include extern "C" { @@ -106,6 +107,8 @@ private slots: } void lostLeftButtonStopsDrag() { + debug_set_category_level(DEBUG_CATEGORY_MEDIA, DEBUG_LEVEL_TRACE); + auto restore = qScopeGuard([] { debug_set_category_level(DEBUG_CATEGORY_MEDIA, DEBUG_LEVEL_WARN); }); QTemporaryDir directory; QVERIFY(directory.isValid()); const QString path = directory.filePath("source.png"); QImage image(800, 400, QImage::Format_RGB32); image.fill(Qt::blue); QVERIFY(image.save(path)); QRectF crop;