mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-21 12:26:11 +00:00
Always enter mouse drag mode when clicking on overview widget. (#1539)
Fixes #1503.
This commit is contained in:
parent
5a59546009
commit
7bc4dd06bc
@ -82,29 +82,21 @@ void OverviewView::paintEvent(QPaintEvent *event)
|
|||||||
p.drawRect(rangeRect);
|
p.drawRect(rangeRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OverviewView::mouseContainsRect(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
if (rangeRect.contains(event->pos())) {
|
|
||||||
mouseActive = true;
|
|
||||||
initialDiff = QPointF(event->localPos().x() - rangeRect.x(), event->localPos().y() - rangeRect.y());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OverviewView::mousePressEvent(QMouseEvent *event)
|
void OverviewView::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (mouseContainsRect(event)) {
|
mouseActive = true;
|
||||||
return;
|
if (rangeRect.contains(event->pos())) {
|
||||||
}
|
initialDiff = QPointF(event->localPos().x() - rangeRect.x(), event->localPos().y() - rangeRect.y());
|
||||||
|
} else {
|
||||||
qreal w = rangeRect.width();
|
qreal w = rangeRect.width();
|
||||||
qreal h = rangeRect.height();
|
qreal h = rangeRect.height();
|
||||||
qreal x = event->localPos().x() - w / 2;
|
qreal x = event->localPos().x() - w / 2;
|
||||||
qreal y = event->localPos().y() - h / 2;
|
qreal y = event->localPos().y() - h / 2;
|
||||||
rangeRect = QRectF(x, y, w, h);
|
rangeRect = QRectF(x, y, w, h);
|
||||||
|
initialDiff = QPointF(w / 2, h / 2);
|
||||||
viewport()->update();
|
viewport()->update();
|
||||||
emit mouseMoved();
|
emit mouseMoved();
|
||||||
mouseContainsRect(event);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverviewView::mouseReleaseEvent(QMouseEvent *event)
|
void OverviewView::mouseReleaseEvent(QMouseEvent *event)
|
||||||
|
@ -105,11 +105,6 @@ private:
|
|||||||
virtual GraphView::EdgeConfiguration edgeConfiguration(GraphView::GraphBlock &from,
|
virtual GraphView::EdgeConfiguration edgeConfiguration(GraphView::GraphBlock &from,
|
||||||
GraphView::GraphBlock *to) override;
|
GraphView::GraphBlock *to) override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief if the mouse is in the rect in Overview.
|
|
||||||
*/
|
|
||||||
bool mouseContainsRect(QMouseEvent *event);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief base background color changing depending on the theme
|
* @brief base background color changing depending on the theme
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user