Make m_context.selection synced with m_selection (#1894)

This commit is contained in:
Haris Gušić
2021-09-14 15:16:03 +02:00
committed by GitHub
parent aca0db963b
commit e0cd397dc1
3 changed files with 7 additions and 4 deletions

View File

@@ -750,7 +750,6 @@ void CaptureWidget::mouseReleaseEvent(QMouseEvent* e)
newGeometry.setBottom(top);
}
m_selection->setGeometry(newGeometry);
m_context.selection = extendedRect(newGeometry);
updateSizeIndicator();
m_buttonHandler->updatePosition(newGeometry);
m_buttonHandler->show();
@@ -1046,6 +1045,11 @@ void CaptureWidget::initSelection()
connect(m_selection, &SelectionWidget::animationEnded, this, [this]() {
this->m_buttonHandler->updatePosition(this->m_selection->geometry());
});
connect(m_selection, &SelectionWidget::resized, this, [this]() {
QRect constrainedToCaptureArea =
m_selection->geometry().intersected(rect());
m_context.selection = extendedRect(constrainedToCaptureArea);
});
m_selection->setVisible(false);
m_selection->setGeometry(QRect());
}
@@ -1289,8 +1293,6 @@ void CaptureWidget::repositionSelection(QRect r)
{
if (m_selection->isVisible()) {
m_selection->setGeometry(r);
QRect newGeometry = m_selection->geometry().intersected(rect());
m_context.selection = extendedRect(newGeometry);
m_buttonHandler->updatePosition(m_selection->geometry());
updateSizeIndicator();
update();
@@ -1329,7 +1331,6 @@ void CaptureWidget::selectAll()
{
QRect newGeometry = rect();
m_selection->setGeometry(newGeometry);
m_context.selection = extendedRect(newGeometry);
m_selection->setVisible(true);
m_buttonHandler->updatePosition(m_selection->geometry());
updateSizeIndicator();