本文整理汇总了C++中QPopupMenu::popup方法的典型用法代码示例。如果您正苦于以下问题:C++ QPopupMenu::popup方法的具体用法?C++ QPopupMenu::popup怎么用?C++ QPopupMenu::popup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPopupMenu
的用法示例。
在下文中一共展示了QPopupMenu::popup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotRightClick
void ClassMainWindow::slotRightClick( QListViewItem *, const QPoint &pos, int )
{
QPopupMenu *menu = new QPopupMenu( this );
menu->insertItem( i18n( "&Add" ), this, SLOT(slotAdd()) );
menu->insertItem( i18n( "&Remove" ), this, SLOT(slotRemove()) );
menu->popup( pos );
}
示例2: mousePressEvent
void UserTabBar::mousePressEvent(QMouseEvent *e)
{
if (e->button() == RightButton){
QTab *t = selectTab(e->pos());
if (t == NULL) return;
UserTab *tab = static_cast<UserTab*>(t);
EventMenuProcess eMenu(MenuContact, (void*)tab->wnd()->id());
eMenu.process();
QPopupMenu *menu = eMenu.menu();
if (menu)
menu->popup(e->globalPos());
return;
}
if (e->button() == MidButton){
//Close tab on middle button pressed
QTab *t = selectTab(e->pos());
if (t == NULL) return;
UserTab *tab = static_cast<UserTab*>(t);
Command cmd;
cmd->id = CmdClose;
cmd->param = (void*)tab->wnd()->id();
EventCommandExec(cmd).process();
}
QTabBar::mousePressEvent(e);
}
示例3: showPopup
void MainWindow::showPopup()
{
popupTimer->stop();
if (!_currentItem)
return;
QPopupMenu *pop = _currentItem->popupMenu();
if (pop) pop->popup( QCursor::pos() );
}
示例4: showPopup
void PackageListView::showPopup()
{
qDebug("PackageListView::showPopup");
QPopupMenu *popup = activeItem->getPopupMenu();
if (popup == 0) return;
popup->popup( QCursor::pos() );
qDebug("PackageListView::showPopup");
}
示例5: showPopup
void FloatyPlugin::showPopup()
{
ProcessMenuParam mp;
mp.id = MenuContact;
mp.param = (void*)(popupId);
mp.key = 0;
Event eMenu(EventProcessMenu, &mp);
QPopupMenu *menu = (QPopupMenu*)eMenu.process();
menu->popup(popupPos);
}
示例6: popupDirectoryAdd
void GofunWidget::popupDirectoryAdd()
{
QPopupMenu* popup = new QPopupMenu(this);
connect(popup,SIGNAL(activated(int)),this,SLOT(popupCAActivated(int)));
popup->insertItem(tr("Add Directory"),PID_Add_Directory);
int x = pos().x()+cats_bg->pos().x()+cats_bg->find(0)->pos().x()+cats_bg->find(0)->width();
int y = QCursor::pos().y();
QPoint pos(x,y);
popup->popup(pos);
}
示例7: mousePressEvent
void StatusFrame::mousePressEvent(QMouseEvent *me)
{
if (me->button() == RightButton){
Command cmd;
cmd->id = MenuConnections;
Event e(EventGetMenu, &cmd);
QPopupMenu *popup = (QPopupMenu*)(e.process());
if (popup)
popup->popup(me->globalPos());
}
}
示例8: clicked
void StatusWnd::clicked()
{
Command cmd;
cmd->popup_id = MenuStatusWnd;
cmd->flags = COMMAND_NEW_POPUP;
Event e(EventGetMenu, cmd);
QPopupMenu *popup = (QPopupMenu*)(e.process());
if (popup){
QPoint pos = CToolButton::popupPos(m_btn, popup);
popup->popup(pos);
}
}
示例9: popup
void KAddressBookView::popup(const QPoint &point)
{
if(!mCore->guiClient())
{
kdWarning() << "No GUI client set!" << endl;
return;
}
QPopupMenu *menu = static_cast<QPopupMenu *>(mCore->guiClient()->factory()->container("RMBPopup",
mCore->guiClient()));
if(menu)
menu->popup(point);
}
示例10: mousePressEvent
void SEQWindow::mousePressEvent(QMouseEvent* e)
{
if (e->button() == RightButton)
{
QPopupMenu* popupMenu = menu();
if (popupMenu)
popupMenu->popup(mapToGlobal(e->pos()));
else
QDockWindow::mousePressEvent(e);
}
else
QDockWindow::mousePressEvent(e);
}
示例11: eventFilter
bool ShortcutsPlugin::eventFilter(QObject *o, QEvent *e)
{
unsigned button = 0;
QMouseEvent *me = NULL;
if (e->type() == QEvent::MouseButtonPress) {
me = static_cast<QMouseEvent*>(e);
switch (me->button()) {
case LeftButton:
button = 1;
break;
case RightButton:
button = 2;
break;
case MidButton:
button = 3;
break;
default:
break;
}
}
if (e->type() == QEvent::MouseButtonDblClick) {
me = static_cast<QMouseEvent*>(e);
switch (me->button()) {
case LeftButton:
button = 4;
break;
case RightButton:
button = 5;
break;
case MidButton:
button = 6;
break;
default:
break;
}
}
if (me) {
button |= me->state() & (AltButton | ControlButton | ShiftButton);
MAP_CMDS::iterator it = mouseCmds.find(button);
if (it != mouseCmds.end()) {
const CommandDef &cmd = (*it).second;
Event e(EventGetMenu, (void*)&cmd);
QPopupMenu *popup = (QPopupMenu*)(e.process());
if (popup) {
popup->popup(me->globalPos());
return true;
}
}
}
return QObject::eventFilter(o, e);
}
示例12: slotPlotMouseClick
void ClsFEGroupPlot::slotPlotMouseClick(QEvent::Type /* qeventtype */, QPoint /* qpointPos */, int iButton, int /* iState */){
#ifdef DEBUG_CLSFEGROUPPLOT
cout << "ClsFEGroupPlot::slotPlotMouseClick(QEvent::Type qeventtype, QPoint qpointPos, int iButton, int iState)" << endl;
#endif
if(iButton == 2){
QPopupMenu *menuBrowser = new QPopupMenu( this );
menuBrowser->insertItem( "Time Plot", MENU_TIME_PLOT, -1 );
menuBrowser->popup( this->cursor().pos() );
connect( menuBrowser, SIGNAL(activated(int)), SLOT(slotPlotMenu(int)) );
}
};
示例13: eventFilter
bool KMix::eventFilter(QObject *o, QEvent *e)
{
// Lets see, if we have a "Right mouse button press"
if (e->type() == Event_MouseButtonPress) {
QMouseEvent *qme = (QMouseEvent*)e;
if (qme->button() == RightButton) {
QPopupMenu *qpm = contextMenu(o,0);
if (qpm) {
KCMpopup_point = QCursor::pos();
qpm->popup(KCMpopup_point);
return true;
}
}
}
return false;
}
示例14: contextMenuRequested
void ResourceView::contextMenuRequested(QListViewItem *i,
const QPoint &pos, int)
{
KCal::CalendarResourceManager *manager = mCalendar->resourceManager();
ResourceItem *item = static_cast<ResourceItem *>(i);
QPopupMenu *menu = new QPopupMenu(this);
connect(menu, SIGNAL(aboutToHide()), menu, SLOT(deleteLater()));
if(item)
{
int reloadId = menu->insertItem(i18n("Re&load"), this,
SLOT(reloadResource()));
menu->setItemEnabled(reloadId, item->resource()->isActive());
int saveId = menu->insertItem(i18n("&Save"), this,
SLOT(saveResource()));
menu->setItemEnabled(saveId, item->resource()->isActive());
menu->insertSeparator();
menu->insertItem(i18n("Show &Info"), this, SLOT(showInfo()));
//FIXME: This is better on the resource dialog
if(KOPrefs::instance()->agendaViewColors() != KOPrefs::CategoryOnly)
{
QPopupMenu *assignMenu = new QPopupMenu(menu);
assignMenu->insertItem(i18n("&Assign Color"), this, SLOT(assignColor()));
if(item->resourceColor().isValid())
assignMenu->insertItem(i18n("&Disable Color"), this, SLOT(disableColor()));
menu->insertItem(i18n("Resources Colors"), assignMenu);
}
menu->insertItem(i18n("&Edit..."), this, SLOT(editResource()));
menu->insertItem(i18n("&Remove"), this, SLOT(removeResource()));
if(item->resource() != manager->standardResource())
{
menu->insertSeparator();
menu->insertItem(i18n("Use as &Default Calendar"), this,
SLOT(setStandard()));
}
menu->insertSeparator();
}
menu->insertItem(i18n("&Add..."), this, SLOT(addResource()));
menu->popup(pos);
}
示例15: canvasRightClick
void ItemDocument::canvasRightClick(const QPoint &pos, QCanvasItem* item) {
if (item) {
if (dynamic_cast<CNItem*>(item) &&
!item->isSelected()) {
unselectAll();
select(item);
}
}
KTechlab::self()->unplugActionList("alignment_actionlist");
KTechlab::self()->unplugActionList("orientation_actionlist");
fillContextMenu(pos);
QPopupMenu *pop = static_cast<QPopupMenu*>(KTechlab::self()->factory()->container("item_popup", KTechlab::self()));
if (!pop) return;
pop->popup(pos);
}