bool QWidgetWindow::event(QEvent *event) { if (!m_widget) return QWindow::event(event); if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) { // \a event is uninteresting for QWidgetWindow, the event was probably // generated before WA_DontShowOnScreen was set if (!shouldBePropagatedToWidget(event)) return true; return QCoreApplication::sendEvent(m_widget, event); } switch (event->type()) { case QEvent::Close: handleCloseEvent(static_cast<QCloseEvent *>(event)); return true; case QEvent::Enter: case QEvent::Leave: handleEnterLeaveEvent(event); return true; // these should not be sent to QWidget, the corresponding events // are sent by QApplicationPrivate::notifyActiveWindowChange() case QEvent::FocusIn: handleFocusInEvent(static_cast<QFocusEvent *>(event)); // Fallthrough case QEvent::FocusOut: { #ifndef QT_NO_ACCESSIBILITY QAccessible::State state; state.active = true; QAccessibleStateChangeEvent ev(m_widget, state); QAccessible::updateAccessibility(&ev); #endif return false; } case QEvent::FocusAboutToChange: if (QApplicationPrivate::focus_widget) { if (QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled)) QGuiApplication::inputMethod()->commit(); QGuiApplication::sendSpontaneousEvent(QApplicationPrivate::focus_widget, event); } return true; case QEvent::KeyPress: case QEvent::KeyRelease: case QEvent::ShortcutOverride: handleKeyEvent(static_cast<QKeyEvent *>(event)); return true; case QEvent::MouseMove: case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: handleMouseEvent(static_cast<QMouseEvent *>(event)); return true; case QEvent::NonClientAreaMouseMove: case QEvent::NonClientAreaMouseButtonPress: case QEvent::NonClientAreaMouseButtonRelease: case QEvent::NonClientAreaMouseButtonDblClick: handleNonClientAreaMouseEvent(static_cast<QMouseEvent *>(event)); return true; case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: case QEvent::TouchCancel: handleTouchEvent(static_cast<QTouchEvent *>(event)); return true; case QEvent::Move: handleMoveEvent(static_cast<QMoveEvent *>(event)); return true; case QEvent::Resize: handleResizeEvent(static_cast<QResizeEvent *>(event)); return true; #ifndef QT_NO_WHEELEVENT case QEvent::Wheel: handleWheelEvent(static_cast<QWheelEvent *>(event)); return true; #endif #ifndef QT_NO_DRAGANDDROP case QEvent::DragEnter: case QEvent::DragMove: handleDragEnterMoveEvent(static_cast<QDragMoveEvent *>(event)); return true; case QEvent::DragLeave: handleDragLeaveEvent(static_cast<QDragLeaveEvent *>(event)); return true; case QEvent::Drop: handleDropEvent(static_cast<QDropEvent *>(event)); return true; #endif case QEvent::Expose: handleExposeEvent(static_cast<QExposeEvent *>(event)); return true; case QEvent::WindowStateChange: handleWindowStateChangedEvent(static_cast<QWindowStateChangeEvent *>(event)); return true; case QEvent::ThemeChange: { QEvent widgetEvent(QEvent::ThemeChange); QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent); } return true; #ifndef QT_NO_TABLETEVENT case QEvent::TabletPress: case QEvent::TabletMove: case QEvent::TabletRelease: handleTabletEvent(static_cast<QTabletEvent *>(event)); return true; #endif #ifndef QT_NO_GESTURES case QEvent::NativeGesture: handleGestureEvent(static_cast<QNativeGestureEvent *>(event)); return true; #endif #ifndef QT_NO_CONTEXTMENU case QEvent::ContextMenu: handleContextMenuEvent(static_cast<QContextMenuEvent *>(event)); return true; #endif case QEvent::WindowBlocked: qt_button_down = 0; break; case QEvent::UpdateRequest: // This is not the same as an UpdateRequest for a QWidget. That just // syncs the backing store while here we also must mark as dirty. m_widget->repaint(); return true; default: break; } if (shouldBePropagatedToWidget(event) && QCoreApplication::sendEvent(m_widget, event)) return true; return QWindow::event(event); }
void KexiFrame::dropEvent(QDropEvent *e) { QFrame::dropEvent(e); emit handleDropEvent(e); }