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 ); }
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); }
void MainWindow::showPopup() { popupTimer->stop(); if (!_currentItem) return; QPopupMenu *pop = _currentItem->popupMenu(); if (pop) pop->popup( QCursor::pos() ); }
void PackageListView::showPopup() { qDebug("PackageListView::showPopup"); QPopupMenu *popup = activeItem->getPopupMenu(); if (popup == 0) return; popup->popup( QCursor::pos() ); qDebug("PackageListView::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); }
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); }
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()); } }
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); } }
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); }
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); }
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); }
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)) ); } };
void StatusLabel::mousePressEvent(QMouseEvent *me) { if (me->button() == RightButton){ ProcessMenuParam mp; mp.id = m_id; mp.param = (void*)winId(); mp.key = 0; Event eMenu(EventProcessMenu, &mp); QPopupMenu *popup = (QPopupMenu*)eMenu.process(); if (popup){ QPoint pos = CToolButton::popupPos(this, popup); popup->popup(pos); } } }
void ListView::showPopup(QListViewItem *item, QPoint p) { if (item == NULL) return; ProcessMenuParam *mp = getMenu(item); if (mp == NULL) return; if (p.isNull()){ QRect rc = itemRect(item); p = QPoint(rc.x() + rc.width() / 2, rc.y() + rc.height() / 2); p = viewport()->mapToGlobal(p); } mp->key = 0; Event eMenu(EventProcessMenu, mp); QPopupMenu *menu = (QPopupMenu*)eMenu.process(); if (menu) menu->popup(p); }
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; }
void UserTabBar::mousePressEvent(QMouseEvent *e) { if (e->button() == RightButton){ QTab *t = selectTab(e->pos()); if (t == NULL) return; UserTab *tab = static_cast<UserTab*>(t); ProcessMenuParam mp; mp.id = MenuContact; mp.param = (void*)(tab->wnd()->id()); mp.key = 0; Event eMenu(EventProcessMenu, &mp); QPopupMenu *menu = (QPopupMenu*)eMenu.process(); if (menu) menu->popup(e->globalPos()); return; } QTabBar::mousePressEvent(e); }
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); }
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); }
void KSVGWidget::mousePressEvent(QMouseEvent *event) { if(event->state() & QMouseEvent::ControlButton) return; if(event->button() == RightButton) { if(part() && part()->factory()) { QPopupMenu *popup = static_cast<QPopupMenu *>(part()->factory()->container("popupmenu", part())); if(popup) popup->popup(event->globalPos()); } } KSVG::SVGMouseEventImpl *mev = newMouseEvent(KSVG::SVGEvent::MOUSEDOWN_EVENT, event); if(part()->docImpl() && part()->docImpl()->rootElement()) part()->docImpl()->rootElement()->prepareMouseEvent(event->pos(), event->pos(), mev); mev->deref(); }
void FLConnectDBDialog::popupMarks() { QPopupMenu *marks = new QPopupMenu(this, "marks"); QActionGroup *ag = new QActionGroup(this, 0); QSignalMapper *marksMapper = new QSignalMapper(this); connect(marksMapper, SIGNAL(mapped(const QString &)), this, SLOT(tryConnectMark(const QString &))); QStringList list; for (int i = 0; i < comboBoxMarks->count(); i++) list << comboBoxMarks->text(i); list.sort(); QDict < int >marksDict(17, false); for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) { QString marksStr = *it; QString marksAccel = marksStr; if (marksDict[ marksAccel.left(1)]) { for (uint i = 0; i < marksAccel.length(); i++) { if (!marksDict[ marksAccel.mid(i, 1)]) { marksDict.insert(marksAccel.mid(i, 1), (const int *) 1); marksAccel = marksAccel.insert(i, '&'); break; } } } else { marksDict.insert(marksAccel.left(1), (const int *) 1); marksAccel = "&" + marksAccel; } QAction *a = new QAction(marksStr, QIconSet(), marksAccel, 0, ag, 0, ag->isExclusive()); connect(a, SIGNAL(activated()), marksMapper, SLOT(map())); marksMapper->setMapping(a, a->text()); } ag->addTo(marks); marks->setPalette(palette()); marks->popup(QCursor::pos()); }
void DOMTreeView::showDOMTreeContextMenu(QListViewItem */*lvi*/, const QPoint &pos, int /*col*/) { QPopupMenu *ctx = mainWindow()->domTreeViewContextMenu(); Q_ASSERT(ctx); ctx->popup(pos); }