Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. PySide: Enabled QGraphicsView object doesn't take QMouseDoubleClickEvent
Forum Updated to NodeBB v4.3 + New Features

PySide: Enabled QGraphicsView object doesn't take QMouseDoubleClickEvent

Scheduled Pinned Locked Moved Unsolved Language Bindings
1 Posts 1 Posters 517 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hiroro
    wrote on last edited by
    #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

    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):
    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()

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved