1

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


class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
    def __init__(self, parent=None):
        QtGui.QMainWindow.init(self)
        Ui_MainWindow.init(self)
        self.setupUi(self)
        self.graphicsView.setEnabled (False)
        self.graphicsView_2.setEnabled(True)
    def mouseDoubleClickEvent(self, event):
        self.graphicsView.setEnabled (True)
        self.graphicsView_2.setEnabled(True)

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

if name == '__main__':
    main()
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
hiroro
  • 11
  • 1

0 Answers0