PDA

View Full Version : ActiveX widgets in transparent dialogs are also transparent



deha
31st May 2010, 11:25
Hello,

I want to show an ActiveX widget in a frameless dialog which attribute is set to transparent. The problem is that the ActiveX widget is not shown, so I get a "hole" in my dialog. This behaviour occurs with completely different types of ActiveX components. But if I don't make the dialog transparent the ActiveX widget is shown.

I have already tested adding a non-transparent QWidget that contains the ActiveX widget, but the ActiveX is not visible, only the "hole" is fixed. But if I make the dialog non-transparent, the ActiveX is shown. It seems that the parent window (not widget) of the ActiveX widget may not be transparent.

Anyone an idea how to fix this? I am using Qt 4.6.2, WinXP, VC++ 2008.

Thanks for your help,

Dennis



#include <QApplication>
#include <QDialog>
#include <QHBoxLayout>
#include "acropdflib.h" //created by "Qt\bin\dumpcpp.exe AcroPDF.PDF"

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QDialog d(0, Qt::Dialog | Qt::FramelessWindowHint);
AcroPDFLib::AcroPDF* pdf = new AcroPDFLib::AcroPDF(&d);
pdf->LoadFile("test.pdf");
d.setLayout(new QHBoxLayout());
d.layout()->addWidget(pdf);
d.setAttribute(Qt::WA_TranslucentBackground); //without this the PDF is shown
d.show();

return a.exec();
}

tbscope
31st May 2010, 11:29
Why the translucent background?

deha
31st May 2010, 11:57
In my application I don't use the windows style but my own. Part of it are dialog windows with a self-painted titlebar and window frame (therefor Qt::FramelessWindowHint). The transparent background is for the self-painted shadow of the dialog window (alpha colors). It's working fine with all dialogs but not with ActiveX components inside.