Results 1 to 6 of 6

Thread: Embedding native UI in a QWidget?

  1. #1
    Join Date
    Sep 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Embedding native UI in a QWidget?

    Hi guys,

    I was wondering if anyone has experiences trying to get a UI that is written using native UI framework (e.g. MFC) and embedding it in a QWidget? Or any other UI toolkit (e.g. wxWidget) to work with Qt? I am working on an app that uses Qt for the UI, and we have a plugin interface allowing users to embed custom UI in a QWidget that we provide. We don't want to restrict users to Qt framework though.

    Thuan

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Embedding native UI in a QWidget?

    You can have ActiveX objects embedded in Qt on Windows.. but for other applications, you might have to implement some sort of window manager in my opinion.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Embedding native UI in a QWidget?

    In Qt5 some platforms support that through QWindow::fromWinId(). Also called Foreign Window support.

    In Qt4 this platform specific code lives in separate classes. As aamer4yu said using ActiveQt on Windows, on X11 using QX11EmbedContainer. No idea about other platforms.

    Cheers,
    _

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Embedding native UI in a QWidget?

    In Qt5 some platforms support that through QWindow::fromWinId(). Also called Foreign Window support.
    This is exactly the way that non-Qt windows such as OpenGL, VTK, and others are embedded into QWindow / QWidget. Displaying the foreign window is usually not as hard as getting user interaction with it (keyboard / mouse) mapped from the foreign window's event loop into Qt events. It is generally possible, but this is where you will have the most difficulty integrating user-implemented plugins into a Qt app.

  5. #5
    Join Date
    Sep 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Embedding native UI in a QWidget?

    Quote Originally Posted by d_stranz View Post
    This is exactly the way that non-Qt windows such as OpenGL, VTK, and others are embedded into QWindow / QWidget. Displaying the foreign window is usually not as hard as getting user interaction with it (keyboard / mouse) mapped from the foreign window's event loop into Qt events. It is generally possible, but this is where you will have the most difficulty integrating user-implemented plugins into a Qt app.
    Yes, the interaction is the bit I am not sure about. The processing of events, does my native UI (e.g. CSliderCtrl which derives from CWnd) still get the event as it was parented to a native Window? Or do I have to do something to make that happen? I understand I can get a CWnd from the WId of a QWidget and use that as the parent for my MFC native widget.

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Embedding native UI in a QWidget?

    If the foreign window belongs to another process then I think it will just do its event processing as usual, just being visually contained in the host.

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 18th November 2009, 03:43
  2. embedding X11
    By afflictedd2 in forum Qt Programming
    Replies: 5
    Last Post: 13th February 2009, 08:38
  3. Embedding SDL in a QWidget That is not a Window
    By PhilippB in forum Qt Programming
    Replies: 0
    Last Post: 21st August 2008, 11:17
  4. Embedding a custom DLL on Mac
    By sdfisher in forum Installation and Deployment
    Replies: 4
    Last Post: 27th March 2007, 18:48
  5. Embedding
    By shrikarcse in forum Newbie
    Replies: 1
    Last Post: 27th March 2006, 19:06

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.