[PyQt] Bug with QWidget masks in QGraphicsScene?
Jeremy
jgillula+pyqt at gmail.com
Fri Jun 11 18:47:06 BST 2010
Hello,
I have a question (which may stem from either a bug in PyQt, Qt, or just
my understanding of how Qt is supposed to work). In particular,
according to the Qt documentation
(http://doc.trolltech.com/4.6/qwidget.html#setMask) masked widgets are
only supposed to receive mouse events on their visible portions. This
works fine on a normal widget in a GUI, but doesn't seem to be the case
if I add a widget to a QGraphicsScene via the addWidget method.
In particular, some example code is attached. In this example I create
two buttons, and place one in a QGraphicsScene and the other as part of
a normal layout. I then add a simple mask so that only the left half of
each button is visible. Then, if I click the non-visible part (right
half) of the normal-layout-button, nothing happens (which seems like the
correct behavior). But if I click the invisible right half of the
QGraphicsScene button, the button still appears to be receiving the
mouse click event.
So, my question is...is this a bug in PyQt? Or does the same behavior
happen under Qt in other languages? Or is it not a bug at all, and
QWidgets are not supposed to respect their masks with regard to mouse
events when added to QGraphicsScenes? Or am I just totally crazy? ;-)
Any advice or suggestions anyone can provide would be very much
appreciated!
- Jeremy
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Test.py
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100611/95bcdc10/attachment.ksh>
More information about the PyQt
mailing list