diff --git a/forms/mainwindow.ui b/forms/mainwindow.ui index 91eed28d974a035e11586ac5f270b18f7cf861d9..a51e0c16e76f1518b8d6c35311727794e8c28c61 100644 --- a/forms/mainwindow.ui +++ b/forms/mainwindow.ui @@ -71,6 +71,7 @@ <addaction name="actionObjectsnap"/> <addaction name="separator"/> <addaction name="actionBack_to_Origin"/> + <addaction name="actionZoom_Windows"/> </widget> <widget class="QMenu" name="menuEdit"> <property name="title"> @@ -721,6 +722,14 @@ <string>Meta+O</string> </property> </action> + <action name="actionZoom_Windows"> + <property name="text"> + <string>Zoom Windows</string> + </property> + <property name="shortcut"> + <string>Meta+W</string> + </property> + </action> </widget> <resources> <include location="../Resources/resources.qrc"/> diff --git a/src/GraphicView.cpp b/src/GraphicView.cpp index 86985c6103cf20efed6127b5ff2b416e32fb5c29..facce6139517e2625291fb0d7f03c8763810c6b7 100644 --- a/src/GraphicView.cpp +++ b/src/GraphicView.cpp @@ -67,6 +67,7 @@ jpsGraphicsView::jpsGraphicsView(QWidget* parent, jpsDatamanager *datamanager):Q statDoor=false; statExit=false; _statHLine=false; + statzoomwindows=false; _statCopy=0; statLandmark=false; markedLandmark=nullptr; @@ -520,6 +521,19 @@ void jpsGraphicsView::mouseReleaseEvent(QMouseEvent *event) emit RegionDefCompleted(); _regionDef=false; } + else if(statzoomwindows) + { + this->fitInView(currentSelectRect->rect(),Qt::KeepAspectRatio); + gl_scale_f=1/this->transform().m11(); + + //translations + QPointF old_pos; + old_pos.setX(pos.x()+translation_x); + old_pos.setY(pos.y()+translation_y); + translations(old_pos); + + statzoomwindows=false; + } else { // Select lines by creating a rect with the cursor @@ -1994,3 +2008,8 @@ void jpsGraphicsView::ScaleLines(const double &factor) } } + +void jpsGraphicsView::selectedWindows() +{ + statzoomwindows=true; +} diff --git a/src/GraphicView.h b/src/GraphicView.h index 71217a804d8ca6a8a278be638f7557afe3701300..40419acaf7853e1439921b0de330c85badce587d 100644 --- a/src/GraphicView.h +++ b/src/GraphicView.h @@ -96,6 +96,7 @@ public: void AutoZoom(); qreal CalcGridSize(); void ShowOrigin(); + void selectedWindows(); //Catch lines, points and intersections @@ -243,6 +244,8 @@ private: ActionStack _undoStack; ActionStack _redoStack; + //View + bool statzoomwindows; signals: void mouse_moved(); diff --git a/src/mainWindow.cpp b/src/mainWindow.cpp index fe87b011fc99064c8018600ebbc81b9d2458d437..3a76dd9e5a71514f398eaf4844b2552e2c74cb4f 100644 --- a/src/mainWindow.cpp +++ b/src/mainWindow.cpp @@ -145,7 +145,6 @@ MWindow :: MWindow() { connect(actionDoor,SIGNAL(triggered(bool)),this,SLOT(dis_selectMode())); connect(actionExit,SIGNAL(triggered(bool)),this,SLOT(dis_selectMode())); connect(actionScale,SIGNAL(triggered(bool)),this,SLOT(enableScale())); - // Tab View connect(actionRotate_90_deg_clockwise,SIGNAL(triggered(bool)),this,SLOT(rotate())); connect(actionShow_Point_of_Origin,SIGNAL(triggered(bool)),this,SLOT(ShowOrigin())); @@ -837,5 +836,11 @@ void MWindow::on_actionNew_Inifile_triggered() void MWindow::on_actionBack_to_Origin_triggered() { - mview->centerOn(0,0); + mview->centerOn(QPoint(0,0)); //TODO: Ensure in any situation +} + +void MWindow::on_actionZoom_Windows_triggered() +{ + en_selectMode(); + mview->selectedWindows(); } diff --git a/src/mainWindow.h b/src/mainWindow.h index a9272a834513cfe85093140d57dbbb4bc1607712..0e042082469515c41dbcfdfc8f35231e030bf281 100644 --- a/src/mainWindow.h +++ b/src/mainWindow.h @@ -168,6 +168,7 @@ private slots: QMap<QString, QString> loadSettings(); void on_actionNew_Inifile_triggered(); void on_actionBack_to_Origin_triggered(); + void on_actionZoom_Windows_triggered(); }; #endif // MAINWINDOW_H