X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=d04759cfe380d0920c2408ba10aaeaea065b0eb5;hp=fb749f5701724e37be0fffae8d55c3edd3d22a7e;hb=b6262d704b8f34f5de6ffa9a54d2adf3ebf02556;hpb=7a5535dc88a1125989d5fbcf36c2affe21a0351e diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index fb749f57..d04759cf 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -511,6 +511,12 @@ 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_out_shortcut_ = new QShortcut(QKeySequence(Qt::Key_Minus), this, SLOT(on_zoom_out_shortcut_triggered())); + zoom_out_shortcut_->setAutoRepeat(false); + // Set up the tab area new_session_button_ = new QToolButton(); new_session_button_->setIcon(QIcon::fromTheme("document-new", @@ -601,6 +607,19 @@ void MainWindow::restore_ui_settings() settings.endGroup(); } +void MainWindow::zoom_current_view(double steps) +{ + shared_ptr session = get_tab_session(session_selector_.currentIndex()); + + if (!session) + return; + + shared_ptr v = session.get()->main_view(); + views::trace::View *tv = + qobject_cast(v.get()); + tv->zoom(steps); +} + shared_ptr MainWindow::get_tab_session(int index) const { // Find the session that belongs to the tab's main window @@ -949,6 +968,16 @@ 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_close_current_tab() { int tab = session_selector_.currentIndex();