mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 22:00:35 +01:00
Update wheel mouse event and add the possibility to change mode (selection, visu) with the wheel click.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2091 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -419,16 +419,6 @@ void DiagramView::mousePressEvent(QMouseEvent *e) {
|
||||
switchToVisualisationModeIfNeeded(e);
|
||||
fresh_focus_in_ = false;
|
||||
}
|
||||
if (isInteractive() && !scene -> isReadOnly()) {
|
||||
if (e -> buttons() == Qt::MidButton) {
|
||||
paste(mapToScene(e -> pos()), QClipboard::Selection);
|
||||
} else {
|
||||
if (is_adding_text && e -> buttons() == Qt::LeftButton) {
|
||||
addDiagramTextAtPos(mapToScene(e -> pos()));
|
||||
is_adding_text = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
QGraphicsView::mousePressEvent(e);
|
||||
}
|
||||
|
||||
@@ -437,10 +427,26 @@ void DiagramView::mousePressEvent(QMouseEvent *e) {
|
||||
@param e QWheelEvent
|
||||
*/
|
||||
void DiagramView::wheelEvent(QWheelEvent *e) {
|
||||
if (e -> delta() > 0) {
|
||||
zoomIn();
|
||||
} else {
|
||||
zoomOut();
|
||||
//Zoom and scrolling
|
||||
if (e->buttons() != Qt::MidButton) {
|
||||
if (!(e -> modifiers() & Qt::ControlModifier)) {
|
||||
if (e -> delta() > 0) zoomIn();
|
||||
else zoomOut();
|
||||
}
|
||||
else {
|
||||
QAbstractScrollArea::wheelEvent(e);
|
||||
}
|
||||
}
|
||||
// Or select visualisation or selection mode
|
||||
else{
|
||||
if (!is_moving_view_) {
|
||||
setVisualisationMode();
|
||||
is_moving_view_ = true;
|
||||
}
|
||||
else{
|
||||
setSelectionMode();
|
||||
is_moving_view_ = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user