Esempio n. 1
0
 def createEditor(self, parent, option, index):
     column = index.column()
     if column == 0:
         editor = PeriodicTableDialog(parent)
         editor.setMultipleSelection(False)
         editor.setRequiresSelection(True)
         return editor
     elif column == 1:
         editor = QLineEdit(parent)
         editor.setValidator(QDoubleValidator())
         return editor
     else:
         return QItemDelegate.createEditor(self, parent, option, index)
Esempio n. 2
0
    def _onClick(self):
        dialog = PeriodicTableDialog(self.parent())
        dialog.setMultipleSelection(False)
        dialog.setRequiresSelection(False)

        symbol = self.text()
        if symbol == str(None):
            symbol = None
        dialog.setSelection(symbol)

        if dialog.exec_():
            newsymbol = str(dialog.selectionSymbol())
            self.setText(newsymbol)

            if newsymbol != symbol:
                self.selectionChanged.emit()