From Peter.Zion at fabricengine.com Wed Dec 16 16:22:13 2015 From: Peter.Zion at fabricengine.com (Peter Zion) Date: Wed, 16 Dec 2015 15:22:13 +0000 Subject: [PySide] class not found for setup inheritance 'QGraphicsObject' Message-ID: Hi there, Apologies if this question has already been answered; I searched the archives at gmane and I couldn’t find an answer. I am trying to wrap a fairly extensive Qt widget library with Shiboken (1.2.4) to expose it to PySide (1.2.4, built against Qt open-source 4.8.7). I have hit the problem that one of the widgets that needs to be exposed (call it MyGraphicsWidget) inherits from QGraphicsWidget, and Shiboken generates incorrect code that will not compile. Indeed, Shiboken complains about QGraphicsWidget when it runs: class not found for setup inheritance 'QGraphicsObject' class 'QGraphicsWidget' inherits from unknown base class ‘QGraphicsObject' class 'QGraphicsTextItem' inherits from unknown base class ‘QGraphicsObject' Everything else in Qt is fine, coming from our inclusion of the PySide typesystem files we need: I have this same problem on Linux and OS X, so it looks like the problem itself may be with PySide (or Shiboken) and not with the platform. It’s unclear to me what the problem is with QGraphicsObject; it seems to be explicitly included in typesystem_gui_common.xml. Does anyone have any suggestions about how Shiboken can be directed to correctly find QGraphicsObject? Peter Zion Fabric Engine -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank at ohufx.com Wed Dec 23 05:25:12 2015 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Wed, 23 Dec 2015 17:25:12 +1300 Subject: [PySide] how to overwrite wheelEvent for QScrollBar? Message-ID: <567A2228.5040700@ohufx.com> Hi everybody, quick Christmas question: I am trying to re-implement a QScrollBar's wheelEvent to change it's delta but I just can't get it right for some reason. It kinda feels like a bug to me but am not sure (using PySide 1.0.9). Below is a stripped down version of what I'm trying to do. PageScroller().wheelEvent() never seems to be fired (though the wheel does scroll the bar). Does anybody have an idea what I'm doing wrong? Cheers, frank class PageScroller(QScrollBar): '''Scroll widget for tool page''' def __init__(self, parent=None): super(PageScroller, self).__init__(parent) def wheelEvent(self, event): print 'received wheel event' if __name__ == '__main__': def testSlot(i): print 'Current index changed:', i app = QApplication(sys.argv) mainWindow = QWidget() layout = QVBoxLayout(mainWindow) s = PageScroller(mainWindow) layout.addWidget(s) mainWindow.show() sys.exit(app.exec_()) -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohufxLogo_50x50.png Type: image/png Size: 2666 bytes Desc: not available URL: From frank at ohufx.com Thu Dec 24 00:14:26 2015 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Thu, 24 Dec 2015 12:14:26 +1300 Subject: [PySide] how to overwrite wheelEvent for QScrollBar? In-Reply-To: <567AE7F4.9090605@securityinnovation.com> References: <567A2228.5040700@ohufx.com> <567AE7F4.9090605@securityinnovation.com> Message-ID: <567B2AD2.8020202@ohufx.com> Thanks Anna, in the below example there is only one widget and all my tests have shown that it is the QScrollBar that sends the wheel event, yet it won't respond to the custom method. I have worked around this now by overwriting event() instead like this: def event(self, event): if event.type() == QEvent.Wheel: do stuff else: super(PageScroller, self).event(event) return False Seems brute force but it works. Cheers, frank On 24/12/15 7:29 am, Anna Stenwick wrote: > In the documentation for QWheelEvent it says: > Wheel events are sent to the widget under the mouse cursor, but if > that widget does not handle the event they are sent to the focus widget. > > Perhaps the wrong widget is being sent the event, is your scroll bar > the focused widget? > > Also, be sure to set this in order to receive events for your scroll > bar widget: > > TheQWidget.setEnabled() > function > can be used to enable or disable mouse and keyboard events for a widget. > > I made a custom Dialog class awhile ago and handling the events was > the most frustrating part, sometimes it doesn't work the way you > expect it to. Try overriding QWidget.showEvent and see if your event > shows up there. > > On 12/22/2015 08:25 PM, Frank Rueter | OHUfx wrote: >> Hi everybody, >> quick Christmas question: >> >> I am trying to re-implement a QScrollBar's wheelEvent to change it's >> delta but I just can't get it right for some reason. It kinda feels like >> a bug to me but am not sure (using PySide 1.0.9). >> >> Below is a stripped down version of what I'm trying to do. >> PageScroller().wheelEvent() never seems to be fired (though the wheel >> does scroll the bar). >> Does anybody have an idea what I'm doing wrong? >> >> Cheers, >> frank >> >> class PageScroller(QScrollBar): >> '''Scroll widget for tool page''' >> >> def __init__(self, parent=None): >> super(PageScroller, self).__init__(parent) >> >> def wheelEvent(self, event): >> print 'received wheel event' >> >> >> if __name__ == '__main__': >> def testSlot(i): >> print 'Current index changed:', i >> >> app = QApplication(sys.argv) >> mainWindow = QWidget() >> layout = QVBoxLayout(mainWindow) >> s = PageScroller(mainWindow) >> layout.addWidget(s) >> mainWindow.show() >> >> sys.exit(app.exec_()) >> >> >> >> -- >> ohufxLogo 50x50 *vfx compositing >> | *workflow customisation >> and consulting * * >> >> >> >> _______________________________________________ >> PySide mailing list >> PySide at qt-project.org >> http://lists.qt-project.org/mailman/listinfo/pyside >> > > -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohufxLogo_50x50.png Type: image/png Size: 2666 bytes Desc: not available URL: From frank at ohufx.com Thu Dec 31 06:24:28 2015 From: frank at ohufx.com (Frank Rueter | OHUfx) Date: Thu, 31 Dec 2015 18:24:28 +1300 Subject: [PySide] QPixmap() not working Message-ID: <5684BC0C.6000706@ohufx.com> Hi all, this may be a bug of user error: This code works fine on Windows under PySide 1.0.9 but under PySide 1.2.4 it returns a null pixmap: pixmap = QPixmap('z:/path/to/image/image.svg') print pixmap.isNull() l = QLabel('test') l.setPixmap(pixmap) l.show() Is this a bug in 1.2.4 or am I doing something wrong? Happy New Year from New Zealand everybody! Cheers, frank -- ohufxLogo 50x50 *vfx compositing | *workflow customisation and consulting * * -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ohufxLogo_50x50.png Type: image/png Size: 2666 bytes Desc: not available URL: