[PyQt] Problem with class inheriting QDialog

dizou di_zou at yahoo.com
Mon Nov 23 14:56:24 GMT 2009


I've got this fixed, thank you. I had another typo I didn't catch. 

What I am trying to do is pass a parameter through the signal. I have a
QTreeWidget object under my MainWindow class with a bunch of items in it. I
want the signal to pass in the item I have selected when I click my button.
How do I do that?

This is what I have:

Dialog.py:

import sys
from PyQt4.QtGui import QDialog

class Dialog(QDialog):
        def __init__(self, parent):
                QDialog.__init__(self, parent)

MainWindow.py:

from PyQt4.QtCore import SIGNAL, SLOT, QDir, QFile
from PyQt4.QtGui import QApplication, QMainWindow, QMenu, QMessageBox, \
     QWidget, qApp, QAction, QFileDialog, QPushButton
from Dialog import *

class MainWindow(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
        
        self.tree = TreeArea(self)

        self.editButton = QPushButton(self)
        self.connect(self.editButton, SIGNAL("clicked(QTreeWidgetItem *)"),
self.EditButtonClicked)
    def EditButtonClicked(self):
        self.dialog = Dialog(self, item)
        print type(self.dialog)
        self.dialog.exec_() 

TreeArea.py:
import stuff

class TreeArea(QTreeWidget):
    def __init__(self, parent):
        QTreeWidget.__init__(self, parent)
        #add items and other functions
-- 
View this message in context: http://old.nabble.com/Problem-with-class-inheriting-QDialog-tp26421493p26479495.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list