SpectralLibraryMatchResults::~SpectralLibraryMatchResults() { Service<DesktopServices> pDesktop; // remove toolbar button and menu item QAction* pAction = getAction(); if (pAction != NULL) { ToolBar* pToolBar = static_cast<ToolBar*>(pDesktop->getWindow("Spectral", TOOLBAR)); if (pToolBar != NULL) { pToolBar->removeItem(pAction); MenuBar* pMenuBar = pToolBar->getMenuBar(); if (pMenuBar != NULL) { pMenuBar->removeMenuItem(pAction); } } } // dockwindow should still exist so detach from it DockWindow* pWindow = getDockWindow(); if (pWindow != NULL) { pWindow->detach(SIGNAL_NAME(DockWindow, AboutToShowContextMenu), Slot(this, &SpectralLibraryMatchResults::updateContextMenu)); } }
SpectralLibraryManager::~SpectralLibraryManager() { clearLibrary(); // Remove the toolbar button Service<DesktopServices> pDesktop; ToolBar* pToolBar = static_cast<ToolBar*>(pDesktop->getWindow("Spectral", TOOLBAR)); if (pToolBar != NULL) { if (mpEditSpectralLibraryAction != NULL) { VERIFYNR(disconnect(mpEditSpectralLibraryAction, SIGNAL(triggered()), this, SLOT(editSpectralLibrary()))); pToolBar->removeItem(mpEditSpectralLibraryAction); } } }