QGLWidget and keyPressEvent



  • Ηi,
    The code that follows responds for keyboad and adjust the size of window

    but in
    @
    NeHeWidget::NeHeWidget( QWidget* parent, const char* name, bool fs )
    : QGLWidget( parent, name )
    {
    fullscreen = fs;
    setGeometry( 0, 0, 640, 480 );
    setCaption( "NeHe's OpenGL Framework" );

    if ( fullscreen )
    showFullScreen();
    }@
    NeHe is children of QGLwidget.
    QT Creator reports :no matching function for call to 'QGLWidget::QGLWidget(QWidget*&, const char*&)'
    and 'setCaption' was not declared in this scope.

    also in
    @
    void NeHeWidget::keyPressEvent( QKeyEvent *e )
    {
    switch ( e->key() )
    {
    case Qt::Key_F2:
    fullscreen = !fullscreen;
    if ( fullscreen )
    {
    showFullScreen();
    }
    else
    {
    showNormal();
    setGeometry( 0, 0, 640, 480 );
    }
    updateGL();
    break;
    case Qt::Key_Escape:
    close();
    }
    }
    @
    it reports invalid use of incomplete type 'struct QKeyEvent' and forward declaration of 'struct QKeyEvent'
    Is this because of the vesion of my QT?



  • Looks like some #includes are missing.



  • Do you include? @#include "NeHeWidget.h"@


Log in to reply
 

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