Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGLWidget and keyPressEvent
Forum Update on Tuesday, May 27th 2025

QGLWidget and keyPressEvent

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 5.5k Views 1 Watching
  • 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 Offline
    A Offline
    abroadcom.hk
    wrote on last edited by
    #1

    Η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
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      Looks like some #includes are missing.

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

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rokemoon
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved