<HTML>
<HEAD>
<TITLE>Re: [PyQt] SplashScreen and mousePressEvent</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>The splashscreen is probably not what you want. You can make a QFrame and apply the following styles<BR>
<BR>
QFrame( parent, Qt.X11BypassWindowManagerHint | Qt.FramelessWindowHint |<BR>
Qt.WindowStaysOnTopHint | Qt.Tool )<BR>
<BR>
You will need to override the mouseClickEvent to close this window.<BR>
<BR>
To place it you can get the mouse’s x,y position when right clicking on the tree node and create the frame (with the appropriate images inside) and then place it appropriately.<BR>
<BR>
Brian<BR>
<BR>
<BR>
On 4/8/09 8:41 AM, "projetmbc" <<a href="projetmbc@club-internet.fr">projetmbc@club-internet.fr</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Ok. Thanks a lot for the informations. I've tried another method and it<BR>
works well. Indeed I use a SplashScreen to show a single picture<BR>
associated to a node in a TreeWidget when the user does a right click on it.<BR>
<BR>
A last question. Is it possible to choose the position where the<BR>
SplashScreen appears ?<BR>
<BR>
Christophe.<BR>
<BR>
<BR>
<BR>
<BR>
Brian Kelley a écrit :<BR>
> First, get rid of the mousePressEvent since the Splashscreen closes by<BR>
> default when the user clicks on it. Also, make sure you start the<BR>
> event loop otherwise qt can’t detect mouse events. (Note the following<BR>
> code won’t stop the application, you may need to kill it afterwards)<BR>
><BR>
> from PyQt4 import QtGui<BR>
> import sys<BR>
> app = QtGui.QApplication(sys.argv)<BR>
> pixmap = QtGui.QPixmap("splash.png")<BR>
> splash = QtGui.QSplashScreen(pixmap)<BR>
> splash.show()<BR>
> app.exec_()<BR>
><BR>
><BR>
> On 4/8/09 7:56 AM, "projetmbc" <<a href="projetmbc@club-internet.fr">projetmbc@club-internet.fr</a>> wrote:<BR>
><BR>
> Hello,<BR>
> I would like to close a splashscreen if the user clicks on it. I<BR>
> decide<BR>
> to subclass QtGui.QSplashScreen to do that but the following code<BR>
> doesn't catch the mouse press event. Why ?<BR>
><BR>
> Best regards.<BR>
> Christophe<BR>
><BR>
> ======<BR>
> The code<BR>
> ======<BR>
><BR>
> class mySplashScreen(QtGui.QSplashScreen):<BR>
> def __init__(self, pixmap):<BR>
> super(QtGui.QSplashScreen, self).__init__(pixmap)<BR>
><BR>
> def mousePressEvent(self, event):<BR>
> print 'ok'<BR>
><BR>
> _______________________________________________<BR>
> PyQt mailing list <a href="PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><BR>
> <a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><BR>
><BR>
<BR>
<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE>
</BODY>
</HTML>