Esempio n. 1
0
 def sizeHint(self, option, index):
     """ Returns the size needed to display the item in a QSize object. """
     if index.column() == 3:
         starRating = StarRating(index.data())
         return starRating.sizeHint()
     else:
         return QStyledItemDelegate.sizeHint(self, option, index)
Esempio n. 2
0
 def sizeHint(self, option, index):
     """ Returns the size needed to display the item in a QSize object. """
     if index.column() == 6:
         starRating = StarRating(index.data())
         return starRating.sizeHint()
     else:
         return QStyledItemDelegate.sizeHint(self, option, index)
    def sizeHint(self, option, index):

        qSize = QStyledItemDelegate.sizeHint(self, option, index)

        iDecorHeight = option.decorationSize.height()
        if iDecorHeight > qSize.height():
            qSize.setHeight(iDecorHeight)

        return qSize + QSize(0, 2)
    def sizeHint(self, option, index):

        qSize = QStyledItemDelegate.sizeHint(self, option, index)

        iDecorHeight = option.decorationSize.height()
        if iDecorHeight > qSize.height():
            qSize.setHeight(iDecorHeight)

        return qSize + QSize(0, 2)
Esempio n. 5
0
    def sizeHint(self, option, index):
        """

        :param option:
        :type option: QStyleOptionViewItem
        :param index:
        :type index: QModelIndex
        :return:
        :rtype: QSize
        """
        idx = index.model().mapToSource(index)
        size = QStyledItemDelegate.sizeHint(self, option, idx)
        item = idx.model().itemFromIndex(idx)
        row = item.get_parent_row()
        size.setHeight(row.ROW_HEIGHT)

        return size
Esempio n. 6
0
    def sizeHint(self, option, index):
        if not isinstance(index.data(), GraphRow):
            return QStyledItemDelegate.sizeHint(self, option, index)
        row = index.data()
        max_lane = max(row.commit_node.lane, self.max_edge_lane(row.edges))
        if row.prev_row:
            max_lane = max(max_lane, self.max_edge_lane(row.prev_row.edges))

        width = (max_lane + 1) * self.preferred_lane_size
        height = self.preferred_lane_size

        refs_width, refs_height = self.refs_size(option, row.log_entry.refs,
            bool(row.repo.head_ref))
        width += refs_width
        height = max(height, refs_height)

        return QSize(width, height)