WidgetBox::WidgetBox(QDesignerFormEditorInterface *core, QWidget *parent, Qt::WindowFlags flags) : QDesignerWidgetBox(parent, flags), m_core(core), m_view(new WidgetBoxTreeWidget(m_core)) { QVBoxLayout *l = new QVBoxLayout(this); l->setMargin(0); l->setSpacing(0); // Prevent the filter from grabbing focus since Our view has Qt::NoFocus QToolBar *toolBar = new QToolBar(this); QLineEdit *filterWidget = new WidgetBoxFilterLineEdit(toolBar); filterWidget->setPlaceholderText(tr("Filter")); filterWidget->setClearButtonEnabled(true); connect(filterWidget, SIGNAL(textChanged(QString)), m_view, SLOT(filter(QString))); toolBar->addWidget(filterWidget); l->addWidget(toolBar); // View connect(m_view, SIGNAL(pressed(QString,QString,QPoint)), this, SLOT(handleMousePress(QString,QString,QPoint))); l->addWidget(m_view); setAcceptDrops (true); }
void game::handleEvents ( ) { bool bShouldClear_ses = false; sf::Event eventToHandle; while (m_rw.pollEvent (eventToHandle)) { if (bShouldClear_ses) { //DO NOTHING. Event is void and event queue must be cleared. } else { sf::Event::EventType eventtypeToHandle = eventToHandle.type; switch (eventtypeToHandle) { case sf::Event::Closed: { m_gameaction = gameaction::Exit; bShouldClear_ses = true; break; } case sf::Event::MouseButtonPressed: { handleMousePress (eventToHandle); break; } case sf::Event::MouseButtonReleased: { handleMouseRelease (bShouldClear_ses, eventToHandle); break; } case sf::Event::TextEntered: { handleTextEntered (bShouldClear_ses, eventToHandle); break; } } if (bShouldClear_ses) { clear (m_ses); m_bPrepared_ses = false; } } } }
WidgetBox::WidgetBox(QDesignerFormEditorInterface *core, QWidget *parent, Qt::WindowFlags flags) : QDesignerWidgetBox(parent, flags), m_core(core), m_view(new WidgetBoxTreeWidget(m_core)) { QVBoxLayout *l = new QVBoxLayout(this); l->setMargin(0); l->setSpacing(0); // Prevent the filter from grabbing focus since Our view has Qt::NoFocus FilterWidget *filterWidget = new FilterWidget(0, FilterWidget::LayoutAlignNone); filterWidget->setRefuseFocus(true); connect(filterWidget, SIGNAL(filterChanged(QString)), m_view, SLOT(filter(QString))); QToolBar *toolBar = new QToolBar(this); toolBar->addWidget(filterWidget); l->addWidget(toolBar); // View connect(m_view, SIGNAL(pressed(QString,QString,QPoint)), this, SLOT(handleMousePress(QString,QString,QPoint))); l->addWidget(m_view); setAcceptDrops (true); }
void update_input() { while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_KEYDOWN: handleKeyPress(&event.key.keysym); break; case SDL_MOUSEMOTION: handleMouseMove(&event.motion); break; case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: handleMousePress(); break; case SDL_QUIT: done = TRUE; break; default: break; } } handleKeyDown(); if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT)) mouse_left(); if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT)) mouse_right(); }
bool PlaceableWindowProxy::eventFilter(QObject *, QEvent *event) { // This should never happen, but doesn't hurt to be defensive. if (!target_) { return false; } if (!visible_) { return false; } switch (event->type()) { case QEvent::MouseButtonPress: return handleMousePress(static_cast<QMouseEvent*>(event)); case QEvent::MouseButtonRelease: return handleMouseRelease(static_cast<QMouseEvent*>(event)); case QEvent::MouseMove: return handleMouseMove(static_cast<QMouseEvent*>(event)); case QEvent::Resize: return handleResize(static_cast<QResizeEvent*>(event)); default: return false; } }
bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent) { bool handled = false; if (isEmpty()) return false; if (WebInputEvent::isGestureEventType(inputEvent.type) && inputEvent.type == WebInputEvent::GestureTap) { // Only let GestureTab in (we only need it and we know PlatformGestureEventBuilder supports it). PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder(m_webViewImpl->mainFrameImpl()->frameView(), static_cast<const WebGestureEvent&>(inputEvent)); handled = handleGestureEvent(gestureEvent); if (handled) return true; overlayMainFrame()->eventHandler().handleGestureEvent(gestureEvent); } if (WebInputEvent::isMouseEventType(inputEvent.type) && inputEvent.type != WebInputEvent::MouseEnter) { // PlatformMouseEventBuilder does not work with MouseEnter type, so we filter it out manually. PlatformMouseEvent mouseEvent = PlatformMouseEventBuilder(m_webViewImpl->mainFrameImpl()->frameView(), static_cast<const WebMouseEvent&>(inputEvent)); if (mouseEvent.type() == PlatformEvent::MouseMoved) handled = handleMouseMove(mouseEvent); else if (mouseEvent.type() == PlatformEvent::MousePressed) handled = handleMousePress(); if (handled) return true; if (mouseEvent.type() == PlatformEvent::MouseMoved) handled = overlayMainFrame()->eventHandler().handleMouseMoveEvent(mouseEvent) != WebInputEventResult::NotHandled; if (mouseEvent.type() == PlatformEvent::MousePressed) handled = overlayMainFrame()->eventHandler().handleMousePressEvent(mouseEvent) != WebInputEventResult::NotHandled; if (mouseEvent.type() == PlatformEvent::MouseReleased) handled = overlayMainFrame()->eventHandler().handleMouseReleaseEvent(mouseEvent) != WebInputEventResult::NotHandled; } if (WebInputEvent::isTouchEventType(inputEvent.type)) { PlatformTouchEvent touchEvent = PlatformTouchEventBuilder(m_webViewImpl->mainFrameImpl()->frameView(), static_cast<const WebTouchEvent&>(inputEvent)); handled = handleTouchEvent(touchEvent); if (handled) return true; overlayMainFrame()->eventHandler().handleTouchEvent(touchEvent); } if (WebInputEvent::isKeyboardEventType(inputEvent.type)) { PlatformKeyboardEvent keyboardEvent = PlatformKeyboardEventBuilder(static_cast<const WebKeyboardEvent&>(inputEvent)); overlayMainFrame()->eventHandler().keyEvent(keyboardEvent); } if (inputEvent.type == WebInputEvent::MouseWheel) { PlatformWheelEvent wheelEvent = PlatformWheelEventBuilder(m_webViewImpl->mainFrameImpl()->frameView(), static_cast<const WebMouseWheelEvent&>(inputEvent)); handled = overlayMainFrame()->eventHandler().handleWheelEvent(wheelEvent) != WebInputEventResult::NotHandled; } return handled; }
bool UIToolsHandlerMouse::handle(QGraphicsSceneMouseEvent *pEvent, UIMouseEventType enmType) const { /* Process passed event: */ switch (enmType) { case UIMouseEventType_Press: return handleMousePress(pEvent); case UIMouseEventType_Release: return handleMouseRelease(pEvent); } /* Pass event if unknown: */ return false; }
bool UIGChooserHandlerMouse::handle(QGraphicsSceneMouseEvent *pEvent, UIMouseEventType type) const { /* Process passed event: */ switch (type) { case UIMouseEventType_Press: return handleMousePress(pEvent); case UIMouseEventType_Release: return handleMouseRelease(pEvent); case UIMouseEventType_DoubleClick: return handleMouseDoubleClick(pEvent); } /* Pass event if unknown: */ return false; }
bool ScTreeWidget::event(QEvent *e) { if (e->type() == QEvent::Shortcut) { QShortcutEvent *se = static_cast<QShortcutEvent *>(e); if (se != NULL) { int k = se->shortcutId(); QTreeWidgetItem *item1 = keySList.value(k); handleMousePress(item1); return true; } } return QTreeWidget::event(e); }
void CSliderMultiPos::mousePressEvent(QMouseEvent* event){ int elemIndex; if( minimum()==maximum() || (event->buttons()^event->button()) ){ event->ignore(); return; } previousMousePos = event->globalPos(); for(elemIndex=0;elemIndex<nbValues();elemIndex++){ if( handleMousePress( event->pos(), handles.at(elemIndex).getPressed(), minimum(),elemIndex ) ){ break; } } event->accept(); }
void PopupMenu::init() { _menu->setResizedCallback([this] { handleMenuResize(); }); _menu->setActivatedCallback([this](QAction *action, int actionTop, TriggeredSource source) { handleActivated(action, actionTop, source); }); _menu->setTriggeredCallback([this](QAction *action, int actionTop, TriggeredSource source) { handleTriggered(action, actionTop, source); }); _menu->setKeyPressDelegate([this](int key) { return handleKeyPress(key); }); _menu->setMouseMoveDelegate([this](QPoint globalPosition) { handleMouseMove(globalPosition); }); _menu->setMousePressDelegate([this](QPoint globalPosition) { handleMousePress(globalPosition); }); _menu->setMouseReleaseDelegate([this](QPoint globalPosition) { handleMouseRelease(globalPosition); }); handleCompositingUpdate(); setWindowFlags(Qt::WindowFlags(Qt::FramelessWindowHint) | Qt::BypassWindowManagerHint | Qt::Popup | Qt::NoDropShadowWindowHint); setMouseTracking(true); hide(); setAttribute(Qt::WA_NoSystemBackground, true); setAttribute(Qt::WA_TranslucentBackground, true); }
void Menu::mousePressEvent(QMouseEvent *e) { handleMousePress(e->globalPos()); }
void MenuWindowManager::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) { handleMousePress(event, 2); }
void MenuWindowManager::mousePressEvent(QGraphicsSceneMouseEvent* event) { handleMousePress(event, 1); }