From f252e1e6ae93e6e618b9ef8d70ff969d9327e75b Mon Sep 17 00:00:00 2001 From: Logan McNaughton <848146+loganmc10@users.noreply.github.com> Date: Mon, 18 Jul 2022 22:13:25 -0600 Subject: [PATCH] update gui --- mupen64plus-gui/mainwindow.cpp | 2 +- mupen64plus-gui/mainwindow.h | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) 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;