I create a small designer gui with a button that loads in some files from a db, and displays them in a window, my next step is I want to double click on the output and launch or do something.. for example double click on an item in the list and pop up a window saying ok, just as a start.
here is some of the code but so far I cant get double click to work for some reason.
def __init__(self, parent=None):
QtGui.
QWidget.__init__
(self, parent
) self.ui = Ui_notepad()
self.ui.setupUi(self)
# here we connect signals with our slots
QtCore.
QObject.
connect(self.
ui.
editor_window,QtCore.
SIGNAL("itemDoubleClicked()"), self.
open_preview) QtCore.
QObject.
connect(self.
ui.
button_open,QtCore.
SIGNAL("clicked()"), self.
file_dialog) def file_dialog(self):
self.ui.editor_window.addItems(list)
def open_preview(self):
self.ui.bottom_window.addItems('adsfakdsfadfadsfasdf')
if __name__ == "__main__":
myapp = StartQT4()
myapp.show()
sys.exit(app.exec_())
class StartQT4(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_notepad()
self.ui.setupUi(self)
# here we connect signals with our slots
QtCore.QObject.connect(self.ui.editor_window,QtCore.SIGNAL("itemDoubleClicked()"), self.open_preview)
QtCore.QObject.connect(self.ui.button_open,QtCore.SIGNAL("clicked()"), self.file_dialog)
def file_dialog(self):
self.ui.editor_window.addItems(list)
def open_preview(self):
self.ui.bottom_window.addItems('adsfakdsfadfadsfasdf')
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = StartQT4()
myapp.show()
sys.exit(app.exec_())
To copy to clipboard, switch view to plain text mode
right now if i double click on something it should print adsfakdsfadfadsfasdf in bottom_window
any thoughts?
Bookmarks