[qet] [2112] Prepare on the wheelEvent Onclick select visu mode and drag schema. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 2112
Author: cfdev
Date: 2013-04-15 15:17:06 +0200 (Mon, 15 Apr 2013)
Log Message:
-----------
Prepare on the wheelEvent Onclick select visu mode and drag schema.
Modified Paths:
--------------
trunk/sources/diagramview.cpp
trunk/sources/diagramview.h
Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp 2013-04-15 12:07:59 UTC (rev 2111)
+++ trunk/sources/diagramview.cpp 2013-04-15 13:17:06 UTC (rev 2112)
@@ -414,6 +414,7 @@
* 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;
@@ -424,10 +425,32 @@
is_adding_text = false;
}
}
+ // Select visualisation
+ if (FlagMouseButtons_ == 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_) {
+ setSelectionMode();
+ is_moving_view_ = false;
+ }
+ }
+ QGraphicsView::mouseReleaseEvent(e);
+}
+
+/**
Manage wheel event of mouse
@param e QWheelEvent
*/
Modified: trunk/sources/diagramview.h
===================================================================
--- trunk/sources/diagramview.h 2013-04-15 12:07:59 UTC (rev 2111)
+++ trunk/sources/diagramview.h 2013-04-15 13:17:06 UTC (rev 2112)
@@ -52,6 +52,7 @@
bool fresh_focus_in_; ///< Indicate the focus was freshly gained
ElementsLocation next_location_;
QPoint next_position_;
+ int FlagMouseButtons_;
// methods
public:
@@ -86,6 +87,7 @@
private:
void mousePressEvent(QMouseEvent *);
+ void mouseReleaseEvent(QMouseEvent *e);
void dragEnterEvent(QDragEnterEvent *);
void dragLeaveEvent(QDragLeaveEvent *);
void dragMoveEvent(QDragMoveEvent *);