Results 1 to 4 of 4

Thread: qwsEventFilter implementation

  1. #1
    Join Date
    Mar 2011
    Posts
    10
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanked 1 Time in 1 Post

    Default qwsEventFilter implementation

    I try to intercept keyboard events using qwsEventFilter. First of all I must mention that currently I use Qt-creator on X86 Ubuntu and may be this causes problems..

    What I did:
    myapp.h
    Qt Code:
    1. class MyApp : public QApplication
    2. {
    3. public:
    4. MyApp(int &argc, char **argv ) : QApplication( argc, argv ) {};
    5.  
    6. bool qwsEventFilter(QWSEvent * event);
    7. };
    To copy to clipboard, switch view to plain text mode 

    myapp.cpp
    Qt Code:
    1. #include "myapp.h"
    2.  
    3. bool MyApp::qwsEventFilter(QWSEvent *e)
    4. {
    5. if(e->type == QEvent::KeyPress) {
    6. qDebug("pressed");
    7. }
    8. else if (e->type == QEvent::KeyRelease ) {
    9. qDebug("released");
    10. }
    11. return false;
    12. }
    To copy to clipboard, switch view to plain text mode 

    main.c
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "myapp.h"
    3. #include "qt-linphone.h"
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. MyApp a(argc, argv);
    8. Widget w;
    9. w.show();
    10.  
    11. return a.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 

    if I run the application with -qws and then hit any button on a keyboard I don't see "pressed"/"released". What is wrong with my code? May be Qt creator can handle QWS related code? Anyway I tried to use x11EventFIlter and it didn't even compile because of absence of XEvent definition..

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: qwsEventFilter implementation

    First of all why you are trying to use qws? Second of all you need to install the event filter on some object to be able to filter events for it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2011
    Posts
    10
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanked 1 Time in 1 Post

    Default Re: qwsEventFilter implementation

    I use qws because my target application is run by -qws on ARM platform.
    I tried to install filters for specific objects, but I need first to process user input before to send events to the Qt core

  4. #4
    Join Date
    Mar 2011
    Posts
    10
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanked 1 Time in 1 Post

    Default Re: qwsEventFilter implementation

    After manual compilation of Qt-everywhere-4.7.2 by arm-linux-gnueabi compiler and running an application with "-qws" parameter the event handler:
    Qt Code:
    1. bool MyApp::qwsEventFilter(QWSEvent *e)
    2. {
    3. if(e->type == QWSEvent::Key) {
    4. qDebug("key");
    5. }
    6. return false;
    7. }
    To copy to clipboard, switch view to plain text mode 
    ..works as expected.

Similar Threads

  1. Replies: 8
    Last Post: 16th April 2010, 10:41
  2. tab order implementation
    By yazwas in forum Qt Programming
    Replies: 2
    Last Post: 2nd December 2009, 17:34
  3. Need some help on design and implementation
    By cool_qt in forum Qt Programming
    Replies: 2
    Last Post: 30th July 2008, 22:19
  4. Protocol Implementation. ?
    By dheeraj in forum Qt Programming
    Replies: 32
    Last Post: 9th May 2008, 11:26
  5. UI implementation style
    By goes2bob in forum Qt Tools
    Replies: 2
    Last Post: 16th August 2007, 00:37

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.