Minor change about how drag view work (diagram editor and element editor)

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3849 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2015-03-24 22:21:58 +00:00
parent 9072d3de04
commit 2f9fd79371
4 changed files with 31 additions and 27 deletions

View File

@@ -360,14 +360,13 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) {
@param e QMouseEvent decrivant l'evenement souris
*/
void ElementView::mousePressEvent(QMouseEvent *e) {
// Select visualisation or selection mode
if (e -> buttons() == Qt::MidButton) {
setCursor(Qt::ClosedHandCursor);
reference_view_ = mapToScene(e -> pos());
center_view_ = mapToScene(this -> viewport() -> rect()).boundingRect().center();
return;
if (e->buttons() == Qt::MidButton)
{
setCursor( (Qt::ClosedHandCursor));
reference_view_ = e->pos();
}
QGraphicsView::mousePressEvent(e);
else
QGraphicsView::mousePressEvent(e);
}
/**
@@ -375,14 +374,17 @@ void ElementView::mousePressEvent(QMouseEvent *e) {
* Manage the event move mouse
*/
void ElementView::mouseMoveEvent(QMouseEvent *e) {
if ((e -> buttons() & Qt::MidButton) == Qt::MidButton) {
QPointF move = reference_view_ - mapToScene(e -> pos());
this -> centerOn(center_view_ + move);
center_view_ = mapToScene(this -> viewport() -> rect()).boundingRect().center();
adjustSceneRect();
return;
if (e->buttons() == Qt::MidButton)
{
QScrollBar *h = horizontalScrollBar();
QScrollBar *v = verticalScrollBar();
QPointF pos = reference_view_ - e -> pos();
reference_view_ = e -> pos();
h -> setValue(h -> value() + pos.x());
v -> setValue(v -> value() + pos.y());
}
QGraphicsView::mouseMoveEvent(e);
else
QGraphicsView::mouseMoveEvent(e);
}
/**