Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGLWidget and keyPressEvent
Qt 6.12 LTS is out! See what's new in the release blog

QGLWidget and keyPressEvent

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 6.2k 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.
  • ? Offline
    ? Offline
    A Former User
    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
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Looks like some #includes are missing.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        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
        • Unsolved