Qt Forum

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

    Update: Forum Guidelines & Code of Conduct

    Using Mouseevent together with Keypressedevents with OPENGL&QT

    Game Development
    2
    2
    1380
    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.
    • U
      uauaua last edited by

      Hello,

      has anybody an idea how can use the "Mousemove event" together with an "Keypress event" for example "Z"-key to change the viewport settings.

      I am using the following example (glwidget.cpp Example File):
      @
      void GLWidget::resizeGL(int width, int height) {
      int side = qMin(width, height);
      glViewport((width - side) / 2, (height - side) / 2, side, side);

       glMatrixMode(GL_PROJECTION);
       glLoadIdentity();
       glFrustum(-1.0, +1.0, -1.0, 1.0, near, far);
       glMatrixMode(GL_MODELVIEW);
       glLoadIdentity();
       glTranslated(0.0, 0.0, -40.0);
      

      }@

      The aim of this (for me frustating) game is to change the to variable "far" and or "near" in an similar mode like in CAD-Systems. a mouse move together with a pressed key.

      Thank you for your help

      1 Reply Last reply Reply Quote 0
      • K
        koahnig last edited by

        welcome to devnet

        Please use "code wrapping":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01 for your code sections nect time. I have introduced them for you.

        Vote the answer(s) that helped you to solve your issue(s)

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