本文整理汇总了C++中KToggleAction::plug方法的典型用法代码示例。如果您正苦于以下问题:C++ KToggleAction::plug方法的具体用法?C++ KToggleAction::plug怎么用?C++ KToggleAction::plug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KToggleAction
的用法示例。
在下文中一共展示了KToggleAction::plug方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KMainWindow
MyMainWindow::MyMainWindow() : KMainWindow(0)
{
text = new QLabel(i18n("<h1>Hello, World!</h1>"), this);
setCentralWidget(text);
QPopupMenu *filePopup = new QPopupMenu(this);
KAction *quitAction = KStdAction::quit(this, SLOT(fileQuit()), actionCollection());
clearAction = new KAction(i18n("&Clear"), "stop", Qt::CTRL + Qt::Key_X, this, SLOT(fileClear()), actionCollection(), "file_clear");
KToggleAction *toolbarAction = new KToggleAction(i18n("Show &Toolbar"), 0, actionCollection(), "settings_show_toolbar");
toolbarAction->setChecked(true);
connect(toolbarAction, SIGNAL(toggled(bool)), this, SLOT(toggleToolBar(bool)));
QPopupMenu *settingsMenu = new QPopupMenu();
toolbarAction->plug(settingsMenu);
clearAction->plug(filePopup);
clearAction->plug(toolBar());
quitAction->plug(filePopup);
quitAction->plug(toolBar());
menuBar()->insertItem(i18n("&File"), filePopup);
menuBar()->insertSeparator();
menuBar()->insertItem("&Settings", settingsMenu);
menuBar()->insertSeparator();
menuBar()->insertItem(i18n("&Help"), helpMenu());
}
示例2: initActions
void KMJobViewer::initActions()
{
// job actions
KAction *hact = new KAction(i18n("&Hold"),"stop",0,this,SLOT(slotHold()),actionCollection(),"job_hold");
KAction *ract = new KAction(i18n("&Resume"),"run",0,this,SLOT(slotResume()),actionCollection(),"job_resume");
KAction *dact = new KAction(i18n("Remo&ve"),"edittrash",Qt::Key_Delete,this,SLOT(slotRemove()),actionCollection(),"job_remove");
KAction *sact = new KAction(i18n("Res&tart"),"redo",0,this,SLOT(slotRestart()),actionCollection(),"job_restart");
KActionMenu *mact = new KActionMenu(i18n("&Move to Printer"),"fileprint",actionCollection(),"job_move");
mact->setDelayed(false);
connect(mact->popupMenu(),SIGNAL(activated(int)),SLOT(slotMove(int)));
connect(mact->popupMenu(),SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold()));
connect(mact->popupMenu(),SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release()));
connect(mact->popupMenu(),SIGNAL(aboutToShow()),SLOT(slotShowMoveMenu()));
KToggleAction *tact = new KToggleAction(i18n("&Toggle Completed Jobs"),"history",0,actionCollection(),"view_completed");
tact->setEnabled(m_manager->actions() & KMJob::ShowCompleted);
connect(tact,SIGNAL(toggled(bool)),SLOT(slotShowCompleted(bool)));
KToggleAction *uact = new KToggleAction(i18n("Show Only User Jobs"), "personal", 0, actionCollection(), "view_user_jobs");
uact->setCheckedState(KGuiItem(i18n("Hide Only User Jobs"),"personal"));
connect(uact, SIGNAL(toggled(bool)), SLOT(slotUserOnly(bool)));
m_userfield = new QLineEdit(0);
m_userfield->setText(getenv("USER"));
connect(m_userfield, SIGNAL(returnPressed()), SLOT(slotUserChanged()));
connect(uact, SIGNAL(toggled(bool)), m_userfield, SLOT(setEnabled(bool)));
m_userfield->setEnabled(false);
m_userfield->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
KWidgetAction *ufact = new KWidgetAction(m_userfield, i18n("User Name"), 0, 0, 0, actionCollection(), "view_username");
if (!m_pop)
{
m_pop = new QPopupMenu(this);
connect(m_pop,SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold()));
connect(m_pop,SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release()));
hact->plug(m_pop);
ract->plug(m_pop);
m_pop->insertSeparator();
dact->plug(m_pop);
mact->plug(m_pop);
m_pop->insertSeparator();
sact->plug(m_pop);
}
// Filter actions
KActionMenu *fact = new KActionMenu(i18n("&Select Printer"), "kdeprint_printer", actionCollection(), "filter_modify");
fact->setDelayed(false);
connect(fact->popupMenu(),SIGNAL(activated(int)),SLOT(slotPrinterSelected(int)));
connect(fact->popupMenu(),SIGNAL(aboutToShow()),KMTimer::self(),SLOT(hold()));
connect(fact->popupMenu(),SIGNAL(aboutToHide()),KMTimer::self(),SLOT(release()));
connect(fact->popupMenu(),SIGNAL(aboutToShow()),SLOT(slotShowPrinterMenu()));
if (!m_standalone)
{
KToolBar *toolbar = toolBar();
hact->plug(toolbar);
ract->plug(toolbar);
toolbar->insertSeparator();
dact->plug(toolbar);
mact->plug(toolbar);
toolbar->insertSeparator();
sact->plug(toolbar);
toolbar->insertSeparator();
tact->plug(toolbar);
uact->plug(toolbar);
ufact->plug(toolbar);
}
else
{ // stand-alone application
KStdAction::quit(kapp,SLOT(quit()),actionCollection());
KStdAction::close(this,SLOT(slotClose()),actionCollection());
KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection());
// refresh action
new KAction(i18n("Refresh"),"reload",0,this,SLOT(slotRefresh()),actionCollection(),"refresh");
// create status bar
KStatusBar *statusbar = statusBar();
m_stickybox = new QCheckBox( i18n( "Keep window permanent" ), statusbar );
statusbar->addWidget( m_stickybox, 1, false );
statusbar->insertItem(" " + i18n("Max.: %1").arg(i18n("Unlimited"))+ " ", 0, 0, true);
statusbar->setItemFixed(0);
updateStatusBar();
createGUI();
}
loadPluginActions();
slotSelectionChanged();
}