[Qt-interest] Problem using QEvent::KeyPress

Ann Marie annmarieqt at gmail.com
Tue Mar 24 19:30:31 CET 2009


In my application, I have the following function implemented:  It does not
recognize the KeyPress - I get a build error: error: expected unqualified-id
before numeric constant

It recognizes other QEvents

bool PrefDlg::eventFilter(
    QObject*     pObject,
    QEvent*     pEvent )
{
    bool fHandled( false );

    switch ( pEvent->type( ) )
    {
        case QEvent::WindowActivate:
            {
                QPushButton* button = m_pCancelButton;
                if (NULL != button)
                {
                    button->setFocus();
                }
            }
        break;
        case QEvent::KeyPress:
            {
                switch ( ((QKeyEvent *)pEvent)->key( ) )
                {
                case Qt::Key_F3:
                    fHandled = handleF3( pObject );
                    break;

                case Qt::Key_F4:
                    fHandled = handleF4( pObject );
                    break;

                default:
                    break;
                }
            }
            break;

                case QEvent::Hide:
                    break;

        default:
            fHandled = false;
            break;
    }

    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090324/5fdf12ef/attachment.html 


More information about the Qt-interest-old mailing list