mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Revert commit 2106 is too buggy.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2107 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -410,12 +410,10 @@ void DiagramView::pasteHere() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Manage the press events click mouse :
|
Manage the events click mouse :
|
||||||
* click to add an independent text field
|
* click to add an independent text field
|
||||||
*/
|
*/
|
||||||
void DiagramView::mousePressEvent(QMouseEvent *e) {
|
void DiagramView::mousePressEvent(QMouseEvent *e) {
|
||||||
// Save the button in flag
|
|
||||||
FlagMouseButtons_ = e->buttons();
|
|
||||||
if (fresh_focus_in_) {
|
if (fresh_focus_in_) {
|
||||||
switchToVisualisationModeIfNeeded(e);
|
switchToVisualisationModeIfNeeded(e);
|
||||||
fresh_focus_in_ = false;
|
fresh_focus_in_ = false;
|
||||||
@@ -426,47 +424,34 @@ void DiagramView::mousePressEvent(QMouseEvent *e) {
|
|||||||
is_adding_text = false;
|
is_adding_text = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Select visualisation
|
|
||||||
if (e->buttons() == Qt::MidButton){
|
|
||||||
if (!is_moving_view_) {
|
|
||||||
setVisualisationMode();
|
|
||||||
is_moving_view_ = true;
|
|
||||||
// And Simulate the left click
|
|
||||||
QGraphicsView::mousePressEvent( new QMouseEvent(QEvent::MouseButtonPress, e->pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QGraphicsView::mousePressEvent(e);
|
QGraphicsView::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Manage the release events click mouse :
|
Manage wheel event of mouse
|
||||||
*/
|
|
||||||
void DiagramView::mouseReleaseEvent(QMouseEvent *e) {
|
|
||||||
// Selection mode
|
|
||||||
if (FlagMouseButtons_ == Qt::MidButton){
|
|
||||||
if (is_moving_view_) {
|
|
||||||
setSelectionMode();
|
|
||||||
is_moving_view_ = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QGraphicsView::mousePressEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Manage wheel event of mouse for Zoom and scrolling
|
|
||||||
@param e QWheelEvent
|
@param e QWheelEvent
|
||||||
*/
|
*/
|
||||||
void DiagramView::wheelEvent(QWheelEvent *e) {
|
void DiagramView::wheelEvent(QWheelEvent *e) {
|
||||||
if (!(e -> modifiers() & Qt::ControlModifier)) {
|
//Zoom and scrolling
|
||||||
if (e -> delta() > 0) {
|
if (e->buttons() != Qt::MidButton) {
|
||||||
zoomIn();
|
if (!(e -> modifiers() & Qt::ControlModifier)) {
|
||||||
|
if (e -> delta() > 0) zoomIn();
|
||||||
|
else zoomOut();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
zoomOut();
|
QAbstractScrollArea::wheelEvent(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
// Or select visualisation or selection mode
|
||||||
QAbstractScrollArea::wheelEvent(e);
|
else{
|
||||||
|
if (!is_moving_view_) {
|
||||||
|
setVisualisationMode();
|
||||||
|
is_moving_view_ = true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
setSelectionMode();
|
||||||
|
is_moving_view_ = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ class DiagramView : public QGraphicsView {
|
|||||||
bool fresh_focus_in_; ///< Indicate the focus was freshly gained
|
bool fresh_focus_in_; ///< Indicate the focus was freshly gained
|
||||||
ElementsLocation next_location_;
|
ElementsLocation next_location_;
|
||||||
QPoint next_position_;
|
QPoint next_position_;
|
||||||
int FlagMouseButtons_; ///< save the buttons of mouse
|
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
public:
|
public:
|
||||||
@@ -87,7 +86,6 @@ class DiagramView : public QGraphicsView {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void mousePressEvent(QMouseEvent *);
|
void mousePressEvent(QMouseEvent *);
|
||||||
void mouseReleaseEvent(QMouseEvent *);
|
|
||||||
void dragEnterEvent(QDragEnterEvent *);
|
void dragEnterEvent(QDragEnterEvent *);
|
||||||
void dragLeaveEvent(QDragLeaveEvent *);
|
void dragLeaveEvent(QDragLeaveEvent *);
|
||||||
void dragMoveEvent(QDragMoveEvent *);
|
void dragMoveEvent(QDragMoveEvent *);
|
||||||
|
|||||||
Reference in New Issue
Block a user