]> sigrok.org Git - pulseview.git/blobdiff - pv/mainwindow.cpp
Fix #1440 by moving shortcuts from the main window to the view
[pulseview.git] / pv / mainwindow.cpp
index 0b68b1d7a9a9b2530bd58872b119f3ad5ae65fe2..f0a4c0714f12075a9d5ff2e6ca317d8392859595 100644 (file)
@@ -499,6 +499,7 @@ void MainWindow::setup_ui()
        icon.addFile(QString(":/icons/pulseview.png"));
        setWindowIcon(icon);
 
+       // Set up keyboard shortcuts that affect all views at once
        view_sticky_scrolling_shortcut_ = new QShortcut(QKeySequence(Qt::Key_S), this, SLOT(on_view_sticky_scrolling_shortcut()));
        view_sticky_scrolling_shortcut_->setAutoRepeat(false);
 
@@ -511,22 +512,6 @@ void MainWindow::setup_ui()
        view_colored_bg_shortcut_ = new QShortcut(QKeySequence(Qt::Key_B), this, SLOT(on_view_colored_bg_shortcut()));
        view_colored_bg_shortcut_->setAutoRepeat(false);
 
-       zoom_in_shortcut_ = new QShortcut(QKeySequence(Qt::Key_Plus), this, SLOT(on_zoom_in_shortcut_triggered()));
-       zoom_in_shortcut_->setAutoRepeat(false);
-
-       zoom_in_shortcut_2_ = new QShortcut(QKeySequence(Qt::Key_Up), this, SLOT(on_zoom_in_shortcut_triggered()));
-
-       zoom_out_shortcut_ = new QShortcut(QKeySequence(Qt::Key_Minus), this, SLOT(on_zoom_out_shortcut_triggered()));
-       zoom_out_shortcut_->setAutoRepeat(false);
-
-       zoom_out_shortcut_2_ = new QShortcut(QKeySequence(Qt::Key_Down), this, SLOT(on_zoom_out_shortcut_triggered()));
-
-       home_shortcut_ = new QShortcut(QKeySequence(Qt::Key_Home), this, SLOT(on_scroll_to_start_triggered()));
-       home_shortcut_->setAutoRepeat(false);
-
-       end_shortcut_ = new QShortcut(QKeySequence(Qt::Key_End), this, SLOT(on_scroll_to_end_triggered()));
-       end_shortcut_->setAutoRepeat(false);
-
        // Set up the tab area
        new_session_button_ = new QToolButton();
        new_session_button_->setIcon(QIcon::fromTheme("document-new",
@@ -981,39 +966,6 @@ void MainWindow::on_settingViewShowAnalogMinorGrid_changed(const QVariant new_va
        }
 }
 
-void MainWindow::on_zoom_out_shortcut_triggered()
-{
-       zoom_current_view(-1);
-}
-
-void MainWindow::on_zoom_in_shortcut_triggered()
-{
-       zoom_current_view(1);
-}
-
-void MainWindow::on_scroll_to_start_triggered()
-{
-       scroll_to_start_or_end(true);
-}
-
-void MainWindow::on_scroll_to_end_triggered()
-{
-       scroll_to_start_or_end(false);
-}
-
-void MainWindow::scroll_to_start_or_end(bool start)
-{
-       shared_ptr<Session> session = get_tab_session(session_selector_.currentIndex());
-
-       if (!session)
-               return;
-
-       shared_ptr<views::ViewBase> v = session.get()->main_view();
-       views::trace::View *tv =
-               qobject_cast<views::trace::View*>(v.get());
-       tv->set_h_offset(start ? 0 : tv->get_h_scrollbar_maximum());
-}
-
 void MainWindow::on_close_current_tab()
 {
        int tab = session_selector_.currentIndex();