本文整理汇总了C++中KActionCollection::setDefaultShortcut方法的典型用法代码示例。如果您正苦于以下问题:C++ KActionCollection::setDefaultShortcut方法的具体用法?C++ KActionCollection::setDefaultShortcut怎么用?C++ KActionCollection::setDefaultShortcut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KActionCollection
的用法示例。
在下文中一共展示了KActionCollection::setDefaultShortcut方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupActions
void TorrentActivity::setupActions()
{
KActionCollection* ac = part()->actionCollection();
start_all_action = new QAction(QIcon::fromTheme(QStringLiteral("kt-start-all")), i18n("Start All"), this);
start_all_action->setToolTip(i18n("Start all torrents"));
connect(start_all_action, &QAction::triggered, this, &TorrentActivity::startAllTorrents);
ac->addAction(QStringLiteral("start_all"), start_all_action);
stop_all_action = new QAction(QIcon::fromTheme(QStringLiteral("kt-stop-all")), i18n("Stop All"), this);
stop_all_action->setToolTip(i18n("Stop all torrents"));
connect(stop_all_action, &QAction::triggered, this, &TorrentActivity::stopAllTorrents);
ac->addAction(QStringLiteral("stop_all"), stop_all_action);
queue_suspend_action = new KToggleAction(QIcon::fromTheme(QStringLiteral("kt-pause")), i18n("Suspend Torrents"), this);
ac->addAction(QStringLiteral("queue_suspend"), queue_suspend_action);
ac->setDefaultShortcut(queue_suspend_action, QKeySequence(Qt::SHIFT + Qt::Key_P));
queue_suspend_action->setToolTip(i18n("Suspend all running torrents"));
//KF5 queue_suspend_action->setGlobalShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + Qt::Key_P));
connect(queue_suspend_action, &KToggleAction::toggled, this, &TorrentActivity::suspendQueue);
show_group_view_action = new KToggleAction(QIcon::fromTheme(QStringLiteral("view-list-tree")), i18n("Group View"), this);
show_group_view_action->setToolTip(i18n("Show or hide the group view"));
connect(show_group_view_action, &QAction::toggled, this, &TorrentActivity::setGroupViewVisible);
ac->addAction(QStringLiteral("show_group_view"), show_group_view_action);
filter_torrent_action = new QAction(i18n("Filter Torrents"), this);
filter_torrent_action->setToolTip(i18n("Filter torrents based on filter string"));
connect(filter_torrent_action, &QAction::triggered, search_bar, &TorrentSearchBar::showBar);
ac->addAction(QStringLiteral("filter_torrent"), filter_torrent_action);
ac->setDefaultShortcut(filter_torrent_action, QKeySequence(Qt::CTRL + Qt::Key_F));
view->setupActions(ac);
}
示例2: setupActions
void StorageServiceManagerMainWindow::setupActions()
{
KActionCollection *ac = actionCollection();
KStandardAction::quit(this, &StorageServiceManagerMainWindow::close, ac);
mAuthenticate = ac->addAction(QStringLiteral("authenticate"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotAuthenticate()));
mAuthenticate->setText(i18n("Authenticate..."));
mCreateFolder = ac->addAction(QStringLiteral("create_folder"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotCreateFolder()));
mCreateFolder->setText(i18n("Create Folder..."));
mCreateFolder->setIcon(QIcon::fromTheme(QStringLiteral("folder-new")));
mRefreshList = ac->addAction(QStringLiteral("refresh_list"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotRefreshList()));
mRefreshList->setText(i18n("Refresh List"));
mRefreshList->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
ac->setDefaultShortcut(mRefreshList, QKeySequence(Qt::Key_F5));
mAccountInfo = ac->addAction(QStringLiteral("account_info"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotAccountInfo()));
mAccountInfo->setText(i18n("Account Info..."));
mUploadFile = ac->addAction(QStringLiteral("upload_file"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotUploadFile()));
mUploadFile->setText(i18n("Upload File..."));
mDelete = ac->addAction(QStringLiteral("delete"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotDelete()));
ac->setDefaultShortcut(mDelete, QKeySequence(Qt::Key_Delete));
mDelete->setText(i18n("Delete..."));
mDelete->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
mDownloadFile = ac->addAction(QStringLiteral("download_file"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotDownloadFile()));
mDownloadFile->setText(i18n("Download File..."));
mDownloadFile->setIcon(QIcon::fromTheme(QStringLiteral("download")));
mShowLog = ac->addAction(QStringLiteral("show_log"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotShowLog()));
mShowLog->setText(i18n("Show Log..."));
mLogout = ac->addAction(QStringLiteral("logout"), this, SLOT(slotLogout()));
mLogout->setText(i18n("Logout"));
mShutdownAllServices = ac->addAction(QStringLiteral("shutdown_all_services"), this, SLOT(slotShutdownAllServices()));
mShutdownAllServices->setText(i18n("Shutdown All Services"));
mRefreshAll = ac->addAction(QStringLiteral("refresh_all"), this, SLOT(slotRefreshAll()));
mRefreshAll->setText(i18n("Refresh All"));
ac->setDefaultShortcut(mRefreshAll, QKeySequence(Qt::CTRL + Qt::Key_F5));
mRenameItem = ac->addAction(QStringLiteral("rename"), mStorageServiceMainWidget->storageServiceTabWidget(), SLOT(slotRename()));
mRenameItem->setText(i18n("Rename..."));
ac->setDefaultShortcut(mRenameItem, QKeySequence(Qt::Key_F2));
KStandardAction::preferences(this, &StorageServiceManagerMainWindow::slotConfigure, ac);
KStandardAction::configureNotifications(this, &StorageServiceManagerMainWindow::slotShowNotificationOptions, ac); // options_configure_notifications
}
示例3: setupActions
void GUI::setupActions()
{
KActionCollection* ac = actionCollection();
QAction * new_action = KStandardAction::openNew(this, SLOT(createTorrent()), ac);
new_action->setToolTip(i18n("Create a new torrent"));
QAction * open_action = KStandardAction::open(this, SLOT(openTorrent()), ac);
open_action->setToolTip(i18n("Open a torrent"));
paste_action = KStandardAction::paste(this, SLOT(paste()), ac);
open_silently_action = new QAction(open_action->icon(), i18n("Open Silently"), this);
open_silently_action->setToolTip(i18n("Open a torrent without asking any questions"));
connect(open_silently_action, &QAction::triggered, this, &GUI::openTorrentSilently);
ac->addAction(QStringLiteral("file_open_silently"), open_silently_action);
KStandardAction::quit(this, SLOT(quit()), ac);
show_status_bar_action = KStandardAction::showStatusbar(statusBar(), SLOT(setVisible(bool)), ac);
show_status_bar_action->setIcon(QIcon::fromTheme(QStringLiteral("kt-show-statusbar")));
show_menu_bar_action = KStandardAction::showMenubar(menuBar(), SLOT(setVisible(bool)), ac);
KStandardAction::preferences(this, SLOT(showPrefDialog()), ac);
KStandardAction::keyBindings(this, SLOT(configureKeys()), ac);
KStandardAction::configureToolbars(this, SLOT(configureToolbars()), ac);
KStandardAction::configureNotifications(this, SLOT(configureNotifications()), ac);
paste_url_action = new QAction(QIcon::fromTheme(QStringLiteral("document-open-remote")), i18n("Open URL"), this);
paste_url_action->setToolTip(i18n("Open a URL which points to a torrent, magnet links are supported"));
connect(paste_url_action, &QAction::triggered, this, &GUI::pasteURL);
ac->addAction(QStringLiteral("paste_url"), paste_url_action);
ac->setDefaultShortcut(paste_url_action, QKeySequence(Qt::CTRL + Qt::Key_P));
ipfilter_action = new QAction(QIcon::fromTheme(QStringLiteral("view-filter")), i18n("IP Filter"), this);
ipfilter_action->setToolTip(i18n("Show the list of blocked IP addresses"));
connect(ipfilter_action, &QAction::triggered, this, &GUI::showIPFilter);
ac->addAction(QStringLiteral("ipfilter_action"), ipfilter_action);
ac->setDefaultShortcut(ipfilter_action, QKeySequence(Qt::CTRL + Qt::Key_I));
import_action = new QAction(QIcon::fromTheme("document-import"), i18n("Import Torrent"), this);
import_action->setToolTip(i18n("Import a torrent"));
connect(import_action, &QAction::triggered, this, &GUI::import);
ac->addAction(QStringLiteral("import"), import_action);
ac->setDefaultShortcut(import_action, QKeySequence(Qt::SHIFT + Qt::Key_I));
show_kt_action = new QAction(QIcon::fromTheme(QStringLiteral("kt-show-hide")), i18n("Show/Hide KTorrent"), this);
connect(show_kt_action, &QAction::triggered, this, &GUI::showOrHide);
ac->addAction(QStringLiteral("show_kt"), show_kt_action);
// KF5 show_kt_action->setGlobalShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + Qt::Key_T));
setStandardToolBarMenuEnabled(true);
}
示例4: createActionsForMainWindow
void ClangSupport::createActionsForMainWindow (Sublime::MainWindow* /*window*/, QString& _xmlFile, KActionCollection& actions)
{
_xmlFile = xmlFile();
QAction* renameDeclarationAction = actions.addAction(QStringLiteral("code_rename_declaration"));
renameDeclarationAction->setText( i18n("Rename Declaration") );
renameDeclarationAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename")));
actions.setDefaultShortcut(renameDeclarationAction, Qt::CTRL | Qt::SHIFT | Qt::Key_R);
connect(renameDeclarationAction, &QAction::triggered,
m_refactoring, &BasicRefactoring::executeRenameAction);
}
示例5: group
KrViewer::KrViewer(QWidget *parent) :
KParts::MainWindow(parent, (Qt::WindowFlags)KDE_DEFAULT_WINDOWFLAGS), manager(this, this), tabBar(this),
reservedKeys(), reservedKeyActions(), sizeX(-1), sizeY(-1)
{
//setWFlags(Qt::WType_TopLevel | WDestructiveClose);
setXMLFile("krviewer.rc"); // kpart-related xml file
setHelpMenuEnabled(false);
connect(&manager, SIGNAL(activePartChanged(KParts::Part*)),
this, SLOT(createGUI(KParts::Part*)));
connect(&tabBar, &QTabWidget::currentChanged, this, &KrViewer::tabChanged);
connect(&tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequest(int)));
tabBar.setDocumentMode(true);
tabBar.setMovable(true);
setCentralWidget(&tabBar);
printAction = KStandardAction::print(this, SLOT(print()), 0);
copyAction = KStandardAction::copy(this, SLOT(copy()), 0);
viewerMenu = new QMenu(this);
QAction *tempAction;
KActionCollection *ac = actionCollection();
#define addCustomMenuAction(name, text, slot, shortcut)\
tempAction = ac->addAction(name, this, slot);\
tempAction->setText(text);\
ac->setDefaultShortcut(tempAction, shortcut);\
viewerMenu->addAction(tempAction);
addCustomMenuAction("genericViewer", i18n("&Generic Viewer"), SLOT(viewGeneric()), Qt::CTRL + Qt::SHIFT + Qt::Key_G);
addCustomMenuAction("textViewer", i18n("&Text Viewer"), SLOT(viewText()), Qt::CTRL + Qt::SHIFT + Qt::Key_T);
addCustomMenuAction("hexViewer", i18n("&Hex Viewer"), SLOT(viewHex()), Qt::CTRL + Qt::SHIFT + Qt::Key_H);
addCustomMenuAction("lister", i18n("&Lister"), SLOT(viewLister()), Qt::CTRL + Qt::SHIFT + Qt::Key_L);
viewerMenu->addSeparator();
addCustomMenuAction("textEditor", i18n("Text &Editor"), SLOT(editText()), Qt::CTRL + Qt::SHIFT + Qt::Key_E);
viewerMenu->addSeparator();
QList<QAction *> actList = menuBar()->actions();
bool hasPrint = false, hasCopy = false;
foreach(QAction *a, actList) {
if (a->shortcut().matches(printAction->shortcut()) != QKeySequence::NoMatch)
hasPrint = true;
if (a->shortcut().matches(copyAction->shortcut()) != QKeySequence::NoMatch)
hasCopy = true;
}
QAction *printAct = viewerMenu->addAction(printAction->icon(), printAction->text(), this, SLOT(print()));
if (hasPrint)
printAct->setShortcut(printAction->shortcut());
QAction *copyAct = viewerMenu->addAction(copyAction->icon(), copyAction->text(), this, SLOT(copy()));
if (hasCopy)
copyAct->setShortcut(copyAction->shortcut());
viewerMenu->addSeparator();
configKeysAction = ac->addAction(KStandardAction::KeyBindings, this, SLOT(configureShortcuts()));
viewerMenu->addAction(configKeysAction);
viewerMenu->addSeparator();
detachAction = ac->addAction("detachTab", this, SLOT(detachTab()));
detachAction->setText(i18n("&Detach Tab"));
//no point in detaching only one tab..
detachAction->setEnabled(false);
ac->setDefaultShortcut(detachAction, Qt::META + Qt::Key_D);
viewerMenu->addAction(detachAction);
quitAction = ac->addAction(KStandardAction::Quit, this, SLOT(close()));
viewerMenu->addAction(quitAction);
tabCloseAction = ac->addAction("closeTab", this, SLOT(tabCloseRequest()));
tabCloseAction->setText(i18n("&Close Current Tab"));
QList<QKeySequence> shortcuts = KStandardShortcut::close();
shortcuts.append(Qt::Key_Escape);
ac->setDefaultShortcuts(tabCloseAction, shortcuts);
tabNextAction = ac->addAction("nextTab", this, SLOT(nextTab()));
tabNextAction->setText(i18n("&Next Tab"));
ac->setDefaultShortcuts(tabNextAction, KStandardShortcut::tabNext());
tabPrevAction = ac->addAction("prevTab", this, SLOT(prevTab()));
tabPrevAction->setText(i18n("&Previous Tab"));
ac->setDefaultShortcuts(tabPrevAction, KStandardShortcut::tabPrev());
tabBar.setTabsClosable(true);
checkModified();
KConfigGroup group(krConfig, "KrViewerWindow");
int sx = group.readEntry("Window Width", -1);
int sy = group.readEntry("Window Height", -1);
if (sx != -1 && sy != -1)
resize(sx, sy);
else
resize(900, 700);
if (group.readEntry("Window Maximized", false)) {
setWindowState(windowState() | Qt::WindowMaximized);
}
//.........这里部分代码省略.........
示例6: mByteArrayView
ViewConfigController::ViewConfigController( KXMLGUIClient* guiClient )
: mByteArrayView( 0 )
{
KActionCollection* actionCollection = guiClient->actionCollection();
// Offset coding
mOffsetCodingAction = actionCollection->add<KSelectAction>( QStringLiteral("view_offsetcoding") );
mOffsetCodingAction->setText( i18nc("@title:menu","&Offset Coding") );
QStringList list;
list.append( i18nc("@item:inmenu offset in the hexadecimal format",
"&Hexadecimal") );
list.append( i18nc("@item:inmenu offset in the decimal format",
"&Decimal") );
mOffsetCodingAction->setItems( list );
connect( mOffsetCodingAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &ViewConfigController::setOffsetCoding );
// value valueCoding
mCodingAction = actionCollection->add<KSelectAction>( QStringLiteral("view_valuecoding") );
mCodingAction->setText( i18nc("@title:menu","&Value Coding") );
list.clear();
list.append( i18nc("@item:inmenu encoding of the bytes as values in the hexadecimal format",
"&Hexadecimal") );
list.append( i18nc("@item:inmenu encoding of the bytes as values in the decimal format",
"&Decimal") );
list.append( i18nc("@item:inmenu encoding of the bytes as values in the octal format",
"&Octal") );
list.append( i18nc("@item:inmenu encoding of the bytes as values in the binary format",
"&Binary") );
mCodingAction->setItems( list );
connect( mCodingAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &ViewConfigController::setValueCoding );
// char valueCoding
mEncodingAction = actionCollection->add<KSelectAction>( QStringLiteral("view_charencoding") );
mEncodingAction->setText( i18nc("@title:menu","&Char Coding") );
mEncodingAction->setItems( Okteta::CharCodec::codecNames() );
connect( mEncodingAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &ViewConfigController::setCharCoding );
mShowsNonprintingAction = actionCollection->add<KToggleAction>( QStringLiteral("view_showsnonprinting") );
mShowsNonprintingAction->setText( i18nc("@option:check","Show &Non-printing Chars") );
connect( mShowsNonprintingAction, &KToggleAction::triggered, this, &ViewConfigController::setShowsNonprinting );
// bytes per line
mSetBytesPerLineAction = actionCollection->addAction( QStringLiteral("view_bytesperline"),
this, SLOT(setBytesPerLine()) );
mSetBytesPerLineAction->setText( i18nc("@action:inmenu","Set Bytes per Line...") );
// byte groups size
mSetBytesPerGroupAction = actionCollection->addAction( QStringLiteral("view_bytespergroup"),
this, SLOT(setBytesPerGroup()) );
mSetBytesPerGroupAction->setText( i18nc("@action:inmenu","Set Bytes per Group...") );
// resize style
mResizeStyleAction = actionCollection->add<KSelectAction>( QStringLiteral("resizestyle") );
mResizeStyleAction->setText( i18nc("@title:menu","&Dynamic Layout") );
list.clear();
list.append( i18nc("@item:inmenu The layout will not change on size changes.",
"&Off") );
list.append( i18nc("@item:inmenu The layout will adapt to the size, but only with complete groups of bytes.",
"&Wrap Only Complete Byte Groups") );
list.append( i18nc("@item:inmenu The layout will adapt to the size and fit in as much bytes per line as possible.",
"&On") );
mResizeStyleAction->setItems( list );
connect( mResizeStyleAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &ViewConfigController::setLayoutStyle );
mShowOffsetColumnAction = actionCollection->add<KToggleAction>( QStringLiteral("view_lineoffset") );
mShowOffsetColumnAction->setText( i18nc("@option:check","Show &Line Offset") );
actionCollection->setDefaultShortcut( mShowOffsetColumnAction, Qt::Key_F11 );
connect( mShowOffsetColumnAction, &KToggleAction::triggered, this, &ViewConfigController::toggleOffsetColumn );
// show buffer columns
mToggleColumnsAction = actionCollection->add<KSelectAction>( QStringLiteral("togglecolumns") );
mToggleColumnsAction->setText( i18nc("@title:menu","&Show Values or Chars") );
list.clear();
list.append( i18nc("@item:inmenu","&Values") );
list.append( i18nc("@item:inmenu","&Chars") );
list.append( i18nc("@item:inmenu","Values && Chars") );
mToggleColumnsAction->setItems( list );
connect( mToggleColumnsAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &ViewConfigController::toggleValueCharColumns );
setTargetModel( 0 );
}
示例7: createActions
void KMReaderWin::createActions()
{
KActionCollection *ac = mActionCollection;
if (!ac) {
return;
}
//
// Message Menu
//
// new message to
mMailToComposeAction = new QAction(QIcon::fromTheme(QStringLiteral("mail-message-new")),
i18n("New Message To..."), this);
ac->addAction(QStringLiteral("mail_new"), mMailToComposeAction);
ac->setShortcutsConfigurable(mMailToComposeAction, false);
connect(mMailToComposeAction, &QAction::triggered, this, &KMReaderWin::slotMailtoCompose);
// reply to
mMailToReplyAction = new QAction(QIcon::fromTheme(QStringLiteral("mail-reply-sender")),
i18n("Reply To..."), this);
ac->addAction(QStringLiteral("mailto_reply"), mMailToReplyAction);
ac->setShortcutsConfigurable(mMailToReplyAction, false);
connect(mMailToReplyAction, &QAction::triggered, this, &KMReaderWin::slotMailtoReply);
// forward to
mMailToForwardAction = new QAction(QIcon::fromTheme(QStringLiteral("mail-forward")),
i18n("Forward To..."), this);
ac->setShortcutsConfigurable(mMailToForwardAction, false);
ac->addAction(QStringLiteral("mailto_forward"), mMailToForwardAction);
connect(mMailToForwardAction, &QAction::triggered, this, &KMReaderWin::slotMailtoForward);
// add to addressbook
mAddAddrBookAction = new QAction(QIcon::fromTheme(QStringLiteral("contact-new")),
i18n("Add to Address Book"), this);
ac->setShortcutsConfigurable(mAddAddrBookAction, false);
ac->addAction(QStringLiteral("add_addr_book"), mAddAddrBookAction);
connect(mAddAddrBookAction, &QAction::triggered, this, &KMReaderWin::slotMailtoAddAddrBook);
mAddEmailToExistingContactAction = new QAction(QIcon::fromTheme(QStringLiteral("contact-new")),
i18n("Add to Existing Contact"), this);
ac->setShortcutsConfigurable(mAddEmailToExistingContactAction, false);
ac->addAction(QStringLiteral("add_to_existing_contact"), mAddAddrBookAction);
connect(mAddEmailToExistingContactAction, &QAction::triggered, this, &KMReaderWin::slotMailToAddToExistingContact);
// open in addressbook
mOpenAddrBookAction = new QAction(QIcon::fromTheme(QStringLiteral("view-pim-contacts")),
i18n("Open in Address Book"), this);
ac->setShortcutsConfigurable(mOpenAddrBookAction, false);
ac->addAction(QStringLiteral("openin_addr_book"), mOpenAddrBookAction);
connect(mOpenAddrBookAction, &QAction::triggered, this, &KMReaderWin::slotMailtoOpenAddrBook);
// bookmark message
mAddBookmarksAction = new QAction(QIcon::fromTheme(QStringLiteral("bookmark-new")), i18n("Bookmark This Link"), this);
ac->setShortcutsConfigurable(mAddBookmarksAction, false);
ac->addAction(QStringLiteral("add_bookmarks"), mAddBookmarksAction);
connect(mAddBookmarksAction, &QAction::triggered, this, &KMReaderWin::slotAddBookmarks);
mEditContactAction = new QAction(QIcon::fromTheme(QStringLiteral("view-pim-contacts")),
i18n("Edit contact..."), this);
ac->setShortcutsConfigurable(mEditContactAction, false);
ac->addAction(QStringLiteral("edit_contact"), mOpenAddrBookAction);
connect(mEditContactAction, &QAction::triggered, this, &KMReaderWin::slotEditContact);
// save URL as
mUrlSaveAsAction = new QAction(i18n("Save Link As..."), this);
ac->addAction(QStringLiteral("saveas_url"), mUrlSaveAsAction);
ac->setShortcutsConfigurable(mUrlSaveAsAction, false);
connect(mUrlSaveAsAction, &QAction::triggered, this, &KMReaderWin::slotUrlSave);
// find text
QAction *action = new QAction(QIcon::fromTheme(QStringLiteral("edit-find")), i18n("&Find in Message..."), this);
ac->addAction(QStringLiteral("find_in_messages"), action);
connect(action, &QAction::triggered, this, &KMReaderWin::slotFind);
ac->setDefaultShortcut(action, KStandardShortcut::find().first());
// save Image On Disk
mImageUrlSaveAsAction = new QAction(i18n("Save Image On Disk..."), this);
ac->addAction(QStringLiteral("saveas_imageurl"), mImageUrlSaveAsAction);
ac->setShortcutsConfigurable(mImageUrlSaveAsAction, false);
connect(mImageUrlSaveAsAction, &QAction::triggered, this, &KMReaderWin::slotSaveImageOnDisk);
// View html options
mViewHtmlOptions = new QMenu(i18n("Show HTML Format"));
mViewAsHtml = new QAction(i18n("Show HTML format when mail comes from this contact"), mViewHtmlOptions);
ac->setShortcutsConfigurable(mViewAsHtml, false);
connect(mViewAsHtml, &QAction::triggered, this, &KMReaderWin::slotContactHtmlOptions);
mViewAsHtml->setCheckable(true);
mViewHtmlOptions->addAction(mViewAsHtml);
mLoadExternalReference = new QAction(i18n("Load external reference when mail comes for this contact"), mViewHtmlOptions);
ac->setShortcutsConfigurable(mLoadExternalReference, false);
connect(mLoadExternalReference, &QAction::triggered, this, &KMReaderWin::slotContactHtmlOptions);
mLoadExternalReference->setCheckable(true);
mViewHtmlOptions->addAction(mLoadExternalReference);
mShareImage = new QAction(i18n("Share image..."), this);
ac->addAction(QStringLiteral("share_imageurl"), mShareImage);
ac->setShortcutsConfigurable(mShareImage, false);
connect(mShareImage, &QAction::triggered, this, &KMReaderWin::slotShareImage);
}
示例8: createActionsForMainWindow
void QuickOpenPlugin::createActionsForMainWindow(Sublime::MainWindow* /*window*/, QString& xmlFile, KActionCollection& actions)
{
xmlFile = QStringLiteral("kdevquickopen.rc");
QAction* quickOpen = actions.addAction(QStringLiteral("quick_open"));
quickOpen->setText( i18n("&Quick Open") );
quickOpen->setIcon( QIcon::fromTheme(QStringLiteral("quickopen")) );
actions.setDefaultShortcut( quickOpen, Qt::CTRL | Qt::ALT | Qt::Key_Q );
connect(quickOpen, &QAction::triggered, this, &QuickOpenPlugin::quickOpen);
QAction* quickOpenFile = actions.addAction(QStringLiteral("quick_open_file"));
quickOpenFile->setText( i18n("Quick Open &File") );
quickOpenFile->setIcon( QIcon::fromTheme(QStringLiteral("quickopen-file")) );
actions.setDefaultShortcut( quickOpenFile, Qt::CTRL | Qt::ALT | Qt::Key_O );
connect(quickOpenFile, &QAction::triggered, this, &QuickOpenPlugin::quickOpenFile);
QAction* quickOpenClass = actions.addAction(QStringLiteral("quick_open_class"));
quickOpenClass->setText( i18n("Quick Open &Class") );
quickOpenClass->setIcon( QIcon::fromTheme(QStringLiteral("quickopen-class")) );
actions.setDefaultShortcut( quickOpenClass, Qt::CTRL | Qt::ALT | Qt::Key_C );
connect(quickOpenClass, &QAction::triggered, this, &QuickOpenPlugin::quickOpenClass);
QAction* quickOpenFunction = actions.addAction(QStringLiteral("quick_open_function"));
quickOpenFunction->setText( i18n("Quick Open &Function") );
quickOpenFunction->setIcon( QIcon::fromTheme(QStringLiteral("quickopen-function")) );
actions.setDefaultShortcut( quickOpenFunction, Qt::CTRL | Qt::ALT | Qt::Key_M );
connect(quickOpenFunction, &QAction::triggered, this, &QuickOpenPlugin::quickOpenFunction);
QAction* quickOpenAlreadyOpen = actions.addAction(QStringLiteral("quick_open_already_open"));
quickOpenAlreadyOpen->setText( i18n("Quick Open &Already Open File") );
quickOpenAlreadyOpen->setIcon( QIcon::fromTheme(QStringLiteral("quickopen-file")) );
connect(quickOpenAlreadyOpen, &QAction::triggered, this, &QuickOpenPlugin::quickOpenOpenFile);
QAction* quickOpenDocumentation = actions.addAction(QStringLiteral("quick_open_documentation"));
quickOpenDocumentation->setText( i18n("Quick Open &Documentation") );
quickOpenDocumentation->setIcon( QIcon::fromTheme(QStringLiteral("quickopen-documentation")) );
actions.setDefaultShortcut( quickOpenDocumentation, Qt::CTRL | Qt::ALT | Qt::Key_D );
connect(quickOpenDocumentation, &QAction::triggered, this, &QuickOpenPlugin::quickOpenDocumentation);
QAction* quickOpenActions = actions.addAction(QStringLiteral("quick_open_actions"));
quickOpenActions->setText( i18n("Quick Open &Actions") );
actions.setDefaultShortcut( quickOpenActions, Qt::CTRL | Qt::ALT | Qt::Key_A);
connect(quickOpenActions, &QAction::triggered, this, &QuickOpenPlugin::quickOpenActions);
m_quickOpenDeclaration = actions.addAction(QStringLiteral("quick_open_jump_declaration"));
m_quickOpenDeclaration->setText( i18n("Jump to Declaration") );
m_quickOpenDeclaration->setIcon( QIcon::fromTheme(QStringLiteral("go-jump-declaration") ) );
actions.setDefaultShortcut( m_quickOpenDeclaration, Qt::CTRL | Qt::Key_Period );
connect(m_quickOpenDeclaration, &QAction::triggered, this, &QuickOpenPlugin::quickOpenDeclaration, Qt::QueuedConnection);
m_quickOpenDefinition = actions.addAction(QStringLiteral("quick_open_jump_definition"));
m_quickOpenDefinition->setText( i18n("Jump to Definition") );
m_quickOpenDefinition->setIcon( QIcon::fromTheme(QStringLiteral("go-jump-definition") ) );
actions.setDefaultShortcut( m_quickOpenDefinition, Qt::CTRL | Qt::Key_Comma );
connect(m_quickOpenDefinition, &QAction::triggered, this, &QuickOpenPlugin::quickOpenDefinition, Qt::QueuedConnection);
QWidgetAction* quickOpenLine = new QWidgetAction(this);
quickOpenLine->setText( i18n("Embedded Quick Open") );
// actions.setDefaultShortcut( quickOpenLine, Qt::CTRL | Qt::ALT | Qt::Key_E );
// connect(quickOpenLine, SIGNAL(triggered(bool)), this, SLOT(quickOpenLine(bool)));
quickOpenLine->setDefaultWidget(createQuickOpenLineWidget());
actions.addAction(QStringLiteral("quick_open_line"), quickOpenLine);
QAction* quickOpenNextFunction = actions.addAction(QStringLiteral("quick_open_next_function"));
quickOpenNextFunction->setText( i18n("Next Function") );
actions.setDefaultShortcut( quickOpenNextFunction, Qt::CTRL| Qt::ALT | Qt::Key_PageDown );
connect(quickOpenNextFunction, &QAction::triggered, this, &QuickOpenPlugin::nextFunction);
QAction* quickOpenPrevFunction = actions.addAction(QStringLiteral("quick_open_prev_function"));
quickOpenPrevFunction->setText( i18n("Previous Function") );
actions.setDefaultShortcut( quickOpenPrevFunction, Qt::CTRL| Qt::ALT | Qt::Key_PageUp );
connect(quickOpenPrevFunction, &QAction::triggered, this, &QuickOpenPlugin::previousFunction);
QAction* quickOpenNavigateFunctions = actions.addAction(QStringLiteral("quick_open_outline"));
quickOpenNavigateFunctions->setText( i18n("Outline") );
actions.setDefaultShortcut( quickOpenNavigateFunctions, Qt::CTRL| Qt::ALT | Qt::Key_N );
connect(quickOpenNavigateFunctions, &QAction::triggered, this, &QuickOpenPlugin::quickOpenNavigateFunctions);
}