mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 00:30:53 +01:00
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:
@@ -470,7 +470,7 @@ void DiagramView::pasteHere() {
|
||||
}
|
||||
|
||||
/**
|
||||
Manage the events press click mouse :
|
||||
Manage the events press click :
|
||||
* click to add an independent text field
|
||||
*/
|
||||
void DiagramView::mousePressEvent(QMouseEvent *e) {
|
||||
@@ -490,11 +490,11 @@ void DiagramView::mousePressEvent(QMouseEvent *e) {
|
||||
}
|
||||
}
|
||||
|
||||
//Start drag view when hold the middle button
|
||||
if (e -> button() == Qt::MidButton) {
|
||||
rubber_band_origin = mapToScene(e -> pos());
|
||||
//Start drag view when hold the middle button
|
||||
if (e->button() == Qt::MidButton)
|
||||
{
|
||||
rubber_band_origin = e->pos();
|
||||
setCursor(Qt::ClosedHandCursor);
|
||||
center_view_ = mapToScene(this -> viewport() -> rect().center());
|
||||
}
|
||||
|
||||
else QGraphicsView::mousePressEvent(e);
|
||||
@@ -515,11 +515,16 @@ void DiagramView::mouseMoveEvent(QMouseEvent *e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//Drag the view
|
||||
if (e -> buttons() == Qt::MidButton) {
|
||||
QPointF move = rubber_band_origin - mapToScene(e -> pos());
|
||||
this -> centerOn(center_view_ + move);
|
||||
center_view_ = mapToScene( this -> viewport() -> rect().center() );
|
||||
|
||||
//Drag the view
|
||||
if (e->buttons() == Qt::MidButton)
|
||||
{
|
||||
QScrollBar *h = horizontalScrollBar();
|
||||
QScrollBar *v = verticalScrollBar();
|
||||
QPointF pos = rubber_band_origin - e -> pos();
|
||||
rubber_band_origin = e -> pos();
|
||||
h -> setValue(h -> value() + pos.x());
|
||||
v -> setValue(v -> value() + pos.y());
|
||||
}
|
||||
|
||||
else QGraphicsView::mouseMoveEvent(e);
|
||||
|
||||
Reference in New Issue
Block a user