Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    QGLWidget and keyPressEvent

    General and Desktop
    3
    3
    5212
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      abroadcom.hk last edited by

      Η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?

      1 Reply Last reply Reply Quote 0
      • G
        goetz last edited by

        Looks like some #includes are missing.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply Reply Quote 0
        • R
          rokemoon last edited by

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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post