[Qt-interest] transparent child blocking events to the parentwidget.
manish.s.sharma at nokia.com
manish.s.sharma at nokia.com
Wed Jan 13 12:54:35 CET 2010
How about having some widgets in the transparent widget and want them to receive events then if i set WA_TransparentForMouseEvents I will never will be able to click on the transparent widgets child widgets. And if I remove WA_TransparentForMouseEvents the flag I will never will be able to click on to the widget which is parent of this transparent widget. Can we achieve both the functionalities? One way to do this is that we can launch the transparent widget as a separate window then it works. But can we do it having child and parent? Or is there some missing functionality in Qt.
Regards,
Manish
>-----Original Message-----
>From: ext Sean Harmer [mailto:sean.harmer at maps-technology.com]
>Sent: Wednesday, January 13, 2010 4:53 PM
>To: Jeroen De Wachter
>Cc: Sharma Manish.S (Nokia-D/Bangalore); qt-interest at trolltech.com
>Subject: Re: [Qt-interest] transparent child blocking events to the
>parentwidget.
>
>Hi,
>
>yes I think that the Qt::WA_TransparentForMouseEvents should do the
>trick here.
>
>Sean
>
>Jeroen De Wachter wrote:
>> 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.
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list