本文整理汇总了C++中KMenu::popup方法的典型用法代码示例。如果您正苦于以下问题:C++ KMenu::popup方法的具体用法?C++ KMenu::popup怎么用?C++ KMenu::popup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KMenu
的用法示例。
在下文中一共展示了KMenu::popup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showTagContextMenu
void NepomukWidget::showTagContextMenu(const QString& tag)
{
m_currentTag = tag;
KMenu *popup = new KMenu(this);
if (m_nepHandler->tags().contains(tag))
{
QAction *removeAction = popup->addAction(KIcon("list-remove"), i18n("Remove Tag"));
connect(removeAction, SIGNAL(triggered()), SLOT(removeCurrentTag()));
popup->popup(QCursor::pos());
}
else
{
QAction *addAction = popup->addAction(KIcon("list-add"), i18n("Add Tag"));
connect(addAction, SIGNAL(triggered()), SLOT(addCurrentTag()));
popup->popup(QCursor::pos());
}
}
示例2: contextMenu
void KBookmarkBar::contextMenu(const QPoint & pos)
{
KBookmarkActionInterface * action = dynamic_cast<KBookmarkActionInterface *>( m_toolBar->actionAt(pos) );
if(!action)
{
//Show default (ktoolbar) menu
m_toolBar->setContextMenuPolicy( Qt::DefaultContextMenu );
//Recreate event with the same position
QContextMenuEvent evt( QContextMenuEvent::Other, pos );
QCoreApplication::sendEvent( m_toolBar, &evt );
//Reassign custom context menu
m_toolBar->setContextMenuPolicy( Qt::CustomContextMenu );
}
else
{
KMenu * menu = new KonqBookmarkContextMenu(action->bookmark(), m_pManager, m_pOwner);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->popup(m_toolBar->mapToGlobal(pos));
}
}
示例3: mousePressEvent
void mousePressEvent(QMouseEvent *)
{
menu->popup(QCursor::pos());
}