本文整理汇总了C++中KPopupMenu类的典型用法代码示例。如果您正苦于以下问题:C++ KPopupMenu类的具体用法?C++ KPopupMenu怎么用?C++ KPopupMenu使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KPopupMenu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Q_UNUSED
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 {
示例2: KPopupMenu
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;
}
示例3: showPopup
void ServiceLoader::showPopup(const QString &popup, const QPoint &point)
{
KPopupMenu *p = popups[popup];
if(p){
p->exec(point);
}
}
示例4: DCOPObject
knazar::knazar()
: DCOPObject( "DCOPNazarIface" ), KSystemTray( 0, "knazar" )
{
// Insert TrayIcon
trayIcon = KSystemTray::loadIcon( "knazar" );
setPixmap( trayIcon );
// Initialize and Register KNazar DCOP Interface so any KDE program can make Nazar easily
if ( !kapp->dcopClient()->isRegistered() )
{
kapp->dcopClient()->registerAs( "knazar" );
kapp->dcopClient()->setDefaultObject( objId() );
}
// Build PopupMenu
KPopupMenu* menu = contextMenu();
( new KAction( i18n( "Protect" ), "ledgreen", 0, this, SLOT( protect_from_harmfull_looks() ), this ) )->plug( menu );
( new KAction( i18n( "Release" ), "ledred", 0, this, SLOT( release_the_protection() ), this ) )->plug( menu );
menu->insertSeparator();
( new KAction( i18n( "About" ), "about", 0, this, SLOT( about() ), this ) )->plug( menu );
// Initialize variables
protection_working = true;
number_of_attacks = defated_attacks = 0;
QToolTip::add( this, i18n( "knazar - No Harmfull look allowed!" ));
}
示例5: 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);
}
示例6: 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());
}
示例7: showContextMenu
void MDWEnum::showContextMenu()
{
if( m_mixerwidget == NULL )
return;
KPopupMenu *menu = m_mixerwidget->getPopup();
QPoint pos = QCursor::pos();
menu->popup( pos );
}
示例8: KPopupMenu
KPopupMenu *ClassToolWidget::createPopup()
{
KPopupMenu *popup = contextItem? contextItem->createPopup() : 0;
if (!popup) {
popup = new KPopupMenu(this);
popup->insertTitle(i18n("Class Tool"));
}
return popup;
}
示例9: mouseLeave
void KasLoadItem::showMenuAt( QPoint p )
{
mouseLeave();
kasbar()->updateMouseOver();
KasTasker *bar = dynamic_cast<KasTasker *> (KasItem::kasbar());
if ( !bar )
return;
KPopupMenu *menu = bar->contextMenu();
menu->exec( p );
}
示例10: popupMenu
void GrepViewWidget::popupMenu(QListBoxItem*, const QPoint& p)
{
if(m_curOutput->isRunning()) return;
KPopupMenu rmbMenu;
if(KAction *findAction = m_part->actionCollection()->action("edit_grep"))
{
rmbMenu.insertTitle(i18n("Find in Files"));
findAction->plug(&rmbMenu);
rmbMenu.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: mainWidget
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);
}
示例13: KPopupMenu
void HistoryDialog::slotRightClick(const QString &url, const QPoint &point)
{
KPopupMenu *chatWindowPopup = 0L;
chatWindowPopup = new KPopupMenu();
if ( !url.isEmpty() )
{
mURL = url;
mCopyURLAct->plug( chatWindowPopup );
chatWindowPopup->insertSeparator();
}
mCopyAct->setEnabled( mHtmlPart->hasSelection() );
mCopyAct->plug( chatWindowPopup );
connect( chatWindowPopup, SIGNAL( aboutToHide() ), chatWindowPopup, SLOT( deleteLater() ) );
chatWindowPopup->popup(point);
}
示例14: changeAnalyzer
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: helpMenu
void KSlovar::addMenu()
{
KPopupMenu * filemenu = new KPopupMenu;
m_newDictionary->plug(filemenu);
m_openDictionary->plug(filemenu);
filemenu->insertSeparator();
m_print->plug(filemenu);
filemenu->insertSeparator();
m_close->plug(filemenu);
m_quit->plug(filemenu);
KPopupMenu *editmenu=new KPopupMenu;
m_editDictionary->plug(editmenu);
m_selectAll->plug(editmenu);
editmenu->insertSeparator();
m_addPhrase->plug(editmenu);
m_editPhrase->plug(editmenu);
m_removePhrase->plug(editmenu);
editmenu->insertSeparator();
m_find->plug(editmenu);
m_findNext->plug(editmenu);
m_literalSearch->plug(editmenu);
m_backSearch->plug(editmenu);
KPopupMenu *gomenu=new KPopupMenu;
m_back->plug(gomenu);
m_forward->plug(gomenu);
m_home->plug(gomenu);
KPopupMenu *setmenu=new KPopupMenu;
m_config->plug(setmenu);
m_conversion->plug(setmenu);
m_update->plug(setmenu);
m_wizard->plug(setmenu);
KPopupMenu *help = helpMenu();
KMenuBar * menu = menuBar();
menu->insertItem( i18n( "&File" ), filemenu );
menu->insertItem(i18n("&Edit"), editmenu);
menu->insertItem(i18n("&Go"), gomenu);
menu->insertItem(i18n("&Settings"), setmenu);
menu->insertItem( i18n( "&Help" ), help );
}