Results 1 to 4 of 4

Thread: How to get user-defined message?

  1. #1
    Join Date
    Apr 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to get user-defined message?

    I have two thread, A use PostMessage() sending one message to B.
    But B can not receive user-defined event. Here I use Widget::event(),
    How can I get this user-defined message?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to get user-defined message?

    I don't think you can use Widgets Class in a thread, read QThread Documentation

    ... "Note, however, that it is not possible to use any widget classes in the thread"...

    You can use plain signal-slot to communicate, lets say an object in thread A sends a signal to a slot of an object in thread B, (provided they are connected). This is possible. May be then you can pass the complete user-defined message in the signal to the slot.

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

    Default Re: How to get user-defined message?

    If you use WinAPI for sending, you need to use WinAPI for receiving as well.
    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
    Dec 2010
    Posts
    33
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to get user-defined message?

    Native Windows events ? Or can try QWidget::winEvent ( MSG * message, long * result )

Similar Threads

  1. QUrl with user-defined structure
    By csoler in forum Qt Programming
    Replies: 0
    Last Post: 5th April 2010, 10:29
  2. QSqlQueryModel + user defined roles
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 7th December 2009, 07:29
  3. Resizing user defined QGraphicsItem
    By manti_madhu in forum Qt Programming
    Replies: 0
    Last Post: 9th September 2009, 09:35
  4. Using User Defined Libraries
    By csvivek in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2008, 19:47
  5. User Defined Signal?
    By rajeshs in forum Newbie
    Replies: 2
    Last Post: 18th December 2007, 11:42

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.