[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Qtruby - calling a C application

Fredrik J

1/15/2007 5:09:00 PM

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/...)
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

6 Answers

richard.j.dale@gmail.com

1/15/2007 6:20:00 PM

0


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/...)
> 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

Vincent Fourmond

1/15/2007 7:15:00 PM

0

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/...)
> 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 Fourmond, PhD student
http://vincent.fourmon...

Vincent Fourmond

1/15/2007 7:15:00 PM

0

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/...)
> 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

--
Vincent Fourmond, PhD student
http://vincent.fourmon...

richard.j.dale@gmail.com

1/16/2007 10:23:00 AM

0


Vincent Fourmond wrote:
> 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/...)
> > 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).
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.

Fredrik J

1/16/2007 10:23:00 AM

0

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

Vincent Fourmond

1/16/2007 10:33:00 AM

0

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.

--
Vincent Fourmond, PhD student
http://vincent.fourmon...