Toggle ScrollHandDrag mode by clicking a middle mouse button.
--HG-- branch : develop
This commit is contained in:
parent
77c09063ff
commit
254ccf8f52
|
@ -1,4 +1,5 @@
|
|||
# Version 0.5.0
|
||||
- Toggle ScrollHandDrag mode by clicking a middle mouse button.
|
||||
- Added horizontal scrolling by pressiong Shift + mouse wheel.
|
||||
- [#366] Update 'Point from Distance and Angle' tool to read distance and angle between points.
|
||||
- [#395] Create Curve tool which uses point as control handle.
|
||||
|
|
|
@ -80,14 +80,6 @@ void VMainGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||
}
|
||||
|
||||
QGraphicsScene::mousePressEvent(event);
|
||||
// if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier)
|
||||
// {
|
||||
// QList<QGraphicsItem *> items = selectedItems();
|
||||
// for (int i=0; i< items.size(); i++)
|
||||
// {
|
||||
// items[i]->setSelected(false);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -382,14 +382,11 @@ void VMainGraphicsView::ZoomFitBest()
|
|||
*/
|
||||
void VMainGraphicsView::mousePressEvent(QMouseEvent *mousePress)
|
||||
{
|
||||
if (mousePress->button() & Qt::LeftButton)
|
||||
switch (mousePress->button())
|
||||
{
|
||||
switch (QGuiApplication::keyboardModifiers())
|
||||
case Qt::LeftButton:
|
||||
{
|
||||
case Qt::ControlModifier:
|
||||
QGraphicsView::setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
break;
|
||||
case Qt::NoModifier:
|
||||
QGraphicsView::setDragMode(QGraphicsView::RubberBandDrag);
|
||||
if (showToolOptions)
|
||||
{
|
||||
QList<QGraphicsItem *> list = items(mousePress->pos());
|
||||
|
@ -416,10 +413,19 @@ void VMainGraphicsView::mousePressEvent(QMouseEvent *mousePress)
|
|||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Qt::MiddleButton:
|
||||
{
|
||||
QGraphicsView::setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
// create a new mouse event that simulates a click of the left button instead of the middle button
|
||||
QMouseEvent mouseEvent (mousePress->type(), mousePress->pos(), Qt::LeftButton, Qt::LeftButton,
|
||||
mousePress->modifiers());
|
||||
QGraphicsView::mousePressEvent(&mouseEvent);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
QGraphicsView::mousePressEvent(mousePress);
|
||||
}
|
||||
|
||||
|
@ -431,7 +437,7 @@ void VMainGraphicsView::mousePressEvent(QMouseEvent *mousePress)
|
|||
void VMainGraphicsView::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
QGraphicsView::mouseReleaseEvent ( event );
|
||||
QGraphicsView::setDragMode( QGraphicsView::RubberBandDrag );
|
||||
QGraphicsView::setDragMode( QGraphicsView::NoDrag );
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
emit MouseRelease();
|
||||
|
|
Loading…
Reference in New Issue
Block a user