本文整理汇总了C++中KAction::setShortcut方法的典型用法代码示例。如果您正苦于以下问题:C++ KAction::setShortcut方法的具体用法?C++ KAction::setShortcut怎么用?C++ KAction::setShortcut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KAction
的用法示例。
在下文中一共展示了KAction::setShortcut方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KAction
KJotsPlugin::KJotsPlugin( KontactInterface::Core *core, const QVariantList & )
: KontactInterface::Plugin( core, core, "kjots" ), m_interface( 0 )
{
setComponentData( KontactPluginFactory::componentData() );
KAction *action =
new KAction( KIcon( "document-new" ),
i18nc( "@action:inmenu", "New KJots Page" ), this );
actionCollection()->addAction( "new_kjots_page", action );
action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_P ) );
action->setHelpText(
i18nc( "@info:status", "Create a new jots page" ) );
action->setWhatsThis(
i18nc( "@info:whatsthis",
"You will be presented with a dialog where you can create a new jots page." ) );
connect( action, SIGNAL(triggered(bool)), SLOT( newPage()) );
insertNewAction( action );
action = new KAction( KIcon( "address-book-new" ),
i18nc( "@action:inmenu", "New KJots Book" ), this );
actionCollection()->addAction( "new_kjots_book", action );
action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_B ) );
action->setHelpText(
i18nc( "@info:status", "Create a new jots book" ) );
action->setWhatsThis(
i18nc( "@info:whatsthis",
"You will be presented with a dialog where you can create a new jots book." ) );
connect( action, SIGNAL(triggered(bool)), SLOT( newBook()) );
insertNewAction( action );
mUniqueAppWatcher = new KontactInterface::UniqueAppWatcher(
new KontactInterface::UniqueAppHandlerFactory<KJotsUniqueAppHandler>(), this );
}
示例2: setupActions
void MainWindow::setupActions()
{
KStandardAction::quit(KApplication::instance(), SLOT(quit()), actionCollection());
// commit
KAction *commitAction = actionCollection()->addAction("commit", ui->stageWidget, SLOT(commit()));
commitAction->setText(i18n("Commit"));
commitAction->setIcon(KIcon("git-commit"));
commitAction->setShortcut(Qt::CTRL + Qt::Key_Return);
KAction *stageFileAction = actionCollection()->addAction("file_stage", ui->stageWidget, SLOT(stageFile()));
stageFileAction->setText(i18n("Stage File to Commit"));
stageFileAction->setIcon(KIcon("git-file-stage"));
stageFileAction->setShortcut(Qt::CTRL + Qt::Key_S);
KAction *unstageFileAction = actionCollection()->addAction("file_unstage", ui->stageWidget, SLOT(unstageFile()));
unstageFileAction->setText(i18n("Unstage File from Commit"));
unstageFileAction->setIcon(KIcon("git-file-unstage"));
unstageFileAction->setShortcut(Qt::CTRL + Qt::Key_U);
// repository
KAction *openRepoAction = actionCollection()->addAction("repository_open", this, SLOT(open()));
openRepoAction->setText(i18n("Open repository"));
openRepoAction->setIcon(KIcon("git-repo-open"));
openRepoAction->setShortcut(Qt::CTRL + Qt::Key_O);
KAction *reloadRepoAction = actionCollection()->addAction("repository_reload", this, SLOT(reload()));
reloadRepoAction->setText(i18n("Reload repository"));
reloadRepoAction->setIcon(KIcon("git-repo-reload"));
reloadRepoAction->setShortcut(Qt::Key_F5);
}
示例3: initTabWidget
void ActionManagerImpl::initTabWidget(TabWidget* tabWidget)
{
if (d->tabWidget)
return;
else
d->tabWidget = tabWidget;
KActionCollection *coll = actionCollection();
KAction *action = coll->addAction("select_next_tab");
action->setText(i18n("Select Next Tab"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotNextTab()));
action->setShortcuts(KShortcut( "Ctrl+Period" ));
action = coll->addAction("select_previous_tab");
action->setText(i18n("Select Previous Tab"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotPreviousTab()));
action->setShortcuts(KShortcut( "Ctrl+Comma" ));
action = coll->addAction("tab_detach");
action->setIcon(KIcon("tab-detach"));
action->setText(i18n("Detach Tab"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotDetachTab()));
action->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_B));
action = coll->addAction("tab_copylinkaddress");
action->setText(i18n("Copy Link Address"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotCopyLinkAddress()));
action = coll->addAction("tab_remove");
action->setIcon(KIcon("tab-close"));
action->setText(i18n("Close Tab"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotCloseTab()));
action->setShortcuts(KStandardShortcut::close());
action = coll->addAction("inc_font_sizes");
action->setIcon(KIcon("format-font-size-more"));
action->setText(i18n("Enlarge Font"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotFrameZoomIn()));
action->setShortcut( QKeySequence::ZoomIn );
action = coll->addAction("dec_font_sizes");
action->setIcon(KIcon("format-font-size-less"));
action->setText(i18n("Shrink Font"));
connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotFrameZoomOut()));
action->setShortcut( QKeySequence::ZoomOut );
QString actionname;
for (int i=1;i<10;i++) {
actionname.sprintf("activate_tab_%02d", i);
action = new KAction( i18n("Activate Tab %1", i),this );
action->setShortcut( QKeySequence( QString::fromLatin1( "Alt+%1" ).arg( i ) ) );
coll->addAction( actionname, action );
connect( action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotActivateTab()) );
}
}
示例4: QTreeView
KFindTreeView::KFindTreeView( QWidget *parent, KfindDlg * findDialog )
: QTreeView( parent ) ,
m_contextMenu(0),
m_kfindDialog(findDialog)
{
//Configure model and proxy model
m_model = new KFindItemModel( this );
m_proxyModel = new KFindSortFilterProxyModel();
m_proxyModel->setSourceModel( m_model );
setModel( m_proxyModel );
//Configure QTreeView
setRootIsDecorated( false );
setSelectionMode( QAbstractItemView::ExtendedSelection );
setSortingEnabled( true );
setDragEnabled( true );
setContextMenuPolicy( Qt::CustomContextMenu );
connect( this, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(contextMenuRequested(QPoint)));
//Mouse single/double click settings
connect( KGlobalSettings::self(), SIGNAL(settingsChanged(int)), this, SLOT(reconfigureMouseSettings()) );
reconfigureMouseSettings();
// TODO: this is a workaround until Qt-issue 176832 has been fixed (from Dolphin)
connect(this, SIGNAL(pressed(QModelIndex)), this, SLOT(updateMouseButtons()));
//Generate popup menu actions
m_actionCollection = new KActionCollection( this );
m_actionCollection->addAssociatedWidget(this);
KAction * open = KStandardAction::open(this, SLOT(slotExecuteSelected()), this);
m_actionCollection->addAction( "file_open", open );
KAction * copy = KStandardAction::copy(this, SLOT(copySelection()), this);
m_actionCollection->addAction( "edit_copy", copy );
KAction * openFolder = new KAction( KIcon("window-new"), i18n("&Open containing folder(s)"), this );
connect( openFolder, SIGNAL(triggered()), this, SLOT(openContainingFolder()) );
m_actionCollection->addAction( "openfolder", openFolder );
KAction * del = new KAction( KIcon("edit-delete"), i18n("&Delete"), this );
connect( del, SIGNAL(triggered()), this, SLOT(deleteSelectedFiles()) );
del->setShortcut(Qt::SHIFT + Qt::Key_Delete);
m_actionCollection->addAction( "del", del );
KAction * trash = new KAction( KIcon("user-trash"), i18n("&Move to Trash"), this );
connect( trash, SIGNAL(triggered()), this, SLOT(moveToTrashSelectedFiles()) );
trash->setShortcut(Qt::Key_Delete);
m_actionCollection->addAction( "trash", trash );
header()->setStretchLastSection( true );
sortByColumn( 0, Qt::AscendingOrder );
}
示例5: updateGlobalAccels
void KNotesApp::updateGlobalAccels()
{
if ( m_globalAccel->isEnabled() )
{
KAction *action = actionCollection()->action( "new_note" );
if ( action )
action->setShortcut( m_globalAccel->shortcut( "global_new_note" ) );
action = actionCollection()->action( "new_note_clipboard" );
if ( action )
action->setShortcut( m_globalAccel->shortcut( "global_new_note_clipboard" ) );
action = actionCollection()->action( "hide_all_notes" );
if ( action )
action->setShortcut( m_globalAccel->shortcut( "global_hide_all_notes" ) );
action = actionCollection()->action( "show_all_notes" );
if ( action )
action->setShortcut( m_globalAccel->shortcut( "global_show_all_notes" ) );
m_globalAccel->updateConnections();
}
else
{
KAction *action = actionCollection()->action( "new_note" );
if ( action )
action->setShortcut( 0 );
action = actionCollection()->action( "new_note_clipboard" );
if ( action )
action->setShortcut( 0 );
action = actionCollection()->action( "hide_all_notes" );
if ( action )
action->setShortcut( 0 );
action = actionCollection()->action( "show_all_notes" );
if ( action )
action->setShortcut( 0 );
}
}
示例6: slotConfigureAccels
void KNotesApp::slotConfigureAccels()
{
KNotesKeyDialog keys( m_globalAccel, this );
QDictIterator<KNote> notes( m_noteList );
if ( !m_noteList.isEmpty() )
keys.insert( (*notes)->actionCollection() );
keys.configure();
m_globalAccel->writeSettings();
updateGlobalAccels();
// update GUI doc for new notes
m_noteGUI.setContent(
KXMLGUIFactory::readConfigFile( instance()->instanceName() + "ui.rc", instance() )
);
if ( m_noteList.isEmpty() )
return;
notes.toFirst();
QValueList<KAction *> list = (*notes)->actionCollection()->actions();
for ( QValueList<KAction *>::iterator it = list.begin(); it != list.end(); ++it )
{
notes.toFirst();
for ( ++notes; *notes; ++notes )
{
KAction *toChange = (*notes)->actionCollection()->action( (*it)->name() );
if ( toChange->shortcut() != (*it)->shortcut() )
toChange->setShortcut( (*it)->shortcut() );
}
}
}
示例7: KAction
KNotesPlugin::KNotesPlugin( KontactInterface::Core *core, const QVariantList & )
: KontactInterface::Plugin( core, core, "knotes" ), mAboutData( 0 )
{
setComponentData( KontactPluginFactory::componentData() );
KAction *action =
new KAction( KIcon( "knotes" ),
i18nc( "@action:inmenu", "New Popup Note..." ), this );
actionCollection()->addAction( "new_note", action );
connect( action, SIGNAL(triggered(bool)), SLOT(slotNewNote()) );
action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_N ) );
action->setHelpText(
i18nc( "@info:status", "Create new popup note" ) );
action->setWhatsThis(
i18nc( "@info:whatsthis",
"You will be presented with a dialog where you can create a new popup note." ) );
insertNewAction( action );
KAction *syncAction =
new KAction( KIcon( "view-refresh" ),
i18nc( "@action:inmenu", "Sync Popup Notes" ), this );
actionCollection()->addAction( "knotes_sync", syncAction );
connect( syncAction, SIGNAL(triggered(bool)), SLOT(slotSyncNotes()) );
syncAction->setHelpText(
i18nc( "@info:status", "Synchronize groupware notes" ) );
syncAction->setWhatsThis(
i18nc( "@info:whatsthis",
"Choose this option to synchronize your groupware notes." ) );
insertSyncAction( syncAction );
}
示例8: setupActions
void MainWindow::setupActions()
{
actQuit = KStandardAction::quit(this, SLOT(quit()), actionCollection());
KAction *a = NULL;
a = actionCollection()->addAction("minimizeRestore", this,
SLOT(minimizeRestore()));
a->setText(i18n("Minimize"));
a->setIcon(KIcon(""));
a->setShortcut(0);
/** Settings : ************************************************************/
// m_actShowToolbar = KStandardAction::showToolbar( this, SLOT(toggleToolBar()), actionCollection());
m_actShowStatusbar = KStandardAction::showStatusbar(this, SLOT(toggleStatusBar()), actionCollection());
// m_actShowToolbar->setCheckedState( KGuiItem(i18n("Hide &Toolbar")) );
(void) KStandardAction::keyBindings(this, SLOT(showShortcutsSettingsDialog()), actionCollection());
(void) KStandardAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection());
//KAction *actCfgNotifs = KStandardAction::configureNotifications(this, SLOT(configureNotifications()), actionCollection() );
//actCfgNotifs->setEnabled(false); // Not yet implemented !
actAppConfig = KStandardAction::preferences(this, SLOT(showSettingsDialog()), actionCollection());
}
示例9: KAction
TodoPlugin::TodoPlugin( KontactInterface::Core *core, const QVariantList & )
: KontactInterface::Plugin( core, core, "korganizer", "todo" ), mIface( 0 )
{
setComponentData( KontactPluginFactory::componentData() );
KIconLoader::global()->addAppDir( "korganizer" );
KIconLoader::global()->addAppDir( "kdepim" );
KAction *action =
new KAction( KIcon( "task-new" ),
i18nc( "@action:inmenu", "New To-do..." ), this );
actionCollection()->addAction( "new_todo", action );
action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_T ) );
action->setHelpText(
i18nc( "@info:status", "Create a new to-do" ) );
action->setWhatsThis(
i18nc( "@info:whatsthis",
"You will be presented with a dialog where you can create a new to-do item." ) );
connect( action, SIGNAL(triggered(bool)), SLOT(slotNewTodo()) );
insertNewAction( action );
KAction *syncAction =
new KAction( KIcon( "view-refresh" ),
i18nc( "@action:inmenu", "Sync To-do List" ), this );
syncAction->setHelpText(
i18nc( "@info:status", "Synchronize groupware to-do list" ) );
syncAction->setWhatsThis(
i18nc( "@info:whatsthis",
"Choose this option to synchronize your groupware to-do list." ) );
connect( syncAction, SIGNAL(triggered(bool)), SLOT(slotSyncTodos()) );
insertSyncAction( syncAction );
mUniqueAppWatcher = new KontactInterface::UniqueAppWatcher(
new KontactInterface::UniqueAppHandlerFactory<KOrganizerUniqueAppHandler>(), this );
}
示例10: setupActions
void SimonView::setupActions()
{
connectAction = new KAction(this);
connectAction->setText(i18n("Connect"));
connectAction->setCheckable(true);
connectAction->setIcon(KIcon("network-disconnect"));
connect(connectAction, SIGNAL(triggered(bool)),
this, SLOT(toggleConnection()));
actionCollection()->addAction("connect", connectAction);
this->trayManager->addAction("connect", connectAction);
activateAction = new KAction(this);
activateAction->setText(i18n("Activate"));
activateAction->setIcon(KIcon("media-playback-start"));
activateAction->setCheckable(true);
connect(activateAction, SIGNAL(triggered(bool)),
this, SLOT(toggleActivation()));
this->trayManager->addAction("activate", activateAction);
activateAction->setEnabled(false);
actionCollection()->addAction("activate", activateAction);
//must be set after addAction() because of the unique name set in addAction(name,...)
// deactivated because of KDE bug #307225
//activateAction->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::Key_Pause));
disconnectAction = new KAction(this);
disconnectAction->setText(i18n("Disconnect"));
disconnectAction->setIcon(KIcon("network-disconnect"));
connect(disconnectAction, SIGNAL(triggered(bool)),
control, SLOT(disconnectFromServer()));
KToolBarPopupAction* connectActivate = new KToolBarPopupAction(KIcon("network-disconnect"), i18n("Connect"), this);
connectActivate->setCheckable(true);
connectActivate->setShortcut(Qt::CTRL + Qt::Key_C);
actionCollection()->addAction("connectActivate", connectActivate);
connect(connectActivate, SIGNAL(triggered(bool)),
this, SLOT(toggleConnection()));
KAction* recompile = new KAction(this);
recompile->setEnabled(control->getStatus() != SimonControl::Disconnected);
recompile->setText(i18n("Synchronize"));
recompile->setIcon(KIcon("view-refresh"));
recompile->setShortcut(Qt::CTRL + Qt::Key_F5);
actionCollection()->addAction("compileModel", recompile);
connect(recompile, SIGNAL(triggered(bool)),
control, SLOT(compileModel()));
KAction* sendSampleShareAction = new KAction(this);
sendSampleShareAction->setText(i18n("Contribute samples"));
sendSampleShareAction->setIcon(KIcon("repository"));
actionCollection()->addAction("sampleShare", sendSampleShareAction);
connect(sendSampleShareAction, SIGNAL(triggered(bool)),this, SLOT(showSampleShare()));
actionCollection()->addAction(KStandardAction::Preferences, "configuration",
this, SLOT(showSystemDialog()));
KStandardAction::quit(this, SLOT(closeSimon()),
actionCollection());
}
示例11: cut
KAction *create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
{
KAction *pAction = 0;
const Info* pInfo = infoPtr(id);
if (pInfo) {
pAction = new KAction(parent);
pAction->setObjectName(pInfo->psName);
KShortcut cut(pInfo->shortcut);
if (!cut.isEmpty())
pAction->setShortcut(cut);
pAction->setText(i18n(pInfo->psText));
pAction->setToolTip(i18n(pInfo->psToolTip));
pAction->setWhatsThis(i18n(pInfo->psWhatsThis));
if (pInfo->psIconName)
pAction->setIcon(KIcon(QLatin1String(pInfo->psIconName)));
}
if (recvr && slot)
QObject::connect(pAction, SIGNAL(triggered(bool)), recvr, slot);
if (pAction) {
KActionCollection *collection = qobject_cast<KActionCollection *>(parent);
if (collection)
collection->addAction(pAction->objectName(), pAction);
}
return pAction;
}
示例12: setupActions
void TextTool::setupActions()
{
KAction *pencil = new KAction(QIcon(THEME_DIR + "icons/text.png"), tr("Text"), this);
pencil->setShortcut(QKeySequence(tr("T")));
pencil->setCursor(QCursor(THEME_DIR + "cursors/text.png"));
m_actions.insert(tr("Text"), pencil);
}
示例13: setupActions
void KateViewManager::setupActions ()
{
KAction *a;
/**
* view splitting
*/
a = m_mainWindow->actionCollection()->addAction("view_split_vert");
a->setIcon( KIcon("view-split-left-right") );
a->setText( i18n("Split Ve&rtical") );
a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_L );
connect(a, SIGNAL(triggered()), this, SLOT(slotSplitViewSpaceVert()));
a->setWhatsThis(i18n("Split the currently active view vertically into two views."));
a = m_mainWindow->actionCollection()->addAction("view_split_horiz");
a->setIcon( KIcon("view-split-top-bottom") );
a->setText( i18n("Split &Horizontal") );
a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_T );
connect(a, SIGNAL(triggered()), this, SLOT(slotSplitViewSpaceHoriz()));
a->setWhatsThis(i18n("Split the currently active view horizontally into two views."));
m_closeView = m_mainWindow->actionCollection()->addAction("view_close_current_space");
m_closeView->setIcon( KIcon("view-close") );
m_closeView->setText( i18n("Cl&ose Current View") );
m_closeView->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_R );
connect(m_closeView, SIGNAL(triggered()), this, SLOT(slotCloseCurrentViewSpace()));
m_closeView->setWhatsThis(i18n("Close the currently active splitted view"));
goNext = m_mainWindow->actionCollection()->addAction( "go_next_split_view" );
goNext->setText( i18n("Next Split View") );
goNext->setShortcut( Qt::Key_F8 );
connect(goNext, SIGNAL(triggered()), this, SLOT(activateNextView()));
goNext->setWhatsThis(i18n("Make the next split view the active one."));
goPrev = m_mainWindow->actionCollection()->addAction( "go_prev_split_view" );
goPrev->setText( i18n("Previous Split View") );
goPrev->setShortcut( Qt::SHIFT + Qt::Key_F8 );
connect(goPrev, SIGNAL(triggered()), this, SLOT(activatePrevView()));
goPrev->setWhatsThis(i18n("Make the previous split view the active one."));
}
示例14: initGlobalShortcuts
void App::initGlobalShortcuts()
{
EngineController* const ec = EngineController::instance();
m_pGlobalAccel->insert( "play", i18n( "Play" ), 0, KKey("WIN+x"), 0,
ec, SLOT( play() ), true, true );
m_pGlobalAccel->insert( "pause", i18n( "Pause" ), 0, KKey("WIN+c"), 0,
ec, SLOT( pause() ), true, true );
m_pGlobalAccel->insert( "play_pause", i18n( "Play/Pause" ), 0, 0, 0,
ec, SLOT( playPause() ), true, true );
m_pGlobalAccel->insert( "stop", i18n( "Stop" ), 0, KKey("WIN+v"), 0,
ec, SLOT( stop() ), true, true );
m_pGlobalAccel->insert( "next", i18n( "Next Track" ), 0, KKey("WIN+b"), 0,
ec, SLOT( next() ), true, true );
m_pGlobalAccel->insert( "prev", i18n( "Previous Track" ), 0, KKey("WIN+z"), 0,
ec, SLOT( previous() ), true, true );
m_pGlobalAccel->insert( "volup", i18n( "Increase Volume" ), 0, KKey("WIN+KP_Add"), 0,
ec, SLOT( increaseVolume() ), true, true );
m_pGlobalAccel->insert( "voldn", i18n( "Decrease Volume" ), 0, KKey("WIN+KP_Subtract"), 0,
ec, SLOT( decreaseVolume() ), true, true );
m_pGlobalAccel->insert( "seekforward", i18n( "Seek Forward" ), 0, KKey("WIN+Shift+KP_Add"), 0,
ec, SLOT( seekForward() ), true, true );
m_pGlobalAccel->insert( "seekbackward", i18n( "Seek Backward" ), 0, KKey("WIN+Shift+KP_Subtract"), 0,
ec, SLOT( seekBackward() ), true, true );
m_pGlobalAccel->insert( "playlist_add", i18n( "Add Media..." ), 0, KKey("WIN+a"), 0,
m_pPlaylistWindow, SLOT( slotAddLocation() ), true, true );
m_pGlobalAccel->insert( "show", i18n( "Toggle Playlist Window" ), 0, KKey("WIN+p"), 0,
m_pPlaylistWindow, SLOT( showHide() ), true, true );
m_pGlobalAccel->insert( "osd", i18n( "Show OSD" ), 0, KKey("WIN+o"), 0,
amaroK::OSD::instance(), SLOT( forceToggleOSD() ), true, true );
m_pGlobalAccel->insert( "mute", i18n( "Mute Volume" ), 0, KKey("WIN+m"), 0,
ec, SLOT( mute() ), true, true );
m_pGlobalAccel->setConfigGroup( "Shortcuts" );
m_pGlobalAccel->readSettings( kapp->config() );
m_pGlobalAccel->updateConnections();
//TODO fix kde accel system so that kactions find appropriate global shortcuts
// and there is only one configure shortcuts dialog
KActionCollection* const ac = amaroK::actionCollection();
KAccelShortcutList list( m_pGlobalAccel );
for( uint i = 0; i < list.count(); ++i )
{
KAction *action = ac->action( list.name( i ).latin1() );
if( action )
{
//this is a hack really, also it means there may be two calls to the slot for the shortcut
action->setShortcutConfigurable( false );
action->setShortcut( list.shortcut( i ) );
}
}
}
示例15: createAction
QAction* DebuggerMainWnd::createAction(const QString& text,
int shortcut, const QObject* receiver,
const char* slot, const char* name)
{
KAction* a = actionCollection()->addAction(name);
a->setText(text);
if (shortcut)
a->setShortcut(KShortcut(shortcut));
connect(a, SIGNAL(triggered()), receiver, slot);
return a;
}