void SysTray::slot_systray_clicked(QSystemTrayIcon::ActivationReason reason) { if (reason == QSystemTrayIcon::Trigger) { QMainWindow* w = qobject_cast<QMainWindow*>(this->parent()); bool is_visible = !w->isVisible(); w->setVisible(is_visible); if (is_visible) { w->activateWindow(); w->showNormal(); } } }
void UnreadQueueManager::ShowNext () { QObject *entryObj = 0; while (!Queue_.isEmpty () && !entryObj) entryObj = Queue_.takeFirst (); if (!entryObj) return; ICLEntry *entry = qobject_cast<ICLEntry*> (entryObj); Core::Instance ().GetChatTabsManager ()->OpenChat (entry); QMainWindow *mw = Core::Instance ().GetProxy ()->GetMainWindow (); mw->show (); mw->activateWindow (); mw->raise (); }
void QmitkCommonExtPlugin::handleIPCMessage(const QByteArray& msg) { QDataStream ds(msg); QString msgType; ds >> msgType; // we only handle messages containing command line arguments if (msgType != "$cmdLineArgs") return; // activate the current workbench window berry::IWorkbenchWindow::Pointer window = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow(); QMainWindow* mainWindow = static_cast<QMainWindow*> (window->GetShell()->GetControl()); mainWindow->setWindowState(mainWindow->windowState() & ~Qt::WindowMinimized); mainWindow->raise(); mainWindow->activateWindow(); // Get the preferences for the instantiation behavior berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService(); berry::IPreferences::Pointer prefs = prefService->GetSystemPreferences()->Node("/General"); bool newInstanceAlways = prefs->GetBool("newInstance.always", false); bool newInstanceScene = prefs->GetBool("newInstance.scene", true); QStringList args; ds >> args; QStringList fileArgs; QStringList sceneArgs; Poco::Util::OptionSet os; berry::Platform::GetOptionSet(os); Poco::Util::OptionProcessor processor(os); #if !defined(POCO_OS_FAMILY_UNIX) processor.setUnixStyle(false); #endif args.pop_front(); QStringList::Iterator it = args.begin(); while (it != args.end()) { std::string name; std::string value; if (processor.process(it->toStdString(), name, value)) { ++it; } else { if (it->endsWith(".mitk")) { sceneArgs << *it; } else { fileArgs << *it; } it = args.erase(it); } } if (newInstanceAlways) { if (newInstanceScene) { startNewInstance(args, fileArgs); foreach(QString sceneFile, sceneArgs) { startNewInstance(args, QStringList(sceneFile)); } } else {