UI: Close context menu on destroy of VolControl
This commit is contained in:
parent
77e4416c9f
commit
bacf83dbc9
@ -125,7 +125,8 @@ VolControl::VolControl(OBSSource source_, bool showConfig, bool vertical)
|
||||
levelCount(0.0f),
|
||||
obs_fader(obs_fader_create(OBS_FADER_LOG)),
|
||||
obs_volmeter(obs_volmeter_create(OBS_FADER_LOG)),
|
||||
vertical(vertical)
|
||||
vertical(vertical),
|
||||
contextMenu(nullptr)
|
||||
{
|
||||
nameLabel = new QLabel();
|
||||
volLabel = new QLabel();
|
||||
@ -291,6 +292,8 @@ VolControl::~VolControl()
|
||||
|
||||
obs_fader_destroy(obs_fader);
|
||||
obs_volmeter_destroy(obs_volmeter);
|
||||
if (contextMenu)
|
||||
contextMenu->close();
|
||||
}
|
||||
|
||||
QColor VolumeMeter::getBackgroundNominalColor() const
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <QTimer>
|
||||
#include <QMutex>
|
||||
#include <QList>
|
||||
#include <QMenu>
|
||||
|
||||
class QPushButton;
|
||||
class VolumeMeterTimer;
|
||||
@ -219,6 +220,7 @@ private:
|
||||
obs_fader_t *obs_fader;
|
||||
obs_volmeter_t *obs_volmeter;
|
||||
bool vertical;
|
||||
QMenu *contextMenu;
|
||||
|
||||
static void OBSVolumeChanged(void *param, float db);
|
||||
static void OBSVolumeLevel(void *data,
|
||||
@ -254,4 +256,5 @@ public:
|
||||
void setPeakMeterType(enum obs_peak_meter_type peakMeterType);
|
||||
|
||||
void EnableSlider(bool enable);
|
||||
inline void SetContextMenu(QMenu *cm) { contextMenu = cm; }
|
||||
};
|
||||
|
@ -3301,6 +3301,7 @@ void OBSBasic::VolControlContextMenu()
|
||||
pasteFiltersAction.setEnabled(true);
|
||||
|
||||
QMenu popup;
|
||||
vol->SetContextMenu(&popup);
|
||||
popup.addAction(&lockAction);
|
||||
popup.addSeparator();
|
||||
popup.addAction(&unhideAllAction);
|
||||
@ -3316,6 +3317,7 @@ void OBSBasic::VolControlContextMenu()
|
||||
popup.addAction(&propertiesAction);
|
||||
popup.addAction(&advPropAction);
|
||||
popup.exec(QCursor::pos());
|
||||
vol->SetContextMenu(nullptr);
|
||||
}
|
||||
|
||||
void OBSBasic::on_hMixerScrollArea_customContextMenuRequested()
|
||||
|
Loading…
x
Reference in New Issue
Block a user