Fixes #6753: Lv2 help window issues (#6957)

This fixes at least three issues:

* Help window is not synched with window manager's `X`-button
* Help window is not being closed on track destruction or on closing the plugin window
* Trims help window strings and force-adds a newline, because `QLabel::sizeHint` sometimes computes too small values. Now, together with #6956, all help windows fit their strings. Some help windows are too large by one line, but this seems better than forcing the user to resize them if they are too small by one line.
This commit is contained in:
Johannes Lorenz
2023-11-12 02:25:26 +01:00
committed by GitHub
parent 652b1fa57a
commit ecc5ff8ca7
6 changed files with 80 additions and 4 deletions

View File

@@ -37,7 +37,7 @@
class QPushButton;
class QMdiSubWindow;
class QLabel;
namespace lmms
{
@@ -64,9 +64,25 @@ private:
};
class HelpWindowEventFilter : public QObject
{
Q_OBJECT
class Lv2ViewBase* const m_viewBase;
protected:
bool eventFilter(QObject* obj, QEvent* event) override;
public:
HelpWindowEventFilter(class Lv2ViewBase* viewBase);
};
//! Base class for view for one Lv2 plugin
class LMMS_EXPORT Lv2ViewBase : public LinkedModelGroupsView
{
friend class HelpWindowEventFilter;
protected:
//! @param pluginWidget A child class which inherits QWidget
Lv2ViewBase(class QWidget *pluginWidget, Lv2ControlBase *ctrlBase);
@@ -79,6 +95,7 @@ protected:
void toggleUI();
void toggleHelp(bool visible);
void closeHelpWindow();
// to be called by child virtuals
//! Reconnect models if model changed
@@ -94,12 +111,14 @@ private:
static AutoLilvNode uri(const char *uriStr);
LinkedModelGroupView* getGroupView() override { return m_procView; }
void onHelpWindowClosed();
Lv2ViewProc* m_procView;
//! Numbers of controls per row; must be multiple of 2 for mono effects
const int m_colNum = 6;
QMdiSubWindow* m_helpWindow = nullptr;
HelpWindowEventFilter m_helpWindowEventFilter;
};