Created
November 1, 2011 19:31
-
-
Save minrk/1331650 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Test case for PySide bug #982 | |
If you hover the mouse over the window, it will be fine, | |
but the first time the topLevelAt is called with the cursor | |
outside the window, it will segfault. | |
""" | |
# stdlib imports | |
import sys | |
# Import Qt: | |
from PySide import QtGui, QtCore | |
# from PyQt4 import QtGui, QtCore | |
def print_topLevelAt(): | |
"""callback to print current cursor position and return of topLevelAt""" | |
cpos = QtGui.QCursor.pos() | |
print cpos | |
# when nothing is there, PyQt returns None | |
# whereas PySide segfaults in this call: | |
print QtGui.qApp.topLevelAt(cpos) | |
if __name__ == '__main__': | |
# create empty window, with a timer that calls topLevelAt with | |
# the current cursor position every 1s | |
app = QtGui.QApplication([]) | |
window = QtGui.QMainWindow() | |
window.show() | |
timer = QtCore.QTimer() | |
timer.timeout.connect(print_topLevelAt) | |
timer.start(1000) | |
app.exec_() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
definitely affect pyside-1.0.6 on OSX, and appears to be fixed in pyside-1.0.7.