本文整理汇总了C++中KToggleAction::setData方法的典型用法代码示例。如果您正苦于以下问题:C++ KToggleAction::setData方法的具体用法?C++ KToggleAction::setData怎么用?C++ KToggleAction::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KToggleAction
的用法示例。
在下文中一共展示了KToggleAction::setData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createMenuActions
/**
* Creates the right-click menu
*/
void KMixDockWidget::createMenuActions()
{
QMenu *menu = contextMenu();
if (!menu)
return; // We do not use a menu
shared_ptr<MixDevice> md = Mixer::getGlobalMasterMD();
if ( md.get() != 0 && md->hasMuteSwitch() ) {
// Put "Mute" selector in context menu
#ifdef X_KMIX_KF5_BUILD
KToggleAction *action = new KToggleAction(i18n("M&ute"), this);
action->setData("dock_mute");
addAction("dock_mute", action);
#else
KToggleAction *action = actionCollection()->add<KToggleAction>( "dock_mute" );
action->setText( i18n("M&ute") );
#endif
updateDockMuteAction(action);
connect(action, SIGNAL(triggered(bool)), SLOT(dockMute()));
menu->addAction( action );
}
// Put "Select Master Channel" dialog in context menu
#ifdef X_KMIX_KF5_BUILD
QAction *action = new QAction(i18n("Select Master Channel..."), this);
action->setData("select_master");
addAction("select_master", action);
#else
QAction *action = actionCollection()->addAction( "select_master" );
action->setText( i18n("Select Master Channel...") );
#endif
action->setEnabled(Mixer::getGlobalMasterMixer() != 0);
connect(action, SIGNAL(triggered(bool)), _kmixMainWindow, SLOT(slotSelectMaster()));
menu->addAction( action );
//Context menu entry to access phonon settings
menu->addAction(_kmixMainWindow->actionCollection()->action("launch_kdesoundsetup"));
}