def sizeHint(self, option, index):
     s = QStyledItemDelegate.sizeHint(self, option, index)
     if s.width() > 150:
         s.setWidth(150)
     elif s.width() < 50:
         s.setWidth(50)
     return s + QSize(18, 0)
Example #2
0
 def sizeHint(self, option, index):
     s = QStyledItemDelegate.sizeHint(self, option, index)
     if s.width() > 150:
         s.setWidth(150)
     elif s.width() < 50:
         s.setWidth(50)
     return s + QSize(18, 0)
Example #3
0
 def sizeHint(self, option, index):
     layer = index.data()
     if isinstance(layer, Layer):
         self._w.layer = layer
         self._w.channelSelector.setVisible(True)
         return self._w.sizeHint()
     else:
         return QStyledItemDelegate.sizeHint(self, option, index)
Example #4
0
 def sizeHint(self, option, index):
     layer = index.data()
     if isinstance(layer, Layer):
         self._w.layer = layer
         self._w.channelSelector.setVisible(True)
         return self._w.sizeHint()
     else:
         return QStyledItemDelegate.sizeHint(self, option, index)
Example #5
0
    def sizeHint(self, option, index):
        option = QStyleOptionViewItem(option)
        self.initStyleOption(option, index)
        size = QStyledItemDelegate.sizeHint(self, option, index)

        # TODO: get the default QMenu item height from the current style.
        size.setHeight(max(size.height(), 25))
        return size
Example #6
0
 def sizeHint(self, option, index):
     col = index.column()
     if col == DevMdl.LWT:
         return QSize(16, 1)
     elif col == DevMdl.POWER:
         if isinstance(index.data(), dict):
             return QSize(8 + len(index.data().keys()) * 14, 1)
         return QSize(1, 1)
     return QStyledItemDelegate.sizeHint(self, option, index)
Example #7
0
 def sizeHint(self, option, index):
     fm = option.fontMetrics
     if index.column() == residNum:
         return QSize(fm.width("9,999,999"), fm.height())
     if index.column() == residName:
         text = index.model().data(index)
         document = QTextDocument()
         document.setDefaultFont(option.font)
         document.setHtml(text)
         return QSize(document.idealWidth() + 5, fm.height())
     return QStyledItemDelegate.sizeHint(self, option, index)
Example #8
0
 def sizeHint(self, option, index):
     fm = option.fontMetrics
     if index.column() == ATOM:
         return QSize(fm.width("9,999,999"), fm.height())
     if index.column() == resName:
         text = index.model().data(index)
         document = QTextDocument()
         document.setDefaultFont(option.font)
         document.setHtml(text)
         return QSize(document.idealWidth() + 5, fm.height())
     return QStyledItemDelegate.sizeHint(self, option, index)
Example #9
0
    def sizeHint(self, option, index):
        """QStyledItemDelegate.sizeHint implementation
        """
        options = QStyleOptionViewItem(option)
        self.initStyleOption(options,index)

        doc = QTextDocument()
        doc.setDocumentMargin(1)
        #  bad long (multiline) strings processing doc.setTextWidth(options.rect.width())
        doc.setHtml(options.text)
        return QSize(doc.idealWidth(),
                     QStyledItemDelegate.sizeHint(self, option, index).height())
Example #10
0
    def sizeHint(self, option, index):
        """QStyledItemDelegate.sizeHint implementation
        """
        options = QStyleOptionViewItem(option)
        self.initStyleOption(options, index)

        doc = QTextDocument()
        doc.setDocumentMargin(1)
        #  bad long (multiline) strings processing doc.setTextWidth(options.rect.width())
        doc.setHtml(options.text)
        return QSize(
            int(doc.idealWidth()),
            int(QStyledItemDelegate.sizeHint(self, option, index).height()))
Example #11
0
    def sizeHint(self, option, index):
        col = index.column()
        col_name = index.model().sourceModel().columns[col]
        if col_name == "LWT":
            return QSize(16, 28)

        elif col_name == "Power":
            num = len(index.data().keys())
            if num <= 4:
                return QSize(24 * len(index.data().keys()), 28)
            else:
                return QSize(24 * 4, 48)

        return QStyledItemDelegate.sizeHint(self, option, index)
Example #12
0
    def sizeHint(self, option, index):
        # s = QStyledItemDelegate.sizeHint(self, option, index)

        item = QModelIndex()
        for i in range(self.mdlPersos.rowCount()):
            if self.mdlPersos.ID(i) == index.data():
                item = self.mdlPersos.index(i, Perso.name.value)

        opt = QStyleOptionViewItem(option)
        self.initStyleOption(opt, item)
        s = QStyledItemDelegate.sizeHint(self, opt, item)

        if s.width() > 200:
            s.setWidth(200)
        elif s.width() < 100:
            s.setWidth(100)
        return s + QSize(18, 0)
Example #13
0
    def sizeHint(self, option, index):
        # s = QStyledItemDelegate.sizeHint(self, option, index)

        item = QModelIndex()
        character = self.mdlCharacter.getCharacterByID(index.data())
        if character:
            item = character.index(Character.name)

        opt = QStyleOptionViewItem(option)
        self.initStyleOption(opt, item)
        s = QStyledItemDelegate.sizeHint(self, opt, item)

        if s.width() > 200:
            s.setWidth(200)
        elif s.width() < 100:
            s.setWidth(100)
        return s + QSize(18, 0)
    def sizeHint(self, option, index):
        # s = QStyledItemDelegate.sizeHint(self, option, index)

        item = QModelIndex()
        character = self.mdlCharacter.getCharacterByID(index.data())
        if character:
            item = character.index(Character.name.value)

        opt = QStyleOptionViewItem(option)
        self.initStyleOption(opt, item)
        s = QStyledItemDelegate.sizeHint(self, opt, item)

        if s.width() > 200:
            s.setWidth(200)
        elif s.width() < 100:
            s.setWidth(100)
        return s + QSize(18, 0)
Example #15
0
    def sizeHint(self, option, index):
        """Returns a QSize bounding box of the area required to paint the data in the model at the index.

        Returns the size of the bounding box of the area required to paint the data in the model
        at the specified index.  This is the sum of decoration pixmap widths, and the sizeHint provided
        by the custom value_painter if it exists.

        Args:
            option - QStyleOptionViewItem
            index - QModelIndex

        Returns:
            A QSize bounding box of the size required to paint the value of the data in the model plus
            decorations.

        """
        value_painter = self._get_value_painter(index)
        if value_painter is None:
            return QStyledItemDelegate.sizeHint(self, option, index)
        decs = self._get_decorations(index, bool(option.state & QStyle.State_Selected))
        pix_widths = [dec.pixmap.width() for dec in decs]
        size = value_painter.sizeHint(option, index)
        size.setWidth(size.width() + sum(pix_widths))
        return size
    def sizeHint(self, option, index):
        """Returns a QSize bounding box of the area required to paint the data in the model at the index.

        Returns the size of the bounding box of the area required to paint the data in the model
        at the specified index.  This is the sum of decoration pixmap widths, and the sizeHint provided
        by the custom value_painter if it exists.

        Args:
            option - QStyleOptionViewItem
            index - QModelIndex

        Returns:
            A QSize bounding box of the size required to paint the value of the data in the model plus
            decorations.

        """
        value_painter = self._get_value_painter(index)
        if value_painter is None:
            return QStyledItemDelegate.sizeHint(self, option, index)
        decs = self._get_decorations(index, bool(option.state & QStyle.State_Selected))
        pix_widths = [dec.pixmap.width() for dec in decs]
        size = value_painter.sizeHint(option, index)
        size.setWidth(size.width() + sum(pix_widths))
        return size
Example #17
0
 def sizeHint(self, option, index):
     sh = QStyledItemDelegate.sizeHint(self, option, index)
     # if sh.width() > 50:
     sh.setWidth(100)
     return sh
Example #18
0
 def sizeHint(self, option, index):
     return QStyledItemDelegate.sizeHint(self, option, index)
 def sizeHint(self, option, index):
     sh = QStyledItemDelegate.sizeHint(self, option, index)
     # if sh.width() > 50:
     sh.setWidth(100)
     return sh
Example #20
0
 def sizeHint(self, option, index):
     s = QStyledItemDelegate.sizeHint(self, option, index)
     if s.width() < 200:
         s.setWidth(200)
     return s
Example #21
0
 def sizeHint(self, option, index):
     s = QStyledItemDelegate.sizeHint(self, option, index)
     if s.width() < 200:
         s.setWidth(200)
     return s
Example #22
0
 def sizeHint(self, option: QStyleOptionViewItem, index: QtCore.QModelIndex) -> QtCore.QSize:
     return QStyledItemDelegate.sizeHint(self, option, index)