]> sigrok.org Git - pulseview.git/blobdiff - pv/mainwindow.cpp
Bring the cursors into view when they are shown
[pulseview.git] / pv / mainwindow.cpp
index e2f29e34d133afed3cf765d6d8dd58cfdc6e67a5..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>
 
@@ -118,6 +120,7 @@ void MainWindow::setup_ui()
                "MainWindow", "&Quit", 0, QApplication::UnicodeUTF8));
        _action_quit->setIcon(QIcon::fromTheme("application-exit",
                QIcon(":/icons/application-exit.png")));
+       _action_quit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
        _action_quit->setObjectName(QString::fromUtf8("actionQuit"));
        _menu_file->addAction(_action_quit);
 
@@ -284,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()