Qtruby - calling a C application

Hello all!
Here is a question for all you Qtruby experts:

I am writing a GUI with Qtruby, which is working great. I am also using
some software written in C (RTP, http://web.cecs.pdx.edu/~watt/rtp/)
that is plotting data in Qt. Now - I would like to tell this C
application to use the main window that I have created in my Ruby code
instead of creating its own main window. But how on earth do I pass
this reference to my application written in C? I am guessing it is just
some index number telling which window it is (?)

Thanks for any help!
Best regards,
Fredrik

Fredrik J wrote:

Hello all!
Here is a question for all you Qtruby experts:

I am writing a GUI with Qtruby, which is working great. I am also using
some software written in C (RTP, http://web.cecs.pdx.edu/~watt/rtp/)
that is plotting data in Qt. Now - I would like to tell this C
application to use the main window that I have created in my Ruby code
instead of creating its own main window. But how on earth do I pass
this reference to my application written in C? I am guessing it is just
some index number telling which window it is (?)
I’ve just downloaded the RTP sources, and see that they are very old
and written for Qt 2.x.

I don’t think it’s possible to have apps from two different processes
writing to the same window. And as QtRuby uses either Qt 3.x or Qt 4.x,
you can’t really integrate the Ruby code with Qt 2.x RTP stuff in the
same process either. If you could port RTP to Qt 3.x it might be
possible, but not otherwise.

– Richard

Fredrik J wrote:

Hello all!
Here is a question for all you Qtruby experts:

I am writing a GUI with Qtruby, which is working great. I am also using
some software written in C (RTP, http://web.cecs.pdx.edu/~watt/rtp/)
that is plotting data in Qt. Now - I would like to tell this C
application to use the main window that I have created in my Ruby code
instead of creating its own main window. But how on earth do I pass
this reference to my application written in C? I am guessing it is just
some index number telling which window it is (?)

If I understand you right, you’re running an external application and
you would like your qtruby application to ‘swallow’ it ? (I use swallow,
like in FvwmButton which is doing something of the like).

Look at the QX11Embed documentation, you should find what you need.
(it seems to me it’s only Qt4, but I can’t say for sure).

Cheers,

Vincent

Vincent F. wrote:

some index number telling which window it is (?)

If I understand you right, you’re running an external application and
you would like your qtruby application to ‘swallow’ it ? (I use swallow,
like in FvwmButton which is doing something of the like).

Look at the QX11Embed documentation, you should find what you need.
(it seems to me it’s only Qt4, but I can’t say for sure).
Yes, you’re right it is in Qt4, and it does sound possible to do what
Fredrik wants with the QX11Embed classes.

Those classes aren’t included in the generation of the Smoke library
that the current release of Qt4 QtRuby uses. I’ve now added the header
QtGui/qx11embed_x11.h to the smoke/qt/header_list file so the
QX11EmbedContainer and QX11EmbedWidget classes, and so they will be in
the next release.

Thanks for helping! I think I am in over my head here though, after
reading your posts I understand that this is not so easily done. I
think I will leave RTP in its own window. It’s not as pretty as it
would have been if it was in the same window, but the function is still
the same.

/Fredrik

Fredrik J wrote:

Hello all!
Here is a question for all you Qtruby experts:

I am writing a GUI with Qtruby, which is working great. I am also using
some software written in C (RTP, http://web.cecs.pdx.edu/~watt/rtp/)
that is plotting data in Qt. Now - I would like to tell this C
application to use the main window that I have created in my Ruby code
instead of creating its own main window. But how on earth do I pass
this reference to my application written in C? I am guessing it is just
some index number telling which window it is (?)

If I understand you right, you’re running an external application and
you would like your qtruby application to ‘swallow’ it ? (I use swallow,
like in FvwmButton which is doing something of the like).

Look at the QX11Embed documentation, you should find what you need.
(it seems to me it’s only Qt4, but I can’t say for sure).

Cheers,

Vince

Fredrik J wrote:

Thanks for helping! I think I am in over my head here though, after
reading your posts I understand that this is not so easily done. I
think I will leave RTP in its own window. It’s not as pretty as it
would have been if it was in the same window, but the function is still
the same.

Well, I’m disappointed ;-). I hope you would try and explain us
everything !

Vince

PS: maybe one day, I’ll fiddle with it and post about it on my blog.