Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, July 2007
Drag and Drop: Dropping onto a QAxWidget


Message 1 in thread

I have a form which contains a QAxWidget (that loads the Internet
Explorer control), how do I enable the widget which contains this
to handle drop events?  Right now, drops on other parts of the
containing widget work, although over the QAxWidget I get the
'cannot drop' icon.

For example, in the webbrowser example in
Qt-3.3.7\extensions\activeqt\examples\webbrowser, the browser
loads any file that is dragged onto it.  I'd like to have the
containing widget handle the drops.

I've tried,

     browserControl->setProperty( "RegisterAsDropTarget",
                                  QVariant( FALSE, 0 ) );

which disabled the browser from opening the file dropped on it,
but it didn't pass the event on to the form.

I also tried the above along with,
     browserControl->setAcceptDrops( false );
but that didn't work either.

Is it possible to do this at all?  Any help would be appreciated.

Thanks.

-- 
 [ signature omitted ] 

Message 2 in thread

http://lists.trolltech.com/qt-interest/2005-10/msg01020.html

That thread may help. It seems subclassing ActiveX and overriding 
mouse/drop events won't work. My only other idea (which may be 
overkill), is to superimpose a transparent widget over the ActiveX 
widget. By doing this, you can intercept the mouse/drop events and do 
what you need to with them or delegate them to the ActiveX widget 
itself. Haven't done this myself but it's an idea.

chris burke
phone: 617-621-0060 x195
email: cburke@xxxxxxx
skype: chris.burke0



Roshan Mathews wrote:
> I have a form which contains a QAxWidget (that loads the Internet
> Explorer control), how do I enable the widget which contains this
> to handle drop events?  Right now, drops on other parts of the
> containing widget work, although over the QAxWidget I get the
> 'cannot drop' icon.
>
> For example, in the webbrowser example in
> Qt-3.3.7\extensions\activeqt\examples\webbrowser, the browser
> loads any file that is dragged onto it.  I'd like to have the
> containing widget handle the drops.
>
> I've tried,
>
>     browserControl->setProperty( "RegisterAsDropTarget",
>                                  QVariant( FALSE, 0 ) );
>
> which disabled the browser from opening the file dropped on it,
> but it didn't pass the event on to the form.
>
> I also tried the above along with,
>     browserControl->setAcceptDrops( false );
> but that didn't work either.
>
> Is it possible to do this at all?  Any help would be appreciated.
>
> Thanks.
>

--
 [ signature omitted ] 

Message 3 in thread

Chris Burke wrote:
> http://lists.trolltech.com/qt-interest/2005-10/msg01020.html
> 
Thanks, I did come across that before I mailed.  I'm not 
subclassing QAxWidget anyway, it is a member of a larger form.

> That thread may help. It seems subclassing ActiveX and overriding 
> mouse/drop events won't work. My only other idea (which may be 
> overkill), is to superimpose a transparent widget over the ActiveX 
> widget. By doing this, you can intercept the mouse/drop events and do 
> what you need to with them or delegate them to the ActiveX widget 
> itself. Haven't done this myself but it's an idea.
> 
We had thought of this too.  Correct me if I'm wrong, but only top 
level widgets can be made transparent (with 
QWidget::setWindowOpacity).  So, I had a transparent QDialog which 
I turned on/displayed whenever a drag enter was fired on the 
containing form, but when it crosses the border into the QAxWidget 
inside, a drag leave is called on the containing form, and I've 
added code to remove the transparent widget at that point.  So 
that doesn't help.  We can maybe check if the drag leave on the 
main form is followed by a drag enter on the transparent widget, 
but that seems kinda hackish, I just wanted to know if there is 
another way to accomplish this.

Thanks again for your help.

-- 
 [ signature omitted ]