Results 1 to 4 of 4

Thread: Keyboard events in c + +

  1. #1
    Join Date
    Apr 2009
    Posts
    87

    Keyboard events in c + +

    I would like to recognize keyboards and mouse event, I have tried to include the sdl in my Qt project, but the problem is in the compilation: I'm writing
    Code:
    C + +  1 	  # include <SDL/SDL.h>
    the console gives me during compilation manual for Qt:
    Code:
    Console  main.cpp: 11:21: SDL / SDL.h: No such file or directory
    can someone explain me how to integrate SDL to a Qt project?

  2. #2
    Join Date
    May 2008
    Posts
    2,302

    Re: keyboard events in c + +

    Windows Forms provides several options for programmatically simulating mouse and keyboard input.Qt has its own event management,, we must reimplement the methods like:
    Code:
          cout << "Press key any key move " << endl;
          cin >> key;
          cout << "You pressed name of key : " << key << endl;
          system("PAUSE");
          return 0;

  3. #3
    Join Date
    Jan 2009
    Posts
    199

    Re: keyboard events in c + +

    Code:
     void QCloseEvent (QCloseEvent * event) 
      ( 
         QMessageBox:: information (this, "Closed", "Closing the program!"); 
         event -> accept (); 
      )
    You'll find a bunch of methods xx_event to manage all the events. The code will displays a dialog box when you close your window.

  4. #4
    Join Date
    Dec 2008
    Posts
    177

    Re: keyboard events in c + +

    You really should use third party libraries. There's definitely no platform-independent way to do it in ANSI C. Signal handling is not the way. Some C++ implementations reimplement the standard input stream seperatly from the C stdin stream.

Similar Threads

  1. All day events one day out
    By Steadfast in forum Portable Devices
    Replies: 4
    Last Post: 13-10-2010, 11:22 AM
  2. Why we use Events in JavaScript?
    By Samarth in forum Software Development
    Replies: 5
    Last Post: 30-01-2010, 08:15 PM
  3. Javascript Keyboard Events In Iframe
    By Henryosa in forum Software Development
    Replies: 5
    Last Post: 25-01-2010, 01:04 PM
  4. jQuery and several events
    By AZUL in forum Software Development
    Replies: 3
    Last Post: 28-09-2009, 04:19 PM
  5. EVENTS RECEIVED
    By Deabelos in forum Windows XP Support
    Replies: 5
    Last Post: 22-09-2008, 03:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •