]> sigrok.org Git - pulseview.git/blobdiff - pv/mainwindow.cpp
Bring the cursors into view when they are shown
[pulseview.git] / pv / mainwindow.cpp
index 3aeb1227edcc1fb00247767002ee3087bb78494a..3326b9b1af47967d0de0603a4bef3cdb4d4684f1 100644 (file)
@@ -18,7 +18,9 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+#ifdef ENABLE_SIGROKDECODE
 #include <sigrokdecode.h>
+#endif
 
 #include <boost/bind.hpp>
 
@@ -285,7 +287,12 @@ void MainWindow::on_actionViewZoomOut_triggered()
 void MainWindow::on_actionViewShowCursors_triggered()
 {
        assert(_view);
-       _view->show_cursors(_action_view_show_cursors->isChecked());
+
+       const bool show = !_view->cursors_shown();
+       if(show)
+               _view->centre_cursors();
+
+       _view->show_cursors(show);
 }
 
 void MainWindow::on_actionAbout_triggered()