void SceneTree::ShowContextMenu(const QPoint &pos) { QModelIndex index = indexAt(pos); DAVA::Entity *clickedEntity = treeModel->GetEntity(index); if(NULL != clickedEntity) { QMenu contextMenu; contextMenu.addAction(QIcon(":/QtIcons/zoom.png"), "Look at", this, SLOT(LookAtSelection())); contextMenu.addSeparator(); contextMenu.addAction(QIcon(":/QtIcons/remove.png"), "Remove", this, SLOT(RemoveSelection())); contextMenu.addSeparator(); QAction *lockAction = contextMenu.addAction(QIcon(":/QtIcons/lock_add.png"), "Lock", this, SLOT(LockEntities())); QAction *unlockAction = contextMenu.addAction(QIcon(":/QtIcons/lock_delete.png"), "Unlock", this, SLOT(UnlockEntities())); if(clickedEntity->GetLocked()) { lockAction->setDisabled(true); } else { unlockAction->setDisabled(true); } contextMenu.exec(mapToGlobal(pos)); } }
void HistoryManager::createContextMenu(const QPoint &pos) { QMenu menu; QAction* actNewTab = menu.addAction(IconProvider::newTabIcon(), tr("Open in new tab")); QAction* actNewWindow = menu.addAction(IconProvider::newWindowIcon(), tr("Open in new window")); QAction* actNewPrivateWindow = menu.addAction(IconProvider::privateBrowsingIcon(), tr("Open in new private window")); menu.addSeparator(); QAction* actCopyUrl = menu.addAction(tr("Copy url"), this, SLOT(copyUrl())); QAction* actCopyTitle = menu.addAction(tr("Copy title"), this, SLOT(copyTitle())); menu.addSeparator(); QAction* actDelete = menu.addAction(QIcon::fromTheme(QSL("edit-delete")), tr("Delete")); connect(actNewTab, SIGNAL(triggered()), this, SLOT(openUrlInNewTab())); connect(actNewWindow, SIGNAL(triggered()), this, SLOT(openUrlInNewWindow())); connect(actNewPrivateWindow, SIGNAL(triggered()), this, SLOT(openUrlInNewPrivateWindow())); connect(actDelete, SIGNAL(triggered()), ui->historyTree, SLOT(removeSelectedItems())); if (ui->historyTree->selectedUrl().isEmpty()) { actNewTab->setDisabled(true); actNewWindow->setDisabled(true); actNewPrivateWindow->setDisabled(true); actCopyTitle->setDisabled(true); actCopyUrl->setDisabled(true); } menu.exec(pos); }
void lemon::disableConfig() { QAction *actPref = actionCollection()->action(KStandardAction::stdName(KStandardAction::Preferences)); actPref->setDisabled(true); QAction *actQuit = actionCollection()->action(KStandardAction::stdName(KStandardAction::Quit)); //FIXME: esto no es muy bueno en produccion.. if (!Settings::allowAnyUserToQuit()) actQuit->setDisabled(true); }
void ProtocolPreferencesMenu::setModule(const char *module_name) { QAction *action; int proto_id = -1; if (module_name) { proto_id = proto_get_id_by_filter_name(module_name); } clear(); module_name_.clear(); module_ = NULL; protocol_ = find_protocol_by_id(proto_id); const QString long_name = proto_get_protocol_long_name(protocol_); const QString short_name = proto_get_protocol_short_name(protocol_); if (!module_name || proto_id < 0 || !protocol_) { action = addAction(tr("No protocol preferences available")); action->setDisabled(true); return; } QAction *disable_action = new QAction(tr("Disable %1" UTF8_HORIZONTAL_ELLIPSIS).arg(short_name), this); connect(disable_action, SIGNAL(triggered(bool)), this, SLOT(disableProtocolTriggered())); module_ = prefs_find_module(module_name); if (!module_ || !prefs_is_registered_protocol(module_name)) { action = addAction(tr("%1 has no preferences").arg(long_name)); action->setDisabled(true); addSeparator(); addAction(disable_action); return; } module_name_ = module_name; action = addAction(tr("Open %1 preferences" UTF8_HORIZONTAL_ELLIPSIS).arg(long_name)); action->setData(QString(module_name)); connect(action, SIGNAL(triggered(bool)), this, SLOT(modulePreferencesTriggered())); addSeparator(); prefs_pref_foreach(module_, add_prefs_menu_item, this); if (!actions().last()->isSeparator()) { addSeparator(); } addAction(disable_action); }
void ImHistoryBrowser::customContextMenuRequested(QPoint /*pos*/) { std::list<uint32_t> msgIds; getSelectedItems(msgIds); QListWidgetItem *currentItem = ui.listWidget->currentItem(); QMenu contextMnu(this); QAction *selectAll = new QAction(tr("Mark all"), &contextMnu); QAction *copyMessage = new QAction(tr("Copy"), &contextMnu); QAction *removeMessages = new QAction(tr("Delete"), &contextMnu); QAction *clearHistory = new QAction(tr("Clear history"), &contextMnu); QAction *sendItem = NULL; if (textEdit) { sendItem = new QAction(tr("Send"), &contextMnu); if (currentItem) { connect(sendItem, SIGNAL(triggered()), this, SLOT(sendMessage())); } else { sendItem->setDisabled(true); } } if (msgIds.size()) { connect(selectAll, SIGNAL(triggered()), ui.listWidget, SLOT(selectAll())); connect(copyMessage, SIGNAL(triggered()), this, SLOT(copyMessage())); connect(removeMessages, SIGNAL(triggered()), this, SLOT(removeMessages())); connect(clearHistory, SIGNAL(triggered()), this, SLOT(clearHistory())); } else { selectAll->setDisabled(true); copyMessage->setDisabled(true); removeMessages->setDisabled(true); clearHistory->setDisabled(true); } contextMnu.addAction(selectAll); contextMnu.addSeparator(); contextMnu.addAction(copyMessage); contextMnu.addAction(removeMessages); contextMnu.addAction(clearHistory); if (sendItem) { contextMnu.addSeparator(); contextMnu.addAction(sendItem); } contextMnu.exec(QCursor::pos()); }
void MimeTextEdit::contextMenuEvent(QContextMenuEvent *e) { emit calculateContextMenuActions(); QMenu *contextMenu = createStandardContextMenu(e->pos()); /* Add actions for pasting links */ contextMenu->addAction( tr("Paste as plain text"), this, SLOT(pastePlainText())); QAction *spoilerAction = contextMenu->addAction(tr("Spoiler"), this, SLOT(spoiler())); spoilerAction->setToolTip(tr("Select text to hide, then push this button")); contextMenu->addSeparator(); QAction *pasteLinkAction = contextMenu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink())); contextMenu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink())); if (RSLinkClipboard::empty()) { pasteLinkAction->setDisabled(true); } QList<QAction*>::iterator it; for (it = mContextMenuActions.begin(); it != mContextMenuActions.end(); ++it) { contextMenu->addAction(*it); } contextMenu->exec(QCursor::pos()); delete(contextMenu); }
void MainTabs::updateTabHeaderMenu() { tabHeaderContextMenu->clear(); QMenu * newTabMenu = guiHelper->getNewTabMenu(); if (newTabMenu != nullptr) { tabHeaderContextMenu->addMenu(newTabMenu); } QList<TabAbstract *> list = guiHelper->getDeletedTabs(); if (list.size() > 0) { if (newTabMenu != nullptr) { tabHeaderContextMenu->addSeparator(); } QAction * action = new(std::nothrow) QAction(tr("Deleted Tabs"), tabHeaderContextMenu); if (action == nullptr) { qFatal("Cannot allocate memory for action for \"deleted tab\" X{"); return; } action->setDisabled(true); tabHeaderContextMenu->addAction(action); for (int i = 0; i < list.size(); i++) { action = new(std::nothrow) QAction(list.at(i)->getName(), tabHeaderContextMenu); if (action == nullptr) { qFatal("Cannot allocate memory for action for deletedTabContextMenu X{"); return; } tabHeaderContextMenu->addAction(action); } } }
void dspGLTransactions::sPopulateMenu(QMenu * menuThis, QTreeWidgetItem* pItem, int) { XTreeWidgetItem * item = (XTreeWidgetItem*)pItem; if(0 == item) return; menuThis->addAction(tr("View..."), this, SLOT(sViewTrans())); if (item->rawValue("journalnumber").toInt() > 0) { QAction* viewSeriesAct = menuThis->addAction(tr("View Journal Series..."), this, SLOT(sViewSeries())); viewSeriesAct->setDisabled(item->data(0, Xt::DeletedRole).toBool()); } if(item->rawValue("gltrans_doctype").toString() == "VO") menuThis->addAction(tr("View Voucher..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "IN") menuThis->addAction(tr("View Invoice..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "PO") menuThis->addAction(tr("View Purchase Order..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "SH") menuThis->addAction(tr("View Shipment..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "CM") menuThis->addAction(tr("View Credit Memo..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "DM") menuThis->addAction(tr("View Debit Memo..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "SO") menuThis->addAction(tr("View Sales Order..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "WO") menuThis->addAction(tr("View WO History..."), this, SLOT(sViewDocument())); else if(item->rawValue("gltrans_doctype").toString() == "JP") menuThis->addAction(tr("View Journal..."), this, SLOT(sViewJournal())); else if(item->rawValue("gltrans_source").toString() == "I/M") menuThis->addAction(tr("View Inventory History..."), this, SLOT(sViewDocument())); }
/** context menu searchTablewidget2 **/ void CreateForumMsg::forumMessageCostumPopupMenu( QPoint /*point*/ ) { QMenu *contextMnu = ui.forumMessage->createStandardContextMenu(); contextMnu->addSeparator(); QAction *pasteLinkAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink())); QAction *pasteLinkFullAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste full RetroShare Link"), this, SLOT(pasteLinkFull())); if (RSLinkClipboard::empty()) { pasteLinkAct->setDisabled (true); pasteLinkFullAct->setDisabled (true); } contextMnu->exec(QCursor::pos()); delete(contextMnu); }
void WikiDialog::groupListCustomPopupMenu(QPoint /*point*/) { int subscribeFlags = ui.groupTreeWidget->subscribeFlags(QString::fromStdString(mGroupId)); QMenu contextMnu(this); std::cerr << "WikiDialog::groupListCustomPopupMenu()"; std::cerr << std::endl; std::cerr << " mGroupId: " << mGroupId; std::cerr << std::endl; std::cerr << " subscribeFlags: " << subscribeFlags; std::cerr << std::endl; std::cerr << " IS_GROUP_SUBSCRIBED(): " << IS_GROUP_SUBSCRIBED(subscribeFlags); std::cerr << std::endl; std::cerr << " IS_GROUP_ADMIN(): " << IS_GROUP_ADMIN(subscribeFlags); std::cerr << std::endl; std::cerr << std::endl; QAction *action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe to Group"), this, SLOT(subscribeToGroup())); action->setDisabled (mGroupId.empty() || IS_GROUP_SUBSCRIBED(subscribeFlags)); action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Group"), this, SLOT(unsubscribeToGroup())); action->setEnabled (!mGroupId.empty() && IS_GROUP_SUBSCRIBED(subscribeFlags)); contextMnu.addSeparator(); action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Wiki Group"), this, SLOT(showGroupDetails())); action->setEnabled (!mGroupId.empty ()); action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Wiki Group"), this, SLOT(editGroupDetails())); action->setEnabled (!mGroupId.empty() && IS_GROUP_ADMIN(subscribeFlags)); /************** NOT ENABLED YET *****************/ //if (!Settings->getForumOpenAllInNewTab()) { // action = contextMnu.addAction(QIcon(""), tr("Open in new tab"), this, SLOT(openInNewTab())); // if (mForumId.empty() || forumThreadWidget(mForumId)) { // action->setEnabled(false); // } //} //QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Forum"), &contextMnu); //connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) ); //shareKeyAct->setEnabled(!mForumId.empty() && IS_GROUP_ADMIN(subscribeFlags)); //contextMnu.addAction( shareKeyAct); //QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Forum" ), &contextMnu); //connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreForumKeys() ) ); //restoreKeysAct->setEnabled(!mForumId.empty() && !IS_GROUP_ADMIN(subscribeFlags)); //contextMnu.addAction( restoreKeysAct); //action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyForumLink())); //action->setEnabled(!mForumId.empty()); //contextMnu.addSeparator(); contextMnu.exec(QCursor::pos()); }
void MainWindow::updateToolsMenu() { if (ui->actionLaunchInstance->menu()) { ui->actionLaunchInstance->menu()->deleteLater(); } QMenu *launchMenu = new QMenu(this); QAction *normalLaunch = launchMenu->addAction(tr("Launch")); connect(normalLaunch, &QAction::triggered, [this](){doLaunch();}); launchMenu->addSeparator()->setText(tr("Profilers")); for (auto profiler : MMC->profilers().values()) { QAction *profilerAction = launchMenu->addAction(profiler->name()); QString error; if (!profiler->check(&error)) { profilerAction->setDisabled(true); profilerAction->setToolTip(tr("Profiler not setup correctly. Go into settings, \"External Tools\".")); } else { connect(profilerAction, &QAction::triggered, [this, profiler](){doLaunch(true, profiler.get());}); } } launchMenu->addSeparator()->setText(tr("Tools")); for (auto tool : MMC->tools().values()) { QAction *toolAction = launchMenu->addAction(tool->name()); QString error; if (!tool->check(&error)) { toolAction->setDisabled(true); toolAction->setToolTip(tr("Tool not setup correctly. Go into settings, \"External Tools\".")); } else { connect(toolAction, &QAction::triggered, [this, tool]() { tool->createDetachedTool(m_selectedInstance, this)->run(); }); } } ui->actionLaunchInstance->setMenu(launchMenu); }
void MuseScore::showWorkspaceMenu() { if (workspaces == 0) { workspaces = new QActionGroup(this); workspaces->setExclusive(true); connect(workspaces, SIGNAL(triggered(QAction*)), SLOT(changeWorkspace(QAction*))); } else { for (QAction* a : workspaces->actions()) workspaces->removeAction(a); } menuWorkspaces->clear(); const QList<Workspace*> pl = Workspace::workspaces(); for (Workspace* p : pl) { QAction* a = workspaces->addAction(qApp->translate("Ms::Workspace", p->name().toUtf8())); a->setCheckable(true); a->setData(p->path()); a->setChecked(p->name() == preferences.getString(PREF_APP_WORKSPACE)); menuWorkspaces->addAction(a); } menuWorkspaces->addSeparator(); QAction* a = new QAction(tr("New..."), this); connect(a, SIGNAL(triggered()), SLOT(createNewWorkspace())); menuWorkspaces->addAction(a); a = new QAction(tr("Edit"), this); a->setDisabled(Workspace::currentWorkspace->readOnly()); connect(a, SIGNAL(triggered()), SLOT(editWorkspace())); menuWorkspaces->addAction(a); a = new QAction(tr("Delete"), this); a->setDisabled(Workspace::currentWorkspace->readOnly()); connect(a, SIGNAL(triggered()), SLOT(deleteWorkspace())); menuWorkspaces->addAction(a); a = new QAction(tr("Undo Changes"), this); a->setDisabled(Workspace::currentWorkspace->readOnly()); connect(a, SIGNAL(triggered()), SLOT(undoWorkspace())); menuWorkspaces->addAction(a); }
void FriendsDialog::contextMenu(QPoint point) { QMenu *contextMnu = ui.lineEdit->createStandardContextMenu(point); contextMnu->addSeparator(); QAction *action = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink())); action->setDisabled(RSLinkClipboard::empty()); contextMnu->exec(QCursor::pos()); delete(contextMnu); }
void BookmarksManager::createContextMenu(const QPoint &pos) { QMenu menu; QAction* actNewTab = menu.addAction(QIcon::fromTheme("tab-new", QIcon(":/icons/menu/tab-new.png")), tr("Open in new tab")); QAction* actNewWindow = menu.addAction(QIcon::fromTheme("window-new"), tr("Open in new window")); QAction* actNewPrivateWindow = menu.addAction(QIcon(":icons/locationbar/privatebrowsing.png"), tr("Open in new private window")); menu.addSeparator(); menu.addAction(tr("New Bookmark"), this, SLOT(addBookmark())); menu.addAction(tr("New Folder"), this, SLOT(addFolder())); menu.addAction(tr("New Separator"), this, SLOT(addSeparator())); menu.addSeparator(); QAction* actDelete = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); connect(actNewTab, SIGNAL(triggered()), this, SLOT(openBookmarkInNewTab())); connect(actNewWindow, SIGNAL(triggered()), this, SLOT(openBookmarkInNewWindow())); connect(actNewPrivateWindow, SIGNAL(triggered()), this, SLOT(openBookmarkInNewPrivateWindow())); connect(actDelete, SIGNAL(triggered()), this, SLOT(deleteBookmarks())); bool canBeDeleted = false; QList<BookmarkItem*> items = ui->tree->selectedBookmarks(); foreach (BookmarkItem* item, items) { if (m_bookmarks->canBeModified(item)) { canBeDeleted = true; break; } } if (!canBeDeleted) { actDelete->setDisabled(true); } if (!m_selectedBookmark || !m_selectedBookmark->isUrl()) { actNewTab->setDisabled(true); actNewWindow->setDisabled(true); actNewPrivateWindow->setDisabled(true); } menu.exec(pos); }
void MainWindow::init_menu() { static QMenu *file = NULL, *help = NULL, *import = NULL, *token = NULL, *languageMenu = NULL, *extra = NULL; static QActionGroup * langGroup = NULL; QAction *a; QList<myLang> languages; if (file) delete file; if (help) delete help; if (import) delete import; if (token) delete token; if (extra) delete extra; if (languageMenu) delete languageMenu; if (historyMenu) delete historyMenu; if (langGroup) delete langGroup; wdMenuList.clear(); scardList.clear(); acList.clear(); langGroup = new QActionGroup(this); historyMenu = new tipMenu(tr("Recent DataBases") + " ...", this); connect(historyMenu, SIGNAL(triggered(QAction*)), this, SLOT(open_database(QAction*))); languages << myLang("System", tr("System"), QLocale::system()) << myLang("Croatian", tr("Croatian"), QLocale("hr")) << myLang("English", tr("English"), QLocale("en")) << myLang("French", tr("French"), QLocale("fr")) << myLang("German", tr("German"), QLocale("de")) << myLang("Russian", tr("Russian"), QLocale("ru")) << myLang("Slovak", tr("Slovak"), QLocale("sk")) << myLang("Spanish", tr("Spanish"), QLocale("es")) << myLang("Turkish", tr("Turkish"), QLocale("tr")); languageMenu = new tipMenu(tr("Language"), this); connect(languageMenu, SIGNAL(triggered(QAction*)), qApp, SLOT(switchLanguage(QAction*))); foreach(myLang l, languages) { QAction *a = new QAction(l.english, langGroup); a->setToolTip(l.native); a->setData(QVariant(l.locale)); a->setDisabled(!XCA_application::languageAvailable(l.locale)); a->setCheckable(true); langGroup->addAction(a); languageMenu->addAction(a); if (l.locale == XCA_application::language()) a->setChecked(true); }
void AMCurrentAmplifierCompositeView::onCustomContextMenuRequested(QPoint position) { if (isValid()) { QMenu menu(this); QAction *basic = menu.addAction("Basic view"); basic->setDisabled(viewMode_ == Basic); QAction *advanced = menu.addAction("Advanced view"); advanced->setDisabled(viewMode_ == Advanced); QAction *selected = menu.exec(mapToGlobal(position)); if (selected) { if (selected->text() == "Basic view") setViewMode(Basic); else if (selected->text() == "Advanced view") setViewMode(Advanced); } } }
void PrefQuantitySpinBox::contextMenuEvent(QContextMenuEvent *event) { Q_D(PrefQuantitySpinBox); QMenu *editMenu = lineEdit()->createStandardContextMenu(); editMenu->setTitle(tr("Edit")); QMenu* menu = new QMenu(QString::fromLatin1("PrefQuantitySpinBox")); menu->addMenu(editMenu); menu->addSeparator(); // datastructure to remember actions for values std::vector<QString> values; std::vector<QAction *> actions; // add the history menu part... QStringList history = getHistory(); for (QStringList::const_iterator it = history.begin();it!= history.end();++it) { actions.push_back(menu->addAction(*it)); values.push_back(*it); } // add the save value portion of the menu menu->addSeparator(); QAction *saveValueAction = menu->addAction(tr("Save value")); QAction *clearListAction = menu->addAction(tr("Clear list")); clearListAction->setDisabled(history.empty()); // call the menu and wait until its back QAction *userAction = menu->exec(event->globalPos()); // look what the user has choosen if (userAction == saveValueAction) { pushToHistory(this->text()); } else if (userAction == clearListAction) { d->handle->Clear(); } else { int i=0; for (std::vector<QAction *>::const_iterator it = actions.begin();it!=actions.end();++it,i++) { if (*it == userAction) { lineEdit()->setText(values[i]); break; } } } delete menu; }
void ChatWidget::contextMenu(QPoint point) { std::cerr << "In context menu" << std::endl; QMenu *contextMnu = ui->chatTextEdit->createStandardContextMenu(point); contextMnu->addSeparator(); QAction *action = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink())); action->setDisabled(RSLinkClipboard::empty()); contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink())); contextMnu->exec(QCursor::pos()); delete(contextMnu); }
/** * Creates a context menu when user right-clicks on a contact. * @brief MainWindow::on_lstContacts_customContextMenuRequested * @param pos Cooridinates of right-click */ void MainWindow::on_lstContacts_customContextMenuRequested(const QPoint &pos) { if(ui->lstContacts->selectedItems().count() < 1) return; contactsMenu = new QMenu("Context menu", this); QAction* add = new QAction(STR_ADD_TO_CONVO, this); if(ui->tabgrpConversations->currentIndex() == 0) add->setDisabled(true); contactsMenu->addAction(add); contactsMenu->addAction(new QAction(STR_REMOVE, this)); contactsMenu->addAction(new QAction(STR_BLOCK_UNBLK, this)); connect(contactsMenu, SIGNAL(triggered(QAction*)), this, SLOT(contactsMenuClicked(QAction*))); contactsMenu->exec(ui->lstContacts->mapToGlobal(pos)); contactsMenu->deleteLater(); }
void GxsCommentTreeWidget::customPopUpMenu(const QPoint& /*point*/) { QMenu contextMnu( this ); QAction* action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Reply to Comment"), this, SLOT(replyToComment())); action->setDisabled(mCurrentMsgId.isNull()); action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Submit Comment"), this, SLOT(makeComment())); action->setDisabled(mThreadId.first.isNull()); contextMnu.addSeparator(); action = contextMnu.addAction(QIcon(IMAGE_VOTEUP), tr("Vote Up"), this, SLOT(voteUp())); action->setDisabled(mVoterId.isNull()); action = contextMnu.addAction(QIcon(IMAGE_VOTEDOWN), tr("Vote Down"), this, SLOT(voteDown())); action->setDisabled(mVoterId.isNull()); if (!mCurrentMsgId.isNull()) { // not implemented yet /* contextMnu.addSeparator(); QMenu *rep_menu = contextMnu.addMenu(tr("Reputation")); action = rep_menu->addAction(QIcon(IMAGE_MESSAGE), tr("Show Reputation"), this, SLOT(showReputation())); contextMnu.addSeparator(); action = rep_menu->addAction(QIcon(IMAGE_MESSAGE), tr("Interesting User"), this, SLOT(markInteresting())); contextMnu.addSeparator(); action = rep_menu->addAction(QIcon(IMAGE_MESSAGE), tr("Mark Spammy"), this, SLOT(markSpammer())); action = rep_menu->addAction(QIcon(IMAGE_MESSAGE), tr("Ban User"), this, SLOT(banUser())); */ } contextMnu.exec(QCursor::pos()); }
void SettingsWidget::displayContextMenuSharedDirs(const QPoint& point) { QPoint globalPosition = this->ui->tblShareDirs->mapToGlobal(point); globalPosition.setY(globalPosition.y() + this->ui->tblShareDirs->horizontalHeader()->height()); QMenu menu; QAction* actionDelete = menu.addAction(QIcon(":/icons/ressources/delete.png"), tr("Remove the shared directory"), this, SLOT(removeShared())); QAction* actionUp = menu.addAction(QIcon(":/icons/ressources/arrow_up.png"), tr("Move up"), this, SLOT(moveUpShared())); QAction* actionDown = menu.addAction(QIcon(":/icons/ressources/arrow_down.png"), tr("Move down"), this, SLOT(moveDownShared())); if (this->coreConnection->isLocal() && this->sharedDirsModel.rowCount() > 0) menu.addAction(QIcon(":/icons/ressources/explore_folder.png"), tr("Open location"), this, SLOT(openLocation())); if (this->sharedDirsModel.rowCount() == 0) actionDelete->setDisabled(true); if (this->ui->tblShareDirs->currentIndex().row() == 0 || this->sharedDirsModel.rowCount() == 0) actionUp->setDisabled(true); if (this->ui->tblShareDirs->currentIndex().row() >= this->sharedDirsModel.rowCount() - 1 || this->sharedDirsModel.rowCount() == 0) actionDown->setDisabled(true); menu.exec(globalPosition); }
void ResultsTree::contextMenuEvent(QContextMenuEvent * e) { QModelIndex index = indexAt(e->pos()); if (index.isValid()) { bool multipleSelection = false; mSelectionModel = selectionModel(); if (mSelectionModel->selectedRows().count() > 1) multipleSelection = true; mContextItem = mModel.itemFromIndex(index); //Create a new context menu QMenu menu(this); //Store all applications in a list QList<QAction*> actions; //Create a signal mapper so we don't have to store data to class //member variables QSignalMapper *signalMapper = new QSignalMapper(this); if (mContextItem && mApplications->GetApplicationCount() > 0 && mContextItem->parent()) { //Create an action for the application int defaultApplicationIndex = mApplications->GetDefaultApplication(); if (defaultApplicationIndex < 0) defaultApplicationIndex = 0; const Application& app = mApplications->GetApplication(defaultApplicationIndex); QAction *start = new QAction(app.getName(), &menu); if (multipleSelection) start->setDisabled(true); //Add it to our list so we can disconnect later on actions << start; //Add it to context menu menu.addAction(start); //Connect the signal to signal mapper connect(start, SIGNAL(triggered()), signalMapper, SLOT(map())); //Add a new mapping signalMapper->setMapping(start, defaultApplicationIndex); connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(Context(int))); }
void PaletteBoxButton::contextMenuEvent(QContextMenuEvent* event) { QMenu menu; QAction* actionProperties = menu.addAction(tr("Palette Properties…")); QAction* actionInsert = menu.addAction(tr("Insert New Palette…")); QAction* actionUp = menu.addAction(tr("Move Palette Up")); QAction* actionDown = menu.addAction(tr("Move Palette Down")); QAction* actionEdit = menu.addAction(tr("Enable Editing")); actionEdit->setCheckable(true); actionEdit->setChecked(!palette->readOnly()); if (palette->isFilterActive()) actionEdit->setVisible(false); bool _systemPalette = palette->systemPalette(); actionProperties->setDisabled(_systemPalette); actionInsert->setDisabled(_systemPalette); actionUp->setDisabled(_systemPalette); actionDown->setDisabled(_systemPalette); actionEdit->setDisabled(_systemPalette); menu.addSeparator(); QAction* actionSave = menu.addAction(tr("Save Palette…")); QAction* actionLoad = menu.addAction(tr("Load Palette…")); actionLoad->setDisabled(_systemPalette); menu.addSeparator(); QAction* actionDelete = menu.addAction(tr("Delete Palette")); actionDelete->setDisabled(_systemPalette); QAction* action = menu.exec(mapToGlobal(event->pos())); if (action == actionProperties) propertiesTriggered(); else if (action == actionInsert) newTriggered(); else if (action == actionUp) upTriggered(); else if (action == actionDown) downTriggered(); else if (action == actionEdit) enableEditing(action->isChecked()); else if (action == actionSave) saveTriggered(); else if (action == actionLoad) loadTriggered(); else if (action == actionDelete) deleteTriggered(); }
void BookmarkGui::buildMenuFavorites() { QAction* new_folder = new QAction( tr( "Nuova Cartella" ) , 0 ); menu_ptr.insert( "new_folder" , new_folder ) ; connect( new_folder , SIGNAL(triggered()) , this , SLOT(on_newFolder()) ) ; this->menuFavorites.addAction( new_folder ) ; this->menuFavorites.addSeparator() ; QAction* cut = new QAction( tr( "Taglia" ) , 0 ); menu_ptr.insert( "cut" , cut ) ; connect( cut , SIGNAL(triggered()) , this , SLOT(on_cutItem()) ) ; this->menuFavorites.addAction( cut ) ; QAction* copy = new QAction( tr( "Copia" ) , 0 ); menu_ptr.insert( "copy" , copy ) ; copy->setDisabled( true ); this->menuFavorites.addAction( copy ) ; QAction* paste = new QAction( tr( "Incolla" ) , 0 ); menu_ptr.insert( "paste" , paste ) ; connect( paste , SIGNAL(triggered()) , this , SLOT(on_pasteItem()) ) ; this->menuFavorites.addAction( paste ) ; QAction* cancel_cut = new QAction( tr( "Annulla Taglia" ) , 0 ); menu_ptr.insert( "cancel_cut" , cancel_cut ) ; connect( cancel_cut , SIGNAL(triggered()) , this , SLOT(on_cancelCut()) ) ; this->menuFavorites.addAction( cancel_cut ) ; this->menuFavorites.addSeparator() ; QAction* remove = new QAction( tr( "Rimuovi" ) , 0 ); menu_ptr.insert( "remove" , remove ) ; connect( remove , SIGNAL(triggered()) , this , SLOT(on_remove()) ) ; this->menuFavorites.addAction( remove ) ; this->menuFavorites.addSeparator() ; QAction* rename_folder = new QAction( tr( "Cambia nome" ) , 0 ); menu_ptr.insert( "rename_folder" , rename_folder ) ; connect( rename_folder , SIGNAL(triggered()) , this , SLOT(on_remaneFolder()) ) ; this->menuFavorites.addAction( rename_folder ) ; ui->mainFavoritesMenu->setMenu( &this->menuFavorites ); }
void Shell::slotPartDisconnect(KParts::BrowserExtension *be) { //if we got here then the part has no browserExtension, so we need to remove the actions //from the collection KParts::BrowserExtension::ActionSlotMap *slotmap = KParts::BrowserExtension::actionSlotMapPtr(); KParts::BrowserExtension::ActionSlotMap::const_iterator it = slotmap->constBegin(); KParts::BrowserExtension::ActionSlotMap::const_iterator itEnd = slotmap->constEnd(); //iterate over the slotmap deactivating as we go... also copied from kongmainwindow.cpp for (; it != itEnd ; ++it) { QAction *act = actionCollection()->action(it.key().data()); if (act && be->metaObject()->indexOfSlot(it.key() + "()") != -1) { act->disconnect(be); act->setDisabled(true); } } }
void MainWindow::createLanguageMenu() { QActionGroup *langGroup = new QActionGroup(ui->menuLanguage); langGroup->setExclusive(true); connect(langGroup, SIGNAL(triggered(QAction *)), this, SLOT(on_language_changed(QAction *))); QStringList fileNames = QDir(":/languages").entryList(QStringList("ppsspp_*.qm")); if (fileNames.size() == 0) { QAction *action = new QAction(tr("No translations"), this); action->setCheckable(false); action->setDisabled(true); ui->menuLanguage->addAction(action); langGroup->addAction(action); } for (int i = 0; i < fileNames.size(); ++i) { QString locale = fileNames[i]; locale.truncate(locale.lastIndexOf('.')); locale.remove(0, locale.indexOf('_') + 1); #if QT_VERSION >= 0x040800 QString language = QLocale(locale).nativeLanguageName(); #else QString language = QLocale::languageToString(QLocale(locale).language()); #endif QAction *action = new QAction(language, this); action->setCheckable(true); action->setData(locale); ui->menuLanguage->addAction(action); langGroup->addAction(action); // TODO check en as default until we save language to config if ("en" == locale) { action->setChecked(true); currentLanguage = "en"; } } }
void medTimeLineToolBox::mouseReleaseEvent ( QMouseEvent * mouseEvent) { if(mouseEvent->button() == Qt::RightButton) { QMenu *menu = new QMenu(this); QAction *actionNotify = new QAction(tr("Set Speed Increment : "), this); actionNotify->setDisabled(true); menu->addAction(actionNotify); for (int i = 0; i < d->actionlist.size() ; i++) { connect(d->actionlist[i], SIGNAL(triggered()), this, SLOT(onStepIncreased())); menu->addAction(d->actionlist[i]); } menu->exec(mouseEvent->globalPos()); } }
void MainWindow::langListSync() { // format systems language ui->menuLanguage->clear(); QDir dir(m_langPath); QStringList fileNames = dir.entryList(QStringList("editor_*.qm")); for (int i = 0; i < fileNames.size(); ++i) { // get locale extracted by filename QString locale; locale = fileNames[i]; // "TranslationExample_de.qm" locale.truncate(locale.lastIndexOf('.')); // "TranslationExample_de" locale.remove(0, locale.indexOf('_') + 1); // "de" QString lang = QLocale::languageToString(QLocale(locale).language()); QIcon ico(QString("%1/%2.png").arg(m_langPath).arg(locale)); QAction *action = new QAction(ico, lang, this); action->setCheckable(true); action->setData(locale); WriteToLog(QtDebugMsg, QString("Locale: %1 %2").arg(m_langPath).arg(locale)); ui->menuLanguage->addAction(action); if (GlobalSettings::locale == locale) { action->setChecked(true); } } if(fileNames.size()==0) { QAction *action = ui->menuLanguage->addAction("[translations not found]"); action->setCheckable(false); action->setDisabled(true); } }
void AdBlockTreeWidget::contextMenuRequested(const QPoint &pos) { if (!m_subscription->canEditRules()) { return; } QTreeWidgetItem* item = itemAt(pos); if (!item) { return; } QMenu menu; menu.addAction(tr("Add Rule"), this, SLOT(addRule())); menu.addSeparator(); QAction* deleteAction = menu.addAction(tr("Remove Rule"), this, SLOT(removeRule())); if (!item->parent()) { deleteAction->setDisabled(true); } menu.exec(viewport()->mapToGlobal(pos)); }
void DialogEditNodeTable::ShowContextual(QPoint point) { //Create a menu and fill with the actions QMenu menu; QAction* deleteAct = new QAction(QIcon(":/icon/delete.png"), "Delete", this); menu.addAction(deleteAct); //Disable the actions if none cell was selected QList<QTableWidgetItem*> selectedCellList = m_pTable->selectedItems(); if(selectedCellList.size() < 1) { deleteAct->setDisabled(true); } //Show contextual menu QAction* itemSelected = menu.exec(m_pTable->mapToGlobal(point)); //Execute what the user has requested if(itemSelected == deleteAct) { RemoveAttributePressed(selectedCellList.at(0)->row()); } }