[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] mousePressEvent not getting called
From:       Quoc Tran <g7quoc () hotmail ! com>
Date:       2008-01-17 19:14:53
Message-ID: BLU114-W99560984503061652D82A97410 () phx ! gbl
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]




I’m having a weird problem with using my custom Qt widget in
PyQt.

 

I created a custom QFrame in C++ and overrided:

virtual void mousePressEvent( QMouseEvent * );

 

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.

i.e.

class
MyPythonFrame(MyCPlusPlusFrame):

    def
mousePressEvent(self, e):

       
print "mouse event"

 

Any ideas what I’m doing wrong?

 

Thanks!


_________________________________________________________________


[Attachment #5 (text/html)]

<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: \
&quot;Calibri&quot;,&quot;sans-serif&quot;; 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: \
&quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, \
125);"><o:p>&nbsp;</o:p></span></p>

<p class="MsoNormal"><span style="font-size: 11pt; font-family: \
&quot;Calibri&quot;,&quot;sans-serif&quot;; 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: &quot;Courier \
New&quot;; color: windowtext;">virtual void mousePressEvent( QMouseEvent * \
);</span><span style="font-size: 11pt; font-family: \
&quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, \
125);"><o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size: 11pt; font-family: \
&quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, \
125);"><o:p>&nbsp;</o:p></span></p>

<p class="MsoNormal"><span style="font-size: 11pt; font-family: \
&quot;Calibri&quot;,&quot;sans-serif&quot;; 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: \
&quot;Calibri&quot;,&quot;sans-serif&quot;; 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: \
&quot;Courier New&quot;; color: windowtext;">class \
MyPythonFrame(MyCPlusPlusFrame):<o:p></o:p></span></p>

<p class="MsoNormal" style=""><span style="font-size: 8.5pt; font-family: \
&quot;Courier New&quot;; color: windowtext;">&nbsp;&nbsp;&nbsp; def \
mousePressEvent(self, e):<o:p></o:p></span></p>

<p class="MsoNormal" style=""><span style="font-size: 8.5pt; font-family: \
&quot;Courier New&quot;; color: \
windowtext;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print "mouse \
event"<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size: 11pt; font-family: \
&quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, \
125);"><o:p>&nbsp;</o:p></span></p>

<p class="MsoNormal"><span style="font-size: 11pt; font-family: \
&quot;Calibri&quot;,&quot;sans-serif&quot;; 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: \
&quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, \
125);"><o:p>&nbsp;</o:p></span></p>

<p class="MsoNormal"><span style="font-size: 11pt; font-family: \
&quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31, 73, \
125);">Thanks!<o:p></o:p></span></p>

</div><br /><hr /> <a href='' target='_new'></a></body>
</html>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic