Have a look at http://pythoncad.git.sourceforge.net/git/gitweb.cgi?p=pythoncad/pythoncad;a=blob;f=PythonCAD/Interface/cadscene.py;h=77cf54b821f244975372ed2d025c9c7a90033247;hb=refs/heads/R38
regards, Matteo Il 14/09/2012 23:28, Martin Airs ha scritto:
good day all, I'm currently writing a Plasmoid for KDE, so I'm not 100% certain who's lap to lay this in, but I'll try here first. I'm using a Plasma.Frame which inherits a QGraphicsWidget, in my subclass I have reimplemented the itemChange function so I can set the element prefix of the SVG used to paint the frame. when i press each item with the left mouse button, everything works as expected :) however if i right click an item, its ElementPrefix changes ok and the menu pops up, but the other item that is selected doesn't deselect. and i end up with 2 selected items until i click one again. Martin here is a snippet of the code... def itemChange(self, change, value): if change == QGraphicsItem.ItemSelectedChange: print "selection changed" if value == QVariant(True): self.border.setElementPrefix("selected") else: self.border.setElementPrefix("normal") self.update() return value def mousePressEvent(self, event): if event.button() == 1: self.setSelected(1) self.update() if event.button() == 2: self.setSelected(1) self.update() self.menu.exec_(QCursor.pos()) _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt