fix - reset the margin of the selected annotation on pin/save/copy/upload operations (#2170)
Co-authored-by: Yuriy Puchkov <yuriy.puchkov@namecheap.com>
This commit is contained in:
@@ -66,6 +66,8 @@ public:
|
||||
REQ_SHOW_COLOR_PICKER,
|
||||
// Notify is the screenshot has been saved.
|
||||
REQ_CAPTURE_DONE_OK,
|
||||
// Notify to redraw screenshot with tools without object selection.
|
||||
REQ_CLEAR_SELECTION,
|
||||
// Instance this->widget()'s widget inside the editor under the mouse.
|
||||
REQ_ADD_CHILD_WIDGET,
|
||||
// Instance this->widget()'s widget which handles its own lifetime.
|
||||
|
||||
@@ -41,6 +41,7 @@ CaptureTool* CopyTool::copy(QObject* parent)
|
||||
|
||||
void CopyTool::pressed(CaptureContext& context)
|
||||
{
|
||||
emit requestAction(REQ_CLEAR_SELECTION);
|
||||
context.request.addTask(CaptureRequest::COPY);
|
||||
emit requestAction(REQ_CAPTURE_DONE_OK);
|
||||
emit requestAction(REQ_CLOSE_GUI);
|
||||
|
||||
@@ -40,6 +40,7 @@ CaptureTool* ImgUploaderTool::copy(QObject* parent)
|
||||
|
||||
void ImgUploaderTool::pressed(CaptureContext& context)
|
||||
{
|
||||
emit requestAction(REQ_CLEAR_SELECTION);
|
||||
emit requestAction(REQ_CAPTURE_DONE_OK);
|
||||
context.request.addTask(CaptureRequest::UPLOAD);
|
||||
emit requestAction(REQ_CLOSE_GUI);
|
||||
|
||||
@@ -42,6 +42,7 @@ CaptureTool* PinTool::copy(QObject* parent)
|
||||
|
||||
void PinTool::pressed(CaptureContext& context)
|
||||
{
|
||||
emit requestAction(REQ_CLEAR_SELECTION);
|
||||
emit requestAction(REQ_CAPTURE_DONE_OK);
|
||||
context.request.addTask(CaptureRequest::PIN);
|
||||
emit requestAction(REQ_CLOSE_GUI);
|
||||
|
||||
@@ -41,6 +41,7 @@ CaptureTool* SaveTool::copy(QObject* parent)
|
||||
|
||||
void SaveTool::pressed(CaptureContext& context)
|
||||
{
|
||||
emit requestAction(REQ_CLEAR_SELECTION);
|
||||
context.request.addSaveTask();
|
||||
emit requestAction(REQ_CAPTURE_DONE_OK);
|
||||
emit requestAction(REQ_CLOSE_GUI);
|
||||
|
||||
@@ -1143,6 +1143,12 @@ void CaptureWidget::handleToolSignal(CaptureTool::Request r)
|
||||
case CaptureTool::REQ_CAPTURE_DONE_OK:
|
||||
m_captureDone = true;
|
||||
break;
|
||||
case CaptureTool::REQ_CLEAR_SELECTION:
|
||||
if (m_panel->activeLayerIndex() >= 0) {
|
||||
m_panel->setActiveLayer(-1);
|
||||
drawToolsData(false);
|
||||
}
|
||||
break;
|
||||
case CaptureTool::REQ_ADD_CHILD_WIDGET:
|
||||
if (!m_activeTool) {
|
||||
break;
|
||||
@@ -1470,7 +1476,7 @@ void CaptureWidget::pushToolToStack()
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureWidget::drawToolsData()
|
||||
void CaptureWidget::drawToolsData(bool drawSelection)
|
||||
{
|
||||
// TODO refactor this for performance. The objects should not all be updated
|
||||
// at once every time
|
||||
@@ -1485,7 +1491,9 @@ void CaptureWidget::drawToolsData()
|
||||
}
|
||||
|
||||
m_context.screenshot = pixmapItem;
|
||||
drawObjectSelection();
|
||||
if (drawSelection) {
|
||||
drawObjectSelection();
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureWidget::drawObjectSelection()
|
||||
|
||||
@@ -127,7 +127,7 @@ private:
|
||||
QRect paddedUpdateRect(const QRect& r) const;
|
||||
void drawErrorMessage(const QString& msg, QPainter* painter);
|
||||
void drawInactiveRegion(QPainter* painter);
|
||||
void drawToolsData();
|
||||
void drawToolsData(bool drawSelection = true);
|
||||
void drawObjectSelection();
|
||||
|
||||
void processPixmapWithTool(QPixmap* pixmap, CaptureTool* tool);
|
||||
|
||||
Reference in New Issue
Block a user