本文整理汇总了C++中KPopupMenu::insertItem方法的典型用法代码示例。如果您正苦于以下问题:C++ KPopupMenu::insertItem方法的具体用法?C++ KPopupMenu::insertItem怎么用?C++ KPopupMenu::insertItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KPopupMenu
的用法示例。
在下文中一共展示了KPopupMenu::insertItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotContextMenuRequested
void VariablesListView::slotContextMenuRequested(QListViewItem* item, const QPoint& p, int)
{
// if(col != NameCol) return;
enum { CopyVarItem, CopyValueItem };
KPopupMenu* menu = new KPopupMenu(this);
menu->insertItem("Copy variable", CopyVarItem);
menu->insertItem("Copy value", CopyValueItem);
int selection = menu->exec(p);
if(selection == -1)
{
delete menu;
return;
}
QClipboard* clip = kapp->clipboard();
VariablesListViewItem* converted =
dynamic_cast<VariablesListViewItem*>(item);
switch(selection)
{
case CopyVarItem:
clip->setText(converted->variable()->toString(), QClipboard::Clipboard);
break;
case CopyValueItem:
clip->setText(converted->variable()->value()->toString(), QClipboard::Clipboard);
break;
}
delete menu;
}
示例2: execContextMenu
void KSysTrayCmd::execContextMenu( const QPoint &pos )
{
KPopupMenu *menu = new KPopupMenu();
menu->insertTitle( *pixmap(), i18n( "KSysTrayCmd" ) );
int hideShowId = menu->insertItem( isVisible ? i18n( "&Hide" ) : i18n( "&Restore" ) );
int undockId = menu->insertItem( SmallIcon("close"), i18n( "&Undock" ) );
int quitId = menu->insertItem( SmallIcon("exit"), i18n( "&Quit" ) );
int cmd = menu->exec( pos );
if ( cmd == quitId )
quitClient();
else if ( cmd == undockId )
quit();
else if ( cmd == hideShowId )
{
if ( lazyStart && ( !hasRunningClient() ) )
{
start();
isVisible=true;
}
else if ( quitOnHide && ( hasRunningClient() ) && isVisible )
{
NETRootInfo ri( qt_xdisplay(), NET::CloseWindow );
ri.closeWindowRequest( win );
isVisible=false;
}
else
toggleWindow();
}
delete menu;
}
示例3: contextMenu
void KstDataManagerI::contextMenu(QListViewItem *i, const QPoint& p, int col) {
Q_UNUSED(col)
KstObjectItem *koi = static_cast<KstObjectItem*>(i);
KstBaseCurve *c;
if (koi->rtti() == RTTI_OBJ_OBJECT || koi->rtti() == RTTI_OBJ_DATA_VECTOR) {
KPopupMenu *m = new KPopupMenu(this);
m->setTitle(koi->text(0));
int id = m->insertItem(i18n("&Edit..."), this, SLOT(edit_I()));
//m->setItemEnabled(id, RTTI_OBJ_VECTOR != koi->rtti());
if (koi->rtti() == RTTI_OBJ_DATA_VECTOR) {
id = m->insertItem(i18n("&Make Curve..."), koi, SLOT(makeCurve()));
} else if ((c = dynamic_cast<KstBaseCurve*>(koi->dataObject().data()))) {
KPopupMenu *addMenu = new KPopupMenu(this);
KPopupMenu *removeMenu = new KPopupMenu(this);
PlotMap.clear();
id = 100;
bool haveAdd = false, haveRemove = false;
for (KstPlot *p = KST::plotList.first(); p; p = KST::plotList.next()) {
if (!p->Curves.contains(c)) {
addMenu->insertItem(p->tagName(), koi, SLOT(addToPlot(int)), 0, id);
haveAdd = true;
} else {
示例4: contextMenu
void FavoriteFolderView::contextMenu(QListViewItem *item, const QPoint &point)
{
KMFolderTree *ft = mainWidget()->folderTree();
assert(ft);
KMFolderTreeItem *fti = static_cast<KMFolderTreeItem *>(item);
mContextMenuItem = fti;
KPopupMenu contextMenu;
if(fti && fti->folder())
{
contextMenu.insertItem(SmallIconSet("editdelete"), i18n("Remove From Favorites"),
this, SLOT(removeFolder()));
contextMenu.insertItem(SmallIconSet("edit"), i18n("Rename Favorite"), this, SLOT(renameFolder()));
contextMenu.insertSeparator();
mainWidget()->action("mark_all_as_read")->plug(&contextMenu);
if(fti->folder()->folderType() == KMFolderTypeImap || fti->folder()->folderType() == KMFolderTypeCachedImap)
mainWidget()->action("refresh_folder")->plug(&contextMenu);
if(fti->folder()->isMailingListEnabled())
mainWidget()->action("post_message")->plug(&contextMenu);
contextMenu.insertItem(SmallIconSet("configure_shortcuts"), i18n("&Assign Shortcut..."), fti, SLOT(assignShortcut()));
contextMenu.insertItem(i18n("Expire..."), fti, SLOT(slotShowExpiryProperties()));
mainWidget()->action("modify")->plug(&contextMenu);
}
else
{
contextMenu.insertItem(SmallIconSet("bookmark_add"), i18n("Add Favorite Folder..."),
this, SLOT(addFolder()));
}
contextMenu.exec(point, 0);
}
示例5: UIServerSystemTray
UIServerSystemTray(UIServer *uis) : KSystemTray(uis)
{
KPopupMenu *pop = contextMenu();
pop->insertItem(i18n("Settings..."), uis, SLOT(slotConfigure()));
pop->insertItem(i18n("Remove"), uis, SLOT(slotRemoveSystemTrayIcon()));
setPixmap(loadIcon("filesave"));
// actionCollection()->action("file_quit")->setEnabled(true);
KStdAction::quit(uis, SLOT(slotQuit()), actionCollection());
}
示例6: end
void
ScriptManager::slotShowContextMenu( QListViewItem* item, const QPoint& pos )
{
const bool isCategory = item == m_generalCategory ||
item == m_lyricsCategory ||
item == m_scoreCategory ||
item == m_transcodeCategory;
if( !item || isCategory ) return;
// Look up script entry in our map
ScriptMap::Iterator it;
ScriptMap::Iterator end( m_scripts.end() );
for( it = m_scripts.begin(); it != end; ++it )
if( it.data().li == item ) break;
enum { SHOW_LOG, EDIT };
KPopupMenu menu;
menu.insertTitle( i18n( "Debugging" ) );
menu.insertItem( SmallIconSet( amaroK::icon( "clock" ) ), i18n( "Show Output &Log" ), SHOW_LOG );
menu.insertItem( SmallIconSet( amaroK::icon( "edit" ) ), i18n( "&Edit" ), EDIT );
menu.setItemEnabled( SHOW_LOG, it.data().process );
const int id = menu.exec( pos );
switch( id )
{
case EDIT:
KRun::runCommand( "kwrite " + it.data().url.path() );
break;
case SHOW_LOG:
QString line;
while( it.data().process->readln( line ) != -1 )
it.data().log += line;
KTextEdit* editor = new KTextEdit( it.data().log );
kapp->setTopWidget( editor );
editor->setCaption( kapp->makeStdCaption( i18n( "Output Log for %1" ).arg( it.key() ) ) );
editor->setReadOnly( true );
QFont font( "fixed" );
font.setFixedPitch( true );
font.setStyleHint( QFont::TypeWriter );
editor->setFont( font );
editor->setTextFormat( QTextEdit::PlainText );
editor->resize( 500, 380 );
editor->show();
break;
}
}
示例7: eventFilter
//Credit to amaroK for this
//Seems like it can become the next plugin to do since amarok is really cool (just missing plugin arch)
bool SongList::eventFilter(QObject *o, QEvent *e ) {
if(o == header() && e->type() == QEvent::MouseButtonPress && static_cast<QMouseEvent*>(e)->button() == Qt::RightButton ) {
KPopupMenu popup;
//popup.setFont(this->font());
popup.setCheckable(true);
popup.insertTitle(i18n("Available Columns"));
int colcount=columns();
for( int i = 0; i < colcount; ++i ) //columns() references a property
{
popup.insertItem(columnText(i),i,i+1 );
popup.setItemChecked(i,columnWidth(i)!=0);
}
int col = popup.exec( static_cast<QMouseEvent *>(e)->globalPos() );
if( col != -1 ) {
//TODO can result in massively wide column appearing!
if( columnWidth( col ) == 0 ) {
adjustColumn( col );
header()->setResizeEnabled( true, col );
} else hideColumn( col );
}
//determine first visible column again, since it has changed
//eat event
return TRUE;
}
return KListView::eventFilter(o,e);
}
示例8: eventFilter
bool Sidebar::eventFilter(QObject *obj, QEvent *ev)
{
if (ev->type()==QEvent::ContextMenu)
{
QContextMenuEvent *e = (QContextMenuEvent *) ev;
KMultiTabBarTab *bt = dynamic_cast<KMultiTabBarTab*>(obj);
if (bt)
{
kdDebug()<<"Request for popup"<<endl;
m_popupButton = bt->id();
ToolView *w = m_idToWidget[m_popupButton];
if (w)
{
KPopupMenu *p = new KPopupMenu (this);
p->insertTitle(SmallIcon("view_remove"), i18n("Behavior"), 50);
p->insertItem(w->persistent ? SmallIconSet("window_nofullscreen") : SmallIconSet("window_fullscreen"), w->persistent ? i18n("Make Non-Persistent") : i18n("Make Persistent"), 10);
p->insertTitle(SmallIcon("move"), i18n("Move To"), 51);
if (position() != 0)
p->insertItem(SmallIconSet("back"), i18n("Left Sidebar"),0);
if (position() != 1)
p->insertItem(SmallIconSet("forward"), i18n("Right Sidebar"),1);
if (position() != 2)
p->insertItem(SmallIconSet("up"), i18n("Top Sidebar"),2);
if (position() != 3)
p->insertItem(SmallIconSet("down"), i18n("Bottom Sidebar"),3);
connect(p, SIGNAL(activated(int)),
this, SLOT(buttonPopupActivate(int)));
p->exec(e->globalPos());
delete p;
return true;
}
}
}
示例9: ItemView
ICNView::ICNView(ICNDocument *icnDocument, ViewContainer *viewContainer, uint viewAreaId, const char *name)
: ItemView(icnDocument, viewContainer, viewAreaId, name) {
bool manualRouting = (icnDocument->m_cmManager->cmState() & CMManager::cms_manual_route);
KActionCollection * ac = actionCollection();
//BEGIN Routing Actions
// These actions get inserted into the main menu
m_pAutoRoutingAction = new KRadioAction(i18n("Automatic"), "", 0, this, SLOT(slotSetRoutingAuto()), ac, "routing_mode_auto");
m_pAutoRoutingAction->setExclusiveGroup("routing_mode");
if (!manualRouting)
m_pAutoRoutingAction->setChecked(true);
m_pManualRoutingAction = new KRadioAction(i18n("Manual"), "", 0, this, SLOT(slotSetRoutingManual()), ac, "routing_mode_manual");
m_pManualRoutingAction->setExclusiveGroup("routing_mode");
if (manualRouting)
m_pManualRoutingAction->setChecked(true);
// This popup gets inserted into the toolbar
m_pRoutingModeToolbarPopup = new KToolBarPopupAction(i18n("Connection Routing Mode"), "pencil", 0, 0, 0, ac, "routing_mode");
m_pRoutingModeToolbarPopup->setDelayed(false);
KPopupMenu *m = m_pRoutingModeToolbarPopup->popupMenu();
m->insertTitle(i18n("Connection Routing Mode"));
m->insertItem(/*KGlobal::iconLoader()->loadIcon( "routing_mode_auto", KIcon::Small ), */i18n("Automatic"), 0);
m->insertItem(/*KGlobal::iconLoader()->loadIcon( "routing_mode_manual", KIcon::Small ),*/ i18n("Manual"), 1);
m->setCheckable(true);
m->setItemChecked(manualRouting ? 1 : 0, true);
connect(m, SIGNAL(activated(int)), this, SLOT(slotSetRoutingMode(int)));
//END Routing Actions
connect(icnDocument->m_cmManager, SIGNAL(manualRoutingChanged(bool)), this, SLOT(slotUpdateRoutingToggles(bool)));
}
示例10: showPopupMenu
/*!
\fn SnippetWidget::showPopupMenu( QListViewItem * item, const QPoint & p, int )
Shows the Popup-Menu depending item is a valid pointer
*/
void SnippetWidget::showPopupMenu( QListViewItem * item, const QPoint & p, int )
{
KPopupMenu popup;
SnippetItem * selectedItem = static_cast<SnippetItem *>(item);
if ( item ) {
popup.insertTitle( selectedItem->getName() );
popup.insertItem( i18n("Add Item..."), this, SLOT( slotAdd() ) );
popup.insertItem( i18n("Add Group..."), this, SLOT( slotAddGroup() ) );
if (dynamic_cast<SnippetGroup*>(item)) {
popup.insertItem( i18n("Edit..."), this, SLOT( slotEditGroup() ) );
} else {
popup.insertItem( i18n("Edit..."), this, SLOT( slotEdit() ) );
}
popup.insertItem( i18n("Remove"), this, SLOT( slotRemove() ) );
} else {
popup.insertTitle(i18n("Code Snippets"));
popup.insertItem( i18n("Add Group..."), this, SLOT( slotAddGroup() ) );
}
popup.exec(p);
}
示例11: SmallIconSet
void
AnalyzerContainer::contextMenuEvent( QContextMenuEvent *e)
{
#if defined HAVE_LIBVISUAL
KPopupMenu menu;
menu.insertItem( SmallIconSet( Amarok::icon( "visualizations" ) ), i18n("&Visualizations"), Menu::ID_SHOW_VIS_SELECTOR );
if( menu.exec( mapToGlobal( e->pos() ) ) == Menu::ID_SHOW_VIS_SELECTOR )
Menu::instance()->slotActivated( Menu::ID_SHOW_VIS_SELECTOR );
#else
Q_UNUSED(e);
#endif
}
示例12: createPopupMenu
//void OutputText::contextMenuEvent(QContextMenuEvent* e)
QPopupMenu* OutputText::createPopupMenu(const QPoint&)
{
KPopupMenu* popup = new KPopupMenu;
int id = popup->insertItem(i18n("Show Internal Commands"),
this,
SLOT(toggleShowInternalCommands()));
popup->setItemChecked(id, parent_->showInternalCommands_);
popup->setWhatsThis(
id,
i18n(
"Controls if commands issued internally by KDevelop "
"will be shown or not.<br>"
"This option will affect only future commands, it won't "
"add or remove already issued commands from the view."));
popup->insertItem(i18n("Copy All"),
this,
SLOT(copyAll()));
return popup;
}
示例13: KMainWindow
k2send::k2send()
: KMainWindow( 0, "k2send" ),
m_printer(0)
{
m_config = new KConfig("k2send");
m_view = new k2sendWidget(this,"k2sendwidget",0,m_config);
setAcceptDrops(FALSE);
setCentralWidget(m_view);
setupActions();
statusBar()->show();
setAutoSaveSettings();
statusBar()->insertFixedItem("9999 Files", 0, true);
statusBar()->insertFixedItem("00:00:00", 1, true);
statusBar()->insertFixedItem("000 kbit/s", 2, true);
statusBar()->insertFixedItem("Loud: 0", 3, true);
statusBar()->insertFixedItem("00:00:00:00:00:00 ", 4, true);
statusBar()->changeItem ("0 Files", 0);
statusBar()->changeItem ("0 kbit/s", 2);
trayicon = new KSystemTray(this, "k2sendtray");
trayicon->show();
trayicon->setPixmap (DesktopIcon( "k2send", 24));
KPopupMenu * pop = trayicon->contextMenu() ;
pop->insertItem(DesktopIcon( "player_play", 16 ), "Play", m_view, SLOT(slotPlay()), CTRL+Key_P ,1,1);
pop->insertItem(DesktopIcon( "player_stop", 16 ), "Stop", m_view, SLOT(slotStop()), CTRL+Key_S ,2,2);
pop->insertItem(DesktopIcon( "player_fwd", 16 ), "Next", m_view, SLOT(slotSkip()), CTRL+Key_N ,3,3);
pop->insertItem( "Loundess", m_view, SLOT(slotLoudness()), CTRL+Key_L ,4,4);
connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)),
this, SLOT(changeStatusbar(const QString&)));
connect(m_view, SIGNAL(signalChangeCaption(const QString&)),
this, SLOT(changeCaption(const QString&)));
}
示例14: if
void
AnalyzerContainer::mousePressEvent( QMouseEvent *e)
{
if( e->button() == Qt::LeftButton ) {
AmarokConfig::setCurrentPlaylistAnalyzer( AmarokConfig::currentPlaylistAnalyzer() + 1 );
changeAnalyzer();
}
else if( e->button() == Qt::RightButton ) {
#if defined HAVE_XMMS || defined HAVE_LIBVISUAL
KPopupMenu menu;
menu.insertItem( SmallIconSet( "visualizations" ), i18n("&Visualizations"), Menu::ID_SHOW_VIS_SELECTOR );
if( menu.exec( mapToGlobal( e->pos() ) ) == Menu::ID_SHOW_VIS_SELECTOR )
Menu::instance()->slotActivated( Menu::ID_SHOW_VIS_SELECTOR );
#endif
}
}
示例15: initMenuBar
void ChatBase::initMenuBar()
{
// Icons: /opt/kde2/share/icons/hicolor/16x16/actions
menuBar()->clear();
KPopupMenu* fileMenu = new KPopupMenu(menuBar(), "FileMenu");
fileMenu->insertItem(SmallIcon("filesave"), i18n("&Save (Formatted)"), this, SLOT(saveHTML()),
ALT+Key_S );
fileMenu->insertItem(SmallIcon("filesave"), i18n("S&ave (Unformatted)"), this, SLOT(saveText()), ALT+Key_A );
fileMenu->insertItem( i18n("&Close"), this, SLOT(quit()) );
menuBar()->insertItem( i18n("&File"), fileMenu );
KPopupMenu* editMenu = new KPopupMenu(menuBar(), "EditMenu");
editMenu->insertItem(SmallIcon("editcopy"), i18n("&Copy"), this, SLOT(copy()), CTRL+Key_C );
editMenu->insertItem(SmallIcon("editcut"), i18n("C&ut"), this, SLOT(cut()), CTRL+Key_X );
editMenu->insertItem(SmallIcon("editpaste"), i18n("&Paste"), this, SLOT(paste()), CTRL+Key_V );
menuBar()->insertItem( i18n("&Edit"), editMenu);
#if 0
KPopupMenu* buddyMenu = new KPopupMenu(menuBar(), "BuddyMenu");
buddyMenu->insertItem("&Profile",this,SLOT(profile()),CTRL+Key_P);
menuBar()->insertItem("&Buddy", buddyMenu);
KPopupMenu viewMenu = new KPopupMenu(menuBar, "ViewMenu");
menuBar->insertItem("&View", viewMenu);
KPopupMenu insertMenu = new KPopupMenu(menuBar, "InsertMenu");
menuBar->insertItem("&Insert", insertMenu);
KPopupMenu insertFaceMenu = new KPopupMenu(insertMenu, "FaceMenu");
KPopupMenu helpMenu = new KPopupMenu(kmenuBar, "HelpMenu");
menuBar->insertItem("&Help", helpMenu);
#endif
} // initMenuBar