[Qt-interest] transparent child blocking events to the parent widget.

manish.s.sharma at nokia.com manish.s.sharma at nokia.com
Wed Jan 13 11:16:03 CET 2010


Hi all,

I am creating a widget containing some lineedits and creating another transparent widget and setting this transparent widget as child of the widget containing the lineedits. Now when I do a show on the parent widget and try to click on the lineeditors I cannot click it seems the transparent child widget is consuming all the events. Isn't this a wrong  bahaviour? What I was expecting was since the child widget is transparent event should be going to the parent widget. I think it is a bug or am I missing something fundamental?

Below is the code to reproduce the problem.

#include <QApplication>
#include <QLineEdit>
#include <QVBoxLayout>

int main(int argc, char** argv)
{
    QApplication app(argc, argv);

    QWidget *widget = new QWidget;
    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(new QLineEdit);
    layout->addWidget(new QLineEdit);
    layout->addWidget(new QLineEdit);
    widget->setLayout(layout);


    // creating a transparent widget and setting this widget as child
    // of above widget
    QWidget *transparentWidget = new QWidget;
    transparentWidget->setAttribute(Qt::WA_TranslucentBackground);
    transparentWidget->resize(widget->geometry().size());
    transparentWidget->setParent(widget);

    widget->show();
    app.exec();
}


Regards,
Manish


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100113/70867c6e/attachment.html 


More information about the Qt-interest-old mailing list