Example #1
0
    def updateEditorGeometry(self, editor, option, model_index):
        """Summary

        Args:
            editor (TYPE): Description
            option (TYPE): Description
            model_index (TYPE): Description

        Returns:
            TYPE: Description
        """
        column = model_index.column()
        if column == 0:
            editor.setGeometry(option.rect)
        elif column == 1:
            value = model_index.model().data(model_index, Qt.EditRole)
            data_type = type(value)
            if data_type is bool:
                rect = QRect(option.rect)
                delta = option.rect.width() / 2 - 9
                rect.setX(option.rect.x() +
                          delta)  # Hack to center the checkbox
                editor.setGeometry(rect)
            else:
                editor.setGeometry(option.rect)
        else:
            QStyledItemDelegate.updateEditorGeometry(self, editor, option,
                                                     model_index)
 def updateEditorGeometry(self, editor: QWidget,
                          option: QStyleOptionViewItem,
                          model_index: QModelIndex):
     """
     Args:
         editor: Description
         option: Description
         model_index: Description
     """
     column = model_index.column()
     if column == 0:
         editor.setGeometry(option.rect)
     elif column == 1:
         value = model_index.model().data(model_index, Qt.EditRole)
         data_type = type(value)
         if data_type is bool:
             rect = QRect(option.rect)
             delta = option.rect.width() / 2 - 9
             rect.setX(option.rect.x() +
                       delta)  # Hack to center the checkbox
             editor.setGeometry(rect)
         else:
             editor.setGeometry(option.rect)
     else:
         QStyledItemDelegate.updateEditorGeometry(self, editor, option,
                                                  model_index)
Example #3
0
 def updateEditorGeometry(self, editor, option, model_index):
     column = model_index.column()
     if column == NAME_COL:
         editor.setGeometry(option.rect)
     # elif column == VISIBLE_COL:
     #     rect = QRect(option.rect)
     #     delta = option.rect.width() / 2 - 9
     #     rect.setX(option.rect.x() + delta) # Hack to center the checkbox
     #     editor.setGeometry(rect)
     # elif column == COLOR_COL:
     #     editor.setGeometry(option.rect)
     else:
         QStyledItemDelegate.updateEditorGeometry(self, editor, option,
                                                  model_index)
Example #4
0
 def updateEditorGeometry(self, editor: QWidget,
                                 option: QStyleOptionViewItem,
                                 model_index: QModelIndex):
     column = model_index.column()
     if column == NAME_COL:
         editor.setGeometry(option.rect)
     # elif column == VISIBLE_COL:
     #     rect = QRect(option.rect)
     #     delta = option.rect.width() / 2 - 9
     #     rect.setX(option.rect.x() + delta) # Hack to center the checkbox
     #     editor.setGeometry(rect)
     # elif column == COLOR_COL:
     #     editor.setGeometry(option.rect)
     else:
         QStyledItemDelegate.updateEditorGeometry(self, editor, option, model_index)
 def updateEditorGeometry(self,  editor: QWidget,
                                 option: QStyleOptionViewItem,
                                 model_index: QModelIndex):
     """
     Args:
         editor: Description
         option: Description
         model_index: Description
     """
     column = model_index.column()
     if column == 0:
         editor.setGeometry(option.rect)
     elif column == 1:
         value = model_index.model().data(model_index, Qt.EditRole)
         data_type = type(value)
         if data_type is bool:
             rect = QRect(option.rect)
             delta = option.rect.width() / 2 - 9
             rect.setX(option.rect.x() + delta)  # Hack to center the checkbox
             editor.setGeometry(rect)
         else:
             editor.setGeometry(option.rect)
     else:
         QStyledItemDelegate.updateEditorGeometry(self, editor, option, model_index)
 def updateEditorGeometry(self, editor, option, index):
     if index.column() in DATE_TIME_COLUMN_LIST:
         editor.setGeometry(option.rect)
     else:
         return QStyledItemDelegate.updateEditorGeometry(self, editor, option, index)
Example #7
0
 def updateEditorGeometry(self, editor, option, index):
     if index.column() in DATE_TIME_COLUMN_LIST:
         editor.setGeometry(option.rect)
     else:
         return QStyledItemDelegate.updateEditorGeometry(
             self, editor, option, index)