[qet] [2113] Change mousePressEvent: the MidButton click set selection or visualisation mode. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 2113
Author: cfdev
Date: 2013-04-15 21:51:39 +0200 (Mon, 15 Apr 2013)
Log Message:
-----------
Change mousePressEvent: the MidButton click set selection or visualisation mode.
Modified Paths:
--------------
trunk/sources/diagramview.cpp
trunk/sources/diagramview.h
Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp 2013-04-15 13:17:06 UTC (rev 2112)
+++ trunk/sources/diagramview.cpp 2013-04-15 19:51:39 UTC (rev 2113)
@@ -414,7 +414,6 @@
* click to add an independent text field
*/
void DiagramView::mousePressEvent(QMouseEvent *e) {
- FlagMouseButtons_ = e -> buttons();
if (fresh_focus_in_) {
switchToVisualisationModeIfNeeded(e);
fresh_focus_in_ = false;
@@ -425,29 +424,18 @@
is_adding_text = false;
}
}
- // Select visualisation
- if (FlagMouseButtons_ == Qt::MidButton){
+ // Select visualisation or selection mode
+ if (e -> buttons() == Qt::MidButton) {
if (!is_moving_view_) {
setVisualisationMode();
is_moving_view_ = true;
- //TODO: Find a way to simulate the left click without generate a bug in the Events
}
- }
- QGraphicsView::mousePressEvent(e);
-}
-
-/**
- Manage the release events click mouse :
-*/
-void DiagramView::mouseReleaseEvent(QMouseEvent *e) {
- // Selection mode
- if (FlagMouseButtons_ == Qt::MidButton){
- if (is_moving_view_) {
+ else{
setSelectionMode();
is_moving_view_ = false;
}
}
- QGraphicsView::mouseReleaseEvent(e);
+ QGraphicsView::mousePressEvent(e);
}
/**
@@ -458,8 +446,12 @@
//Zoom and scrolling
if (e->buttons() != Qt::MidButton) {
if (!(e -> modifiers() & Qt::ControlModifier)) {
- if (e -> delta() > 0) zoomIn();
- else zoomOut();
+ if (e -> delta() > 0){
+ zoomIn();
+ }
+ else{
+ zoomOut();
+ }
}
else {
QAbstractScrollArea::wheelEvent(e);
Modified: trunk/sources/diagramview.h
===================================================================
--- trunk/sources/diagramview.h 2013-04-15 13:17:06 UTC (rev 2112)
+++ trunk/sources/diagramview.h 2013-04-15 19:51:39 UTC (rev 2113)
@@ -52,7 +52,6 @@
bool fresh_focus_in_; ///< Indicate the focus was freshly gained
ElementsLocation next_location_;
QPoint next_position_;
- int FlagMouseButtons_;
// methods
public:
@@ -87,7 +86,6 @@
private:
void mousePressEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *e);
void dragEnterEvent(QDragEnterEvent *);
void dragLeaveEvent(QDragLeaveEvent *);
void dragMoveEvent(QDragMoveEvent *);