From 97b61bbd9a4c118e65e808ba8793035a3c4cc359 Mon Sep 17 00:00:00 2001 From: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com> Date: Sat, 12 Oct 2024 10:39:42 +0200 Subject: [PATCH] Make `PluginView::isResizable` a virtual (#7541) Remove the member `PluginView::m_isResizable` and it's associated method `setResizable`. Turn `isResizable` into a virtual method. The reasoning is that whether or not an effect can be resized depends on its implementation. Therefore does not make sense to have a method like `setResizable`. If the underlying implementation does not support resizing then it would not make sense to call `setResizable(true)`. So `isResizable` now describes the underlying ability of a plugin to resize. It's then up to the clients of that method to decide how to treat the result of `isResizable`, i.e. if they want to make use of the ability to resize or not. --- include/PluginView.h | 6 +----- plugins/SlicerT/SlicerTView.cpp | 1 - plugins/SlicerT/SlicerTView.h | 2 ++ 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/include/PluginView.h b/include/PluginView.h index a85b0b9e185..dce4d6bfb0a 100644 --- a/include/PluginView.h +++ b/include/PluginView.h @@ -41,11 +41,7 @@ class LMMS_EXPORT PluginView : public QWidget, public ModelView { } - void setResizable(bool resizable) { m_isResizable = resizable; } - bool isResizable() { return m_isResizable; } - -private: - bool m_isResizable = false; + virtual bool isResizable() const { return false; } }; } // namespace lmms::gui diff --git a/plugins/SlicerT/SlicerTView.cpp b/plugins/SlicerT/SlicerTView.cpp index 4be774f6d2a..7af2db1430e 100644 --- a/plugins/SlicerT/SlicerTView.cpp +++ b/plugins/SlicerT/SlicerTView.cpp @@ -55,7 +55,6 @@ SlicerTView::SlicerTView(SlicerT* instrument, QWidget* parent) setMaximumSize(QSize(10000, 10000)); setMinimumSize(QSize(516, 400)); - setResizable(true); m_wf = new SlicerTWaveform(248, 128, instrument, this); m_wf->move(0, s_topBarHeight); diff --git a/plugins/SlicerT/SlicerTView.h b/plugins/SlicerT/SlicerTView.h index 232c2745425..f24246621fa 100644 --- a/plugins/SlicerT/SlicerTView.h +++ b/plugins/SlicerT/SlicerTView.h @@ -78,6 +78,8 @@ public slots: void resizeEvent(QResizeEvent* event) override; private: + bool isResizable() const override { return true; } + SlicerT* m_slicerTParent; Knob* m_noteThresholdKnob;