mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 06:20:53 +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);
|
switchToVisualisationModeIfNeeded(e);
|
||||||
fresh_focus_in_ = false;
|
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);
|
QGraphicsView::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,10 +427,26 @@ void DiagramView::mousePressEvent(QMouseEvent *e) {
|
|||||||
@param e QWheelEvent
|
@param e QWheelEvent
|
||||||
*/
|
*/
|
||||||
void DiagramView::wheelEvent(QWheelEvent *e) {
|
void DiagramView::wheelEvent(QWheelEvent *e) {
|
||||||
if (e -> delta() > 0) {
|
//Zoom and scrolling
|
||||||
zoomIn();
|
if (e->buttons() != Qt::MidButton) {
|
||||||
} else {
|
if (!(e -> modifiers() & Qt::ControlModifier)) {
|
||||||
zoomOut();
|
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