]> sigrok.org Git - pulseview.git/commitdiff
Disable context menus that could lead to users removing UI parts
authorSoeren Apel <redacted>
Thu, 25 May 2017 12:30:46 +0000 (14:30 +0200)
committerSoeren Apel <redacted>
Fri, 26 May 2017 17:36:04 +0000 (19:36 +0200)
If a user removes the main toolbar then there's no way to get it
back. We don't want that.

If a user removes a dock window's contents he can get it back
by using the same context menu but it's a useless feature for us
and potentially very confusing, so we disable this, too.

pv/mainwindow.cpp
pv/toolbars/mainbar.cpp

index 205c95ca95a765670d5386e16345ef176dcdf804..86a015533f824cb8483e7ef7b456d080266d9ebc 100644 (file)
@@ -188,6 +188,7 @@ shared_ptr<views::ViewBase> MainWindow::add_view(const QString &title,
        dock_main->setCentralWidget(v.get());
        dock->setWidget(dock_main);
 
        dock_main->setCentralWidget(v.get());
        dock->setWidget(dock_main);
 
+       dock->setContextMenuPolicy(Qt::PreventContextMenu);
        dock->setFeatures(QDockWidget::DockWidgetMovable |
                QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetClosable);
 
        dock->setFeatures(QDockWidget::DockWidgetMovable |
                QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetClosable);
 
index 0f92f060cb96135b5905dc529f5d1e43b05a77f3..4f5cd158ed0922c2842a5349697ab25c0cec6030 100644 (file)
@@ -114,6 +114,8 @@ MainBar::MainBar(Session &session, QWidget *parent,
 {
        setObjectName(QString::fromUtf8("MainBar"));
 
 {
        setObjectName(QString::fromUtf8("MainBar"));
 
+       setContextMenuPolicy(Qt::PreventContextMenu);
+
        // Actions
        action_new_view_->setText(tr("New &View"));
        action_new_view_->setIcon(QIcon::fromTheme("window-new",
        // Actions
        action_new_view_->setText(tr("New &View"));
        action_new_view_->setIcon(QIcon::fromTheme("window-new",