[PyKDE] Odd window behavior when embedding ActiveX controls

greg Landrum greglandrum at mindspring.com
Wed Apr 9 21:45:01 BST 2003


At 10:05 AM 4/9/2003, Sundance wrote:
>I heard greg Landrum said:
>
> > I'm working on embedding ActiveX controls in PyQt windows
>
>Hmm. I'm not sure I'd call it 'embedding', since there's no immediate
>relation between Qt and your ActiveX, if I understood your code
>correctly (not sure about that -- ActiveX gives me the creeps).

The file I sent is just the simplest demo I could construct for the ActiveX 
interaction.   My actual application isn't using IE and interacts more 
substantively with the embedded control.  Still, I could be using the word 
"embedding" improperly.

>Basically, your grey rectangle is, I surmise, your TestPanel, displayed
>as a small grey area because it simply doesn't contain anything, from
>Qt's point of view.

That's what I thought, but I can't figure out why it's always the same 
small size.  TestPanel is derived from QWidget and is resized on 
construction.  It seems like the gray box ought to change in size when the 
rest of the widget does.

>It will likely disappear if you remove or comment
>out the line that says widg.show().

Doing that results in nothing at all being displayed.  The application 
runs, but no windows appear.  This simplifies debugging enormously, but 
won't make my users happy.  ;-)

>If you really want some interaction between a Qt interface and the
>ActiveX, well, good luck. I'd say, there are three options:
>
>1) Embed the ActiveX in a C++ Qt Widget using the ActiveQt C++ module,
>give it a simple interface, and SIP that widget into something
>pythonable.

Not an option.  I don't have a Qt license on windows.

>2) Make your central Qt widget something 'invisible' (it ought to be
>possible one way or another...) and send the ActiveX move and resize
>events so that it stays within that invisible area. You'll still have
>to code the links between the Qt interface () an the ActiveX by hand.
>This includes Qt layout functions, that Qt calls when it needs to know
>if a widget can be resized, if it wants to at all, etc; your ActiveX
>knows nothing about Qt's layout magic, so you'll have to code it
>yourself.

This is what I was planning on doing.  But it's not at all clear to me how 
to make the widget itself "invisible" (assuming the gray box is showing up 
because the widget is empty).  The resizing stuff can be taken of pretty 
easily (the code I posted already handles resize events).


>3) Look at Phil Thompson cutely and ask him if he intends to make the
>ActiveQt framework from Qt 3 part of PyQt at some point. :)

This would be cool, but:
a) looking cute isn't one of my strong suits  :-)
b) if no one else is interested in this, it's not an effective use of his time.

It seems like most everything required to make this work is already present...

>BTW, your __del__() function is probably not necessary -- the reference
>counter will dispose of the IE wrapper on its own.

thanks!

-greg




More information about the PyQt mailing list