diff --git a/trayicon.cpp b/trayicon.cpp index 9b16fa6..2cccd59 100644 --- a/trayicon.cpp +++ b/trayicon.cpp @@ -14,7 +14,7 @@ TrayIcon::TrayIcon(QObject *parent) : this->menu = new QMenu(); // can only be explicitly owned by a QWidget, not any QObject, so we need to // manually manage its lifecycle in the d'tor - this->quitAction = new QAction("Quit"); + this->quitAction = new QAction("Quit"); // Don't have these owned by this->menu, otherwise we can't delete + readd them in refresh this->quitAction->setIcon(QIcon::fromTheme("application-exit")); connect(this->quitAction, &QAction::triggered, this, &TrayIcon::on_quitAction_triggered); @@ -98,8 +98,8 @@ void TrayIcon::onGotPulseCardInfo(const pa_card_info& cardInfo, int eol) name = tr("Default card"); } - QMenu* cardMenu = new QMenu(name); cardMenu->setIcon(QIcon::fromTheme("audio-card")); + QMenu* cardMenu = new QMenu(name, this->menu); // recursive ownership for (size_t i = 0; i < cardInfo.n_profiles; ++i) { auto profileAction = new QAction(cardInfo.profiles[i].description, cardMenu); cardMenu->addAction(profileAction);