Page 1 of 2 12 LastLast
Results 1 to 20 of 23

Thread: Embed an external application to the widget

  1. #1
    Join Date
    Feb 2006
    Posts
    12
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Embed an external application to the widget

    Hi guys, i need some help.
    I'm trying to do some project in order to learn Qt (thats the best way of learning i think) .
    Anyway, I want to embed an external process to a widget, specifically the mplayer process.
    so I m creating the process mplayer and i want it to be displayed into my widget, so i can
    have control over it.
    Thank you guys in advance,
    btw, this is my firts post
    good job for the forum
    I Think therefore I Code...

  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: Embed an external application to the widget

    With mplayer it is fairly easy. Use a -wid parameter with mplayer and as an argument specify window id (returned by QWidget::winId()) of the widget you want to embed the player in.

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

    AlexKiriukha (10th April 2006)

  4. #3
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Re: Embed an external application to the widget

    what incase of a generic application? eg java applet or something of that sort?

  5. #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: Embed an external application to the widget

    Quote Originally Posted by nupul
    what incase of a generic application? eg java applet or something of that sort?
    This comes down to the Xlib layer then, I guess. There is a Qt Solution which does that.

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

    nupul (10th April 2006)

  7. #5
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Wink Re: Embed an external application to the widget

    well i don't think it needs to come down to the Xlib layer...The Qt4 Doc cites QX11EmbedContainer and QX11EmbedWidget to achieve the same....

    Honestly, i didn't know about this class till this thread
    I went to the link you gave and had a look through the docs for the same...

    Thanks
    Nupul.

  8. #6
    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: Embed an external application to the widget

    Doesn't it only allow embedding applications which allow that by allowing to specify a window ID to open into?

  9. #7
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Embed an external application to the widget

    Quote Originally Posted by wysota
    Doesn't it only allow embedding applications which allow that by allowing to specify a window ID to open into?
    yes.
    well i didn't clarify....what i meant was any application that ran in some window i.e. a gui based app.


    nupul

  10. #8
    Join Date
    Feb 2006
    Posts
    12
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Embed an external application to the widget

    Quote Originally Posted by wysota
    With mplayer it is fairly easy. Use a -wid parameter with mplayer and as an argument specify window id (returned by QWidget::winId()) of the widget you want to embed the player in.
    Thank you guys for your replies.
    So basically what u mean is that just passing the windId to the mplayer -wid parameter will embed mplayer to the widget which i got the windId. sounds pretty much easy.
    I knew about QX11EmbedContainer and had a look before but i got a bit confused, thats why i posted here, i guess i am just a newbie
    I ll try this thing out.
    thanks again
    I Think therefore I Code...

  11. #9
    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: Embed an external application to the widget

    Quote Originally Posted by nupul
    yes.
    well i didn't clarify....what i meant was any application that ran in some window i.e. a gui based app.
    No, that's the problem. Not any app, just the ones which use XEmbed (which is of course in XLib layer).

  12. #10
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Embed an external application to the widget

    any way to perform such an embedding under window$ ???
    Qt is cross-platform isn't it?
    Current Qt projects : QCodeEdit, RotiDeCode

  13. #11
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Embed an external application to the widget

    Let me open up this thread again, because I am having a problem with it. I can get MPlayer embedded using its -wid parameter. But I am unable to embed any window by passing the WindowID to QX11EmbedContainer::embedClient. The old Qt3 solution sample code doesn't work (after porting to qt4 of course), and neither does the QDevBlog sample for XEmbed here <http://blogs.qtdeveloper.net/archives/2005/08/10/playing-around-with-xembed/>. This is very frustrating because I know it works in Qt3, and worked long enough in Qt4 for the QDevBlog to get a screenshot of it.

    I have logged this as a bug with Trolltech, but I am wondering if anyone else has seen this, and whether it's a new bug. Please use the QDevBlog sample code for discussion.

    Thanks...

  14. #12
    Join Date
    Jun 2006
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Embed an external application to the widget

    The QDevBlog example worked for me (SUSE 10, Qt 4.1.4) embedding Konquerer. I used xwininfo to find the window id.

  15. #13
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Embed an external application to the widget

    Doing a bit of playing around, I see that it works under 4.1.4, but not under 4.2.0-rc1. After logging four bugs in one day, I'm starting to think the "release candidate" is the wrong term to use...

  16. #14
    Join Date
    Aug 2006
    Posts
    90
    Thanks
    6
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Embed an external application to the widget

    Quote Originally Posted by fullmetalcoder View Post
    any way to perform such an embedding under window$ ???
    Qt is cross-platform isn't it?
    Sorry for reopening... but I find this to be a good question. How does one do this under Windows? I assume QX11EmbedWidget will obviously only work under X11.

    And one more question since I have not used QX11Embed*, can I use these classes to essentially attach my Qt app to another window... to basically doc mine to the side for example?

  17. #15
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Posts
    136
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Embed an external application to the widget

    Quote Originally Posted by bpetty View Post
    How does one do this under Windows? I assume QX11EmbedWidget will obviously only work under X11.
    I'm also wondering this - is it possible to embed an external application under Windows? Or only for Linux?
    Richard

  18. #16
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Embed an external application to the widget

    I am just hanging to this thread, because I also have a problem with this. I am trying to embed xterm in a QDockWidget. All that I need is the wid. When passing the wid to embedClient(..) manually (via xwininfo -int) it works perfectly, but I don't see any good way of getting that wid? Ideas?

  19. #17
    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: Embed an external application to the widget

    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.


  20. #18
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Embed an external application to the widget

    Yeah, but I mean the wid from the external application, not my own widget.

  21. #19
    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: Embed an external application to the widget

    Just run xterm with "-into X" where X is the winId returned by the window you wish to embed xterm into.
    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.


  22. #20
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Embed an external application to the widget

    I tried exactly this, but xterm opens in a separate window.

    edit:
    Here's some code:
    Shell::Shell(QWidget *parent)
    : QDockWidget(parent)
    {
    setObjectName("Shell");
    setWindowTitle("Shell");

    QWidget *widget=new QWidget(this);
    setWidget(widget);

    process=new QProcess(this);
    process->start("xterm -into "+QString((int)widget->winId()));
    widget->show();
    }
    edit2:
    I made a screenshot for you, so you can understand what I am trying to achieve:
    Attached Images Attached Images
    Last edited by leenxkewl; 14th October 2010 at 16:15.

Similar Threads

  1. Q3ScrollView resists to scroll down to the garbage bin
    By sivrisinek in forum Qt Programming
    Replies: 0
    Last Post: 5th February 2009, 17:50
  2. shared vs static
    By alisami in forum Installation and Deployment
    Replies: 3
    Last Post: 4th October 2008, 13:04
  3. Replies: 16
    Last Post: 23rd May 2008, 10:12
  4. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 22:04
  5. Replies: 1
    Last Post: 14th June 2006, 14:36

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.