Results 1 to 5 of 5

Thread: Message loops of different GUI toolkits

  1. #1
    Join Date
    Jul 2009
    Posts
    40
    Thanks
    7

    Default Message loops of different GUI toolkits

    Hello

    I recently posted on this forum about how to show qt dialog from mfc application. I was using the mfc/qt migration solution.
    http://www.qtcentre.org/forum/f-qt-p...app-22844.html

    I also noticed that I can show modal dialog box (has its own local message loop) without using the mfc/qt migration solution. The same does not hold true for modeless dialog box.

    My question is why the message loop of the mfc application can't just retrieve the messages for the modeless qt dialog from the thread message queue and dispatch them to the appropriate window procedure ?

    That is why messages generated from one gui toolkit (qt) can not be fetched by the message loop of another gui toolkit (mfc) , if the both toolkits are using the underlying win32 api for window management?

    I also search the posts of this forum about using the mf/qt migration solution, and came to the information that mf/qt migration solution merges the message loops of the mfc and qt . So again, can someone explain what that means to merge the message loops of different gui toolkits ?

    I really want to understand this concept. I am sure am missing something very obvious about why different gui toolkits can not be mixed together.

    Thanks

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

    Default Re: Message loops of different GUI toolkits

    Quote Originally Posted by elizabeth.h1 View Post
    My question is why the message loop of the mfc application can't just retrieve the messages for the modeless qt dialog from the thread message queue and dispatch them to the appropriate window procedure ?
    Because they are incompatible.

    So again, can someone explain what that means to merge the message loops of different gui toolkits ?
    Additional code is injected into one of the loops to provide means of periodically running the other loop as both can't usually run at once (as they are probably both blocking).
    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
    Jul 2009
    Posts
    40
    Thanks
    7

    Default Re: Message loops of different GUI toolkits

    I am not understanding well why the message loops are incompatible.
    I imagine that message loop from any gui toolkit looks essentially like the standard win32 loop with GetMessage ,TranslateMessage and DispatchMessage. If this is true , i was thinking that when mixing different toolkits in same app only one message loop should be present, and that message loop should retrive the messages from both toolkits.
    sorry if this is stupid

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

    Default Re: Message loops of different GUI toolkits

    Quote Originally Posted by elizabeth.h1 View Post
    I am not understanding well why the message loops are incompatible.
    Because they use different concepts.
    I imagine that message loop from any gui toolkit looks essentially like the standard win32 loop with GetMessage ,TranslateMessage and DispatchMessage. If this is true (...)
    It's not. Qt events are translated from system events to objects and the whole event mechanism is embedded into the application itself. WinAPI is not object oriented. I guess the two reasons are sufficient.

    i was thinking that when mixing different toolkits in same app only one message loop should be present, and that message loop should retrive the messages from both toolkits.
    Yes, that's correct. That's why you have the migration package. An alternative is to implement a dispatcher for Qt events using other event mechanism by reimplementing QAbstractEventDispatcher just like it has been done to use glib event loop for Qt on Unix.
    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.


  5. #5
    Join Date
    Jul 2009
    Posts
    40
    Thanks
    7

    Default Re: Message loops of different GUI toolkits

    ok now its more clear.
    I should read the documenttaion for QEvent first
    Thank u

Similar Threads

  1. VS 2008, Qt Add-in, current build platform error message
    By dbf in forum Installation and Deployment
    Replies: 1
    Last Post: 2nd April 2009, 17:59
  2. Replies: 4
    Last Post: 12th October 2008, 13:47
  3. How to Compile VTKDesigner2 with Qt?
    By alfredoaal in forum Newbie
    Replies: 0
    Last Post: 5th September 2008, 05:34
  4. treewidget and a message system
    By alisami in forum Qt Programming
    Replies: 7
    Last Post: 27th July 2008, 18:05
  5. statusBar() message color change
    By mclark in forum Qt Programming
    Replies: 2
    Last Post: 7th August 2007, 23:20

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.