<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'><div style="text-align: left;">
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">I’m having a weird problem with using my custom Qt widget in
PyQt.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">I created a custom QFrame in C++ and overrided:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: "Courier New"; color: windowtext;">virtual void mousePressEvent( QMouseEvent * );</span><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">When I use my widget in python the mousePressEvent is never
called but if I derive off of my custom class in PyQt and override
the mousePressEvent it will get called.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">i.e.<o:p></o:p></span></p>
<p class="MsoNormal" style=""><span style="font-size: 8.5pt; font-family: "Courier New"; color: windowtext;">class
MyPythonFrame(MyCPlusPlusFrame):<o:p></o:p></span></p>
<p class="MsoNormal" style=""><span style="font-size: 8.5pt; font-family: "Courier New"; color: windowtext;"> def
mousePressEvent(self, e):<o:p></o:p></span></p>
<p class="MsoNormal" style=""><span style="font-size: 8.5pt; font-family: "Courier New"; color: windowtext;">
print "mouse event"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">Any ideas what I’m doing wrong?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">Thanks!<o:p></o:p></span></p>
</div><br /><hr /> <a href='' target='_new'></a></body>
</html>