def appendAddRow(self): """ Append a row with a field to add new properties. """ self.insertRow(self.lastRow() + 1) lineedit = QLineEdit() lineedit.setFrame(False) lineedit.setContentsMargins(0, 0, 0, 0) self.setCellWidget(self.lastRow(), 0, lineedit) widget = QWidget() widget.setContentsMargins(0, 0, 0, 0) widget.setLayout(QHBoxLayout()) widget.layout().setSpacing(0) widget.layout().setContentsMargins(0, 0, 0, 0) typelist = ComboBoxReturn() types = [ "String", "Boolean", "Integer", "Double", "File", "FileVector" ] for type in types: typelist.addItem(type) widget.layout().addWidget(typelist) addButton = QToolButton() addButton.setText("+") widget.layout().addWidget(addButton) self.setCellWidget(self.lastRow(), 1, widget) self.verticalHeader().resizeSection(self.lastRow(), Property.DEFAULT_HEIGHT) self.connect(addButton, SIGNAL('clicked(bool)'), self.addProperty) self.connect(lineedit, SIGNAL('returnPressed()'), self.addProperty) self.connect(typelist, SIGNAL('returnPressed()'), self.addProperty) addButton._lineedit = lineedit addButton._typelist = typelist lineedit._lineedit = lineedit lineedit._typelist = typelist typelist._lineedit = lineedit typelist._typelist = typelist
def appendAddRow(self): """ Append a row with a field to add new properties. """ self.insertRow(self.lastRow()+1) lineedit=QLineEdit() lineedit.setFrame(False) lineedit.setContentsMargins(0, 0, 0, 0) self.setCellWidget(self.lastRow(), 0, lineedit) widget=QWidget() widget.setContentsMargins(0, 0, 0, 0) widget.setLayout(QHBoxLayout()) widget.layout().setSpacing(0) widget.layout().setContentsMargins(0, 0, 0, 0) typelist=ComboBoxReturn() types=["String","Boolean","Integer","Double","File","FileVector"] for type in types: typelist.addItem(type) widget.layout().addWidget(typelist) addButton=QToolButton() addButton.setText("+") widget.layout().addWidget(addButton) self.setCellWidget(self.lastRow(), 1, widget) self.verticalHeader().resizeSection(self.lastRow(), Property.DEFAULT_HEIGHT) self.connect(addButton, SIGNAL('clicked(bool)'), self.addProperty) self.connect(lineedit, SIGNAL('returnPressed()'), self.addProperty) self.connect(typelist, SIGNAL('returnPressed()'), self.addProperty) addButton._lineedit=lineedit addButton._typelist=typelist lineedit._lineedit=lineedit lineedit._typelist=typelist typelist._lineedit=lineedit typelist._typelist=typelist