def createEditor(self, parent, option, index): m = index.model() col = m.column_map[index.column()] text = m.db.data[index.row()][m.custom_columns[col]['rec_index']] editor = CommentsDialog(parent, text, column_name=m.custom_columns[col]['name']) d = editor.exec_() if d: m.setData(index, (editor.textbox.html), Qt.EditRole) return None
def set_comments(self): from calibre.gui2.dialogs.comments_dialog import CommentsDialog d = CommentsDialog(self, '' if self.comments is null else (self.comments or ''), _('Comments')) if d.exec_() == d.Accepted: self.comments = d.textbox.html b = self.comments_button b.setStyleSheet('QPushButton { font-weight: bold }') if unicode(b.text())[-1] != '*': b.setText(unicode(b.text()) + ' *')
def createEditor(self, parent, option, index): m = index.model() col = m.column_map[index.column()] text = m.db.data[index.row()][m.custom_columns[col]['rec_index']] editor = CommentsDialog(parent, text) d = editor.exec_() if d: m.setData(index, QVariant(editor.textbox.html), Qt.EditRole) return None
def createEditor(self, parent, option, index): m = index.model() col = m.column_map[index.column()] if check_key_modifier(Qt.KeyboardModifier.ControlModifier): text = '' else: text = m.db.data[index.row()][m.custom_columns[col]['rec_index']] editor = CommentsDialog(parent, text, column_name=m.custom_columns[col]['name']) d = editor.exec_() if d: m.setData(index, (editor.textbox.html), Qt.ItemDataRole.EditRole) return None