From a7ac1750ae87aab585b2d209291f34ff9ffe7bd0 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 21 May 2021 10:07:54 +1000 Subject: [PATCH] nodeparamview: disable default QMainWindow popup menu Fixes #1638 --- app/widget/nodeparamview/CMakeLists.txt | 2 + app/widget/nodeparamview/nodeparamview.cpp | 2 +- app/widget/nodeparamview/nodeparamview.h | 4 +- .../nodeparamview/nodeparamviewdockarea.cpp | 35 ++++++++++++++++ .../nodeparamview/nodeparamviewdockarea.h | 40 +++++++++++++++++++ 5 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 app/widget/nodeparamview/nodeparamviewdockarea.cpp create mode 100644 app/widget/nodeparamview/nodeparamviewdockarea.h diff --git a/app/widget/nodeparamview/CMakeLists.txt b/app/widget/nodeparamview/CMakeLists.txt index bad542897..0a7a164a4 100644 --- a/app/widget/nodeparamview/CMakeLists.txt +++ b/app/widget/nodeparamview/CMakeLists.txt @@ -22,6 +22,8 @@ set(OLIVE_SOURCES widget/nodeparamview/nodeparamviewarraywidget.cpp widget/nodeparamview/nodeparamviewconnectedlabel.h widget/nodeparamview/nodeparamviewconnectedlabel.cpp + widget/nodeparamview/nodeparamviewdockarea.h + widget/nodeparamview/nodeparamviewdockarea.cpp widget/nodeparamview/nodeparamviewitem.h widget/nodeparamview/nodeparamviewitem.cpp widget/nodeparamview/nodeparamviewkeyframecontrol.h diff --git a/app/widget/nodeparamview/nodeparamview.cpp b/app/widget/nodeparamview/nodeparamview.cpp index 5bea49c09..605964f84 100644 --- a/app/widget/nodeparamview/nodeparamview.cpp +++ b/app/widget/nodeparamview/nodeparamview.cpp @@ -55,7 +55,7 @@ NodeParamView::NodeParamView(QWidget *parent) : connect(param_widget_container_, &NodeParamViewParamContainer::Resized, this, &NodeParamView::UpdateGlobalScrollBar); scroll_area->setWidget(param_widget_container_); - param_widget_area_ = new QMainWindow(); + param_widget_area_ = new NodeParamViewDockArea(); // Disable dock widgets from tabbing and disable glitchy animations param_widget_area_->setDockOptions(static_cast(0)); diff --git a/app/widget/nodeparamview/nodeparamview.h b/app/widget/nodeparamview/nodeparamview.h index a5a19b0da..3e8f7edc4 100644 --- a/app/widget/nodeparamview/nodeparamview.h +++ b/app/widget/nodeparamview/nodeparamview.h @@ -21,11 +21,11 @@ #ifndef NODEPARAMVIEW_H #define NODEPARAMVIEW_H -#include #include #include #include "node/node.h" +#include "nodeparamviewdockarea.h" #include "nodeparamviewitem.h" #include "widget/keyframeview/keyframeview.h" #include "widget/timebased/timebasedwidget.h" @@ -121,7 +121,7 @@ private: // This may look weird, but QMainWindow is just a QWidget with a fancy layout that allows // docking windows - QMainWindow* param_widget_area_; + NodeParamViewDockArea* param_widget_area_; QVector pinned_nodes_; diff --git a/app/widget/nodeparamview/nodeparamviewdockarea.cpp b/app/widget/nodeparamview/nodeparamviewdockarea.cpp new file mode 100644 index 000000000..a875bbf24 --- /dev/null +++ b/app/widget/nodeparamview/nodeparamviewdockarea.cpp @@ -0,0 +1,35 @@ +/*** + + Olive - Non-Linear Video Editor + Copyright (C) 2021 Olive Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +***/ + +#include "nodeparamviewdockarea.h" + +namespace olive { + +NodeParamViewDockArea::NodeParamViewDockArea(QWidget *parent) : + QMainWindow(parent) +{ +} + +QMenu *NodeParamViewDockArea::createPopupMenu() +{ + return nullptr; +} + +} diff --git a/app/widget/nodeparamview/nodeparamviewdockarea.h b/app/widget/nodeparamview/nodeparamviewdockarea.h new file mode 100644 index 000000000..90a00c1a0 --- /dev/null +++ b/app/widget/nodeparamview/nodeparamviewdockarea.h @@ -0,0 +1,40 @@ +/*** + + Olive - Non-Linear Video Editor + Copyright (C) 2021 Olive Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +***/ + +#ifndef NODEPARAMVIEWDOCKAREA_H +#define NODEPARAMVIEWDOCKAREA_H + +#include + +namespace olive { + +class NodeParamViewDockArea : public QMainWindow +{ + Q_OBJECT +public: + explicit NodeParamViewDockArea(QWidget *parent = nullptr); + + virtual QMenu *createPopupMenu() override; + +}; + +} + +#endif // NODEPARAMVIEWDOCKAREA_H