[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: QXEmbed now in libkdeui
From:       Mosfet <mosfet () jorsm ! com>
Date:       1999-05-25 13:03:43
[Download RAW message or body]

On Mon, 24 May 1999, Matthias Ettrich wrote:
> On Tue, 25 May 1999, Mosfet wrote:
> > It's already in kdelibs/corba/parts ;-)
> 
> But not this vastly improved version :-)
> > 
> > I would prefer it in kdeui tho, since I could use it for non-OP stuff I am
> > doing (I am using XReparentWindow currently).
> 
> Great. One usage tip (the documentation is not yet finished): Use qxembed from
> the client side and not from the server side. That means: not the embedding
> widget does the reparenting but vice versa: the client-module embeds itself.
> 

Ah, okay. That is kindof neat :)

> This is trivial with qxembed. Here's a tiny example of a standalone qxembed
> widget that will embed a qmultilineedit as client.
> 
> First the server:
> 
> #include <qapplication.h>
> #include <qtextstream.h>
> #include <qxembed.h>
> 
> int main( int argc, char **argv )
> {
>     QApplication a( argc, argv );
>     QXEmbed qx;
>     a.setMainWidget( &qx );
>     qx.show();
>     QApplication::flushX();
>     if ( !fork() )
> 	execlp("client_program",  "client_program",
> 	       "-embed",  QString::number(qx.winId()).latin1(),
> 	       0);
>     return a.exec();
> }
> 
> 
> If you wonder about the flushX(), that's to avoid Xlib getting out of sync with
> two processes. Unlikely but might happen.
> 
> And here's the applet, a simple qmultlineedit:
> 
> #include <qapplication.h>
> #include <qmultilineedit.h>
> #include "qxembed.h"
> 
> int main( int argc, char **argv )
> {
>     QApplication a( argc, argv );
>     QMultiLineEdit me;
>     a.setMainWidget( &me );
>     if ( !QXEmbed::processClientCmdline( &me, argc, argv ) )
> 	me.show();
>     return a.exec();
> }
> 
> 
> Cute, isn't it? :-) 
> 
> Note that you *need* tomorrows Qt-2.0 snapshot to get this working properly.
> The public Qt CVS will be updated in a few hours, to be precise.
> 
> 
> Matthias
--
Daniel M. Duley - Unix developer & sys admin.
mosfet@kde.org
mosfet@jorsm.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic