diff --git a/mupen64plus-gui/mainwindow.cpp b/mupen64plus-gui/mainwindow.cpp index 946e251..07bf717 100644 --- a/mupen64plus-gui/mainwindow.cpp +++ b/mupen64plus-gui/mainwindow.cpp @@ -381,7 +381,7 @@ MainWindow::MainWindow(QWidget *parent) : if (!settings->contains("volume")) settings->setValue("volume", 100); - VolumeAction * volumeAction = new VolumeAction(tr("Volume")); + VolumeAction * volumeAction = new VolumeAction(tr("Volume"), this); connect(volumeAction->slider(), SIGNAL(valueChanged(int)), this, SLOT(volumeValueChanged(int))); volumeAction->slider()->setValue(settings->value("volume").toInt()); ui->menuEmulation->insertAction(ui->actionMute, volumeAction); diff --git a/mupen64plus-gui/mainwindow.h b/mupen64plus-gui/mainwindow.h index 68c7feb..f49f441 100644 --- a/mupen64plus-gui/mainwindow.h +++ b/mupen64plus-gui/mainwindow.h @@ -157,13 +157,13 @@ extern MainWindow *w; class VolumeAction : public QWidgetAction { public: - VolumeAction (const QString& title) : - QWidgetAction (NULL) { - QWidget* pWidget = new QWidget (NULL); - QHBoxLayout* pLayout = new QHBoxLayout(); - QLabel* pLabel = new QLabel (title); + VolumeAction (const QString& title, QObject* parent) : + QWidgetAction (parent) { + QWidget* pWidget = new QWidget; + QHBoxLayout* pLayout = new QHBoxLayout(pWidget); + QLabel* pLabel = new QLabel (title, pWidget); pLayout->addWidget (pLabel); - pSlider = new QSlider(Qt::Horizontal); + pSlider = new QSlider(Qt::Horizontal, pWidget); pSlider->setMinimum(0); pSlider->setMaximum(100); pLayout->addWidget (pSlider); @@ -171,6 +171,10 @@ public: setDefaultWidget(pWidget); } + void releaseWidget(QWidget* widget) + { + widget->deleteLater(); + } QSlider * slider () { return pSlider;