Results 1 to 3 of 3

Thread: PyQt4 QGraphicsView and 'pressed' signal

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    2
    Qt products
    Platforms
    Unix/X11

    Default PyQt4 QGraphicsView and 'pressed' signal

    Hello, i'm having trouble detecting the 'pressed' signal from a QGraphicsView using the signal/slots framework in PyQt4 (v4.5.4, Qt v4.5.2).

    The attached code perhaps best illustrates my problem. The default event handler 'mousePressEvent' fires as expected, but the slot 'slotPressEvent' does not respond to the 'pressed' signal. Can anyone see what the problem is?

    The workaround i'm currently using is commented out on line 13, emitting the 'pressed' signal from the 'mousePressEvent' handler. In my actual application I am also going to trap the 'released' signal on the QGraphicsView, which I am currently doing using the same workaround.

    I expect i'm not understanding something about Qt's signals/events. Coming from experience with Javascript's various event listeners may have confused me as to how they actually work. In JS you can attach a single handler directly as a property of the object button.click, or multiple handlers using: button.addEventListener('click', function). I think of 'mousePressEvent' as being equivalent to button.click, and signals/slots to addEventListener. Is this right?
    Attached Files Attached Files

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.