The return value of QAxNativeEventFilter::nativeEventFilter



  • @bool QAxNativeEventFilter::nativeEventFilter(const QByteArray &, void *m, long *)
    {
    MSG msg = (MSG)m;
    const uint message = msg->message;
    if ((message >= WM_MOUSEFIRST && message <= WM_MOUSELAST) || (message >= WM_KEYFIRST && message <= WM_KEYLAST)) {
    HWND hwnd = msg->hwnd;
    QAxWidget *ax = 0;
    QAxHostWidget host = 0;
    while (!host && hwnd) {
    // FIXME: 4.10.2011: Does this still work?
    QWidget widget = QWidget::find(reinterpret_cast<WId>(hwnd));
    if (widget && widget->inherits("QAxHostWidget"))
    host = qobject_cast<QAxHostWidget
    >(widget);
    hwnd = ::GetParent(hwnd);
    }
    if (host)
    ax = qobject_cast<QAxWidget
    >(host->parentWidget());
    if (ax && msg->hwnd != (HWND)host->winId()) {
    if (message >= WM_KEYFIRST && message <= WM_KEYLAST) {
    QAxClientSite *site = host->clientSite();
    site->eventTranslated = true; // reset in QAxClientSite::TranslateAccelerator
    HRESULT hres = S_FALSE;
    if (site && site->inPlaceObject() && site->translateKeyEvent(msg->message, msg->wParam))
    hres = site->inPlaceObject()->TranslateAccelerator(msg);
    // if the object calls our TranslateAccelerator implementation, then continue with normal event processing
    // otherwise the object has translated the accelerator, and the event should be stopped
    if (site->eventTranslated && hres == S_OK)
    return true;
    } else {
    int i;
    for (i = 0; (UINT)mouseTbl[i] != message && mouseTbl[i]; i += 3)
    ;

                if (mouseTbl[i]) {
                    QEvent::Type type = (QEvent::Type)mouseTbl[++i];
                    int button = mouseTbl[++i];
                    if (type != QEvent::MouseMove || ax->hasMouseTracking() || button) {
                        if (type == QEvent::MouseMove)
                            button = 0;
    
                        DWORD ol_pos = GetMessagePos();
                        QPoint gpos(GET_X_LPARAM(ol_pos), GET_Y_LPARAM(ol_pos));
                        QPoint pos = ax->mapFromGlobal(gpos);
    
                        QMouseEvent e(type, pos, gpos, (Qt::MouseButton)button,
                            translateMouseButtonState(msg->wParam),
                            translateModifierState(msg->wParam));
    
    •                    QApplication::sendEvent(ax, &e);*   // why dont renturn the result of this sendEvent?????
                    }
                }
            }
        }
      

      }

      return false;
      }@

    I want to filter the native mouse event, but the function doesnt return the a value according to the sendEvent, no one can make a event fileter for the mouse events in the QAxWidget~~~


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.