[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] About paintEvent and semi-transparent background pixmap.
From: "=?ISO-8859-1?Q?Gustavo_A._D=EDaz?=" <gustavo.diaz () gmail ! com>
Date: 2007-08-27 17:58:21
Message-ID: 64c123920708271058l359feabcu350a304528608474 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi!!
Still i am trying to solve the semi-transparent backrground for my app,
which i've done this so far:
...
def showEvent(self, event):
self.desktopBg =
QtGui.QPixmap.grabWindow(QApplication.desktop().winId(),
\
self.geometry().x(),self.geometry().y(), self.rect().width(),
self.rect().height())
def paintEvent (self, event):
self.clientBgPixmap = QtGui.QPixmap
(":/Pixmaps/pixmaps/oc_clientBg.png")
self.setMask(self.clientBgPixmap.mask())
self.painter = QtGui.QPainter(self)
self.painter.setRenderHint(QPainter.Antialiasing)
self.painter.drawPixmap(0, 0, self.desktopBg)
self.painter.drawPixmap(0, 0, self.clientBgPixmap)
self.painter.end()
...
So i got a semi-transparent background (and of course, the .png pixmap is
semi-transparent) but it only refresh what shines trough the background when
I hide and show my app (from my systray).
I've implemented too the drag and drop event so i could move my app with the
left button of the mouse:
def mousePressEvent(self, event):
if event.button() == QtCore.Qt.LeftButton:
self.dragPosition = event.globalPos() -
self.frameGeometry().topLeft()
event.accept()
def mouseMoveEvent(self, event):
if event.buttons() == QtCore.Qt.LeftButton:
self.move(event.globalPos() - self.dragPosition)
event.accept()
Now, my question is, how i could update what shines trough the background
pixmap when i drop my app? (not necessary when i move it, just when i drop
it)
Thanks!!
Cheers.
--
Gustavo A. Díaz
GDNet Projects
www.gdnet.com.ar
[Attachment #5 (text/html)]
Hi!!<br><br>Still i am trying to solve the semi-transparent backrground for my app, \
which i've done this so far:<br><br>...<br>def showEvent(self, \
event):<br> self.desktopBg = \
QtGui.QPixmap.grabWindow(QApplication.desktop ().winId(), \<br> \
\
self.geometry().x(),self.geometry().y(), self.rect().width(), \
self.rect().height())<br> <br> def paintEvent \
(self, event):<br> self.clientBgPixmap = \
QtGui.QPixmap(":/Pixmaps/pixmaps/oc_clientBg.png") <br> \
self.setMask(self.clientBgPixmap.mask())<br> \
self.painter = QtGui.QPainter(self)<br> \
self.painter.setRenderHint(QPainter.Antialiasing)<br> \
self.painter.drawPixmap(0, 0, self.desktopBg)<br> \
self.painter.drawPixmap(0, 0, \
self.clientBgPixmap)<br> self.painter.end()<br \
clear="all">...<br><br>So i got a semi-transparent background (and of course, \
the .png pixmap is semi-transparent) but it only refresh what shines trough the \
background when I hide and show my app (from my systray). <br><br>I've \
implemented too the drag and drop event so i could move my app with the left button \
of the mouse:<br><br>def mousePressEvent(self, \
event):<br> if \
event.button() == QtCore.Qt.LeftButton:<br> \
self.dragPosition = event.globalPos() - \
self.frameGeometry().topLeft()<br> \
event.accept()<br><br> def \
mouseMoveEvent(self, event):<br> \
if event.buttons() == \
QtCore.Qt.LeftButton:<br> \
self.move(event.globalPos() - \
self.dragPosition)<br> \
event.accept()<br><br><br>Now, my question is, how i could update what shines trough \
the background pixmap when i drop my app? (not necessary when i move it, just when i \
drop it) <br><br>Thanks!!<br><br>Cheers.<br><br><br>-- <br>Gustavo A. Díaz<br>GDNet \
Projects<br><a href="http://www.gdnet.com.ar">www.gdnet.com.ar</a>
_______________________________________________
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