[Qt-interest] transparent child blocking events to the parentwidget.
Jeroen De Wachter
jeroen.dewachter at barco.com
Wed Jan 13 11:38:58 CET 2010
Hey Manish,
You could try setting the Qt::WA_TransparentForMouseEvents Widget
attribute and see if that solves your problem.
I haven't tried this though, I just came across the WA flag...
Kind regards,
Jeroen De Wachter
On Wed, 2010-01-13 at 11:35 +0100, Ulf-Alexander v.
Ceumern-Lindenstjerna wrote:
> Well your transparent widget completely covers your parent widget.
> While it is rendered transparently, it still receives all input events.
> If you want the parent widget to receive the events you have to manually
> forward them yourself.
>
> Think of your transparent widget as a glass window you can look through,
> but you still cannot touch what you see...
>
> Cheers, Ulf
>
> > -----Original Message-----
> > From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> > bounces at trolltech.com] On Behalf Of manish.s.sharma at nokia.com
> > Sent: Wednesday, January 13, 2010 11:16 AM
> > To: qt-interest at trolltech.com
> > Subject: [Qt-interest] transparent child blocking events to the
> > parentwidget.
> >
> > 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
> >
> >
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
DISCLAIMER:
Unless indicated otherwise, the information contained in this message is privileged and confidential, and is intended only for the use of the addressee(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message and/or attachments is strictly prohibited. The company accepts no liability for any damage caused by any virus transmitted by this email. Furthermore, the company does not warrant a proper and complete transmission of this information, nor does it accept liability for any delays. If you have received this message in error, please contact the sender and delete the message. Thank you.
More information about the Qt-interest-old
mailing list