Results 1 to 20 of 22

Thread: how to link library in Qt( like gcc -l command)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to link library in Qt( like gcc -l command)

    Can we see the relevant code of yours? Please also say what you need the native event for. One more thing - the docs say the events will only be delivered to the widget when it is native (meaning it's not an alien) - did you disable alien support 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.


  2. #2
    Join Date
    Jun 2010
    Posts
    21
    Thanks
    7
    Qt products
    Qt4

    Default Re: how to link library in Qt( like gcc -l command)

    Goal is to capture the XI2 event for multiple cursor( for different mouse/keyboard)
    Here's some relevant code. (I've check the has_xi2 for my display, and set the event mask in the MainWindow's constructor.
    Qt Code:
    1. bool MainWindow::x11Event(XEvent * e)
    2. {
    3. XEvent ev = *e;
    4. XGenericEventCookie *cookie = &ev.xcookie; //&e->xcookie;
    5. if(cookie->type != GenericEvent || cookie->extension != xi_opcode || !XGetEventData(dpy, cookie) ){
    6. printf("No GenericEvent Type is found in X11Event, return ******************* \n");
    7. return false;
    8. }
    9. printf("EVENT TYPE %d \n", cookie->evtype);
    10. switch(cookie->evtype){
    11. case XI_RawMotion:
    12. print_rawmotion((XIRawEvent *)cookie->data);
    13. break;
    14. case XI_Enter:
    15. case XI_Leave:
    16. print_enterleaveevent((XIEnterEvent *)cookie->data);
    17. break;
    18. default:
    19. print_deviceEvent((XIDeviceEvent *)cookie->data);
    20. break;
    21. }
    22. return false;
    23. }
    To copy to clipboard, switch view to plain text mode 

    If needed, I can send more code to your email.

    BTW, what do you mean that the event is native. would you please show me the document you've seen?

    Thanks

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

    Default Re: how to link library in Qt( like gcc -l command)

    Quote Originally Posted by dzh1121 View Post
    Goal is to capture the XI2 event for multiple cursor( for different mouse/keyboard)
    Here's some relevant code. (I've check the has_xi2 for my display, and set the event mask in the MainWindow's constructor.
    So what's the problem exactly? It seems Qt has nothing to do with your situation. For instance I don't think it supports more than one input focus at the same time.

    BTW, what do you mean that the event is native. would you please show me the document you've seen?
    By native event I mean an event generated by the native API (X11 in this case) and not Qt.

    How do you intend to use the extra information provided by XInput2?
    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.


  4. #4
    Join Date
    Jun 2010
    Posts
    21
    Thanks
    7
    Qt products
    Qt4

    Default Re: how to link library in Qt( like gcc -l command)

    Thanks for your reply.
    On Ubuntu 10.04, I've already have 2 cursor, each for one mouse.
    My problem is that, I expect GenericEvent( in X.h file), so I can transfer them to XI2( in XI2.h file) defined event.
    But now, all event type is the the ones defined in X.h, like KeyPress, ButtonRelease, but never GenericEvent.

    in the simpliest command line program, I can get the XI2 event.
    But for the program in Qt, only the X2 event could be received. (see my sample code of X11Event() )
    but I've check XI2 ,and my Qt program tells me that
    XI2 supported. Server provides version 2.0.
    For everything related to event capture is the same.
    So as the beginning, I thought it maybe the link file problem.(but now, it seems not.)

    For your second question, all my event is native, from X11 Event, for sure. [just they are not the extention case(XI2)]

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

    Default Re: how to link library in Qt( like gcc -l command)

    Quote Originally Posted by dzh1121 View Post
    For your second question, all my event is native, from X11 Event, for sure. [just they are not the extention case(XI2)]
    That's of course not true If that were the case, Qt wouldn't be working as everything in it is driven by Qt originating events. Only what goes to x11event() is a native event. I think your problem might be that Qt simply doesn't forward these kinds of events to the widget. I think you should be reimplementing QApplication::x11EventFilter() instead.
    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.


  6. The following user says thank you to wysota for this useful post:

    dzh1121 (11th June 2010)

  7. #6
    Join Date
    Jun 2010
    Posts
    21
    Thanks
    7
    Qt products
    Qt4

    Default Re: how to link library in Qt( like gcc -l command)

    wow, really??
    You know, I had thought that since X11Event is virtual, we do not need to reimplement them.
    And QWidget::x11Event() would have all the event type.
    Seems you are right.
    I'll test it now.

    BTW, should I inherit QApplication for my QMainWindow?(currently, it inherits from QWidget).

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to link library in Qt( like gcc -l command)

    Quote Originally Posted by dzh1121 View Post
    You know, I had thought that since X11Event is virtual, we do not need to reimplement them.
    Hmm... when some method is virtual it usually means it is meant to be reimplemented...

    And QWidget::x11Event() would have all the event type.
    Only events that are meant for this particular widget will be forwarded to it. Of course unless the widget is alien, then it won't get any native events.

    BTW, should I inherit QApplication for my QMainWindow?(currently, it inherits from QWidget).
    I will not answer this question but instead send you back to the docs to compare QApplication and QWidget classes and think whether one can substitute the other as a super class of QMainWindow.
    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.


  9. The following user says thank you to wysota for this useful post:

    dzh1121 (14th June 2010)

  10. #8
    Join Date
    Jun 2010
    Posts
    21
    Thanks
    7
    Qt products
    Qt4

    Default Re: how to link library in Qt( like gcc -l command)

    wysota,

    Thanks for all your replies.

    As I still did not figure how to receive the original Xlib event in Qt. ( It should be able to, but I just cann't work it out.)
    As you said, x11EventFilter() maybe the reason.
    Although I still did not make it.

    Now, my current solution is using a C program to receive XEvent and send that event into a java client.( still stuck by a problem to find the WindowID of java GUI.)
    But, anyway, thank again.

    Thanks for all your effor, all your instruction and etc.

    With regards.

    Tiger

Similar Threads

  1. Is it possible to link the qt library files into exe?
    By hashb in forum Installation and Deployment
    Replies: 2
    Last Post: 7th January 2010, 14:41
  2. How to use a Dynamic Link Library with QT / C++.
    By nivaldonicolau in forum Newbie
    Replies: 5
    Last Post: 29th April 2009, 14:05
  3. How to link library?
    By Macok in forum Qt Tools
    Replies: 1
    Last Post: 31st March 2009, 16:47
  4. Link against library on Mac OS
    By janus in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd March 2009, 11:10
  5. Link *.so library
    By allstar in forum Qt Programming
    Replies: 1
    Last Post: 8th July 2007, 15:27

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.