PDA

View Full Version : handling events of Acrobat Activex control Embedded in QAxWidget



aarti.nagpal
25th April 2011, 12:27
Hello,
I am working on application which is being developed in Qt on Windows. I need to display
PDF file on dialog in Activex Control. I used QAxWidget control in qt and embed
Acrobat Browser Control on it. I used Acrobat Browser Control type Library to preview
PDf file in QAxWidget. Following is code snippet:

pdf=new PdfWidget(this);
pdf->setGeometry(60,30,500,480);
pdf->dynamicCall("LoadFile(const QString&)","D:\\cryptkey.pdf");
pdf->dynamicCall("setShowScrollbars(bool)","false");
pdf->dynamicCall("setShowToolbar(bool)","false");
pdf->dynamicCall("setPageMode(const QString&)","none");

where pdfWidget is class inherited from QAxWidget. I need to disable mouse and key events on PDF file displayed in Activex control. So I override mousePressEvent() of QAxWidget class and used its ignore() to disable mouse clicks

void PdfWidget::mousePressEvent( QMouseEvent * event )
{
event->ignore();
}

This works fine if no file is loaded in Acrobat Browser control but After a PDF file is loaded it does not recieve any events.

I think Acrobat Browser control has taken the control and now how I will handle the mouse events on Acrobat Activex control so that I can disable the mouse clicks on PDf file displayed in it.
I have read in QAxWidget documentation
"However, you cannot reimplement Qt-specific event handlers like mousePressEvent or keyPressEvent and expect them to be called reliably. The embedded control covers the QAxWidget completely, and usually handles the user interface itself. Use control-specific APIs (i.e. listen to the signals of the control), or use standard COM techniques like window procedure subclassing."

Please help me out as I have little knowledege in COM techniques and how I will handle Activex controls events to disable mouse clicks.

Waiting for reply................

aarti.nagpal
3rd May 2011, 05:18
Hello,
I am working on application which is being developed in Qt on Windows. I need to display
PDF file on dialog in Activex Control. I used QAxWidget control in qt and embed
Acrobat Browser Control on it. I used Acrobat Browser Control type Library to preview
PDf file in QAxWidget. Following is code snippet:

pdf=new PdfWidget(this);
pdf->setGeometry(60,30,500,480);
pdf->dynamicCall("LoadFile(const QString&)","D:\\cryptkey.pdf");
pdf->dynamicCall("setShowScrollbars(bool)","false");
pdf->dynamicCall("setShowToolbar(bool)","false");
pdf->dynamicCall("setPageMode(const QString&)","none");

where pdfWidget is class inherited from QAxWidget. I need to disable mouse and key events on PDF file displayed in Activex control. So I override mousePressEvent() of QAxWidget class and used its ignore() to disable mouse clicks

void PdfWidget::mousePressEvent( QMouseEvent * event )
{
event->ignore();
}

This works fine if no file is loaded in Acrobat Browser control but After a PDF file is loaded it does not recieve any events.

I think Acrobat Browser control has taken the control and now how I will handle the mouse events on Acrobat Activex control so that I can disable the mouse clicks on PDf file displayed in it.
I have read in QAxWidget documentation
"However, you cannot reimplement Qt-specific event handlers like mousePressEvent or keyPressEvent and expect them to be called reliably. The embedded control covers the QAxWidget completely, and usually handles the user interface itself. Use control-specific APIs (i.e. listen to the signals of the control), or use standard COM techniques like window procedure subclassing."

Please help me out as I have little knowledege in COM techniques and how I will handle Activex controls events to disable mouse clicks.

Waiting for reply................



Pls help me out as I am struck at this point.

ChrisW67
3rd May 2011, 06:29
What is the problem? As the docs clearly say you cannot expect QAxWidget's mouse event handler to be called reliably because the contained ActiveX control covers the entire widget. The contained control therefore gets these events. You need to disable the handling of those events by setting the appropriate settings in the Adobe control: see the Adobe control's documentation.