PySide: Enabled QGraphicsView object doesn't take QMouseDoubleClickEvent

  • I have this simple program in qt. It creates 2 small squares with qgraphicsview. One square is "Enabled" at initialization so it is painted blue and the other square is Disabled so it is white at the initialization. When I double click on the disabled square QMouseDoubleClickEvent is called and the square is enabled(turned to blue). But when I double click on the Enabled(blue) square, the double click event doesn't work. How can I make the double click work on the blue(Enabled) square? Thank you

    import sys
    from PySide import QtGui
    from ui.Ui_MainWindow import Ui_MainWindow
    from PySide.QtGui import QApplication

    class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
    def init(self, parent=None):
    self.graphicsView.setEnabled (False)

    def mouseDoubleClickEvent(self, event):
        self.graphicsView.setEnabled (True)

    def main():
    app = QApplication(sys.argv)
    wnd = MainWindow()

    if name == 'main':

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.