Python PyQt5.QtCore.Qt 模块,ElideRight() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用PyQt5.QtCore.Qt.ElideRight()

项目:QtPropertyBrowserV2.6-for-pyqt5    作者:theall    | 项目源码 | 文件源码
def createEditor(self, manager, property, parent):
        editor = self.d_ptr.createEditor(property, parent)
        editor.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLengthWithIcon)
        editor.setMinimumContentsLength(1)
        editor.view().setTextElideMode(Qt.ElideRight)
        enumNames = manager.enumNames(property)
        editor.addItems(enumNames)
        enumIcons = manager.enumIcons(property)
        enumNamesCount = len(enumNames)
        for i in range(enumNamesCount):
            icon = enumIcons[i]
            if type(icon) is not QIcon:
                icon = QIcon()
            editor.setItemIcon(i, icon)
        editor.setCurrentIndex(manager.value(property))

        editor.currentIndexChanged.connect(self.d_ptr.slotSetValue)
        editor.destroyed.connect(self.d_ptr.slotEditorDestroyed)
        return editor

    ###
    #   \internal

    #   Reimplemented from the QtAbstractEditorFactory class.
    ###
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def on_table_selection_changed(self):
        min_row, max_row, start, end = self.ui.tableMessages.selection_range()

        if min_row == -1:
            self.ui.lEncodingValue.setText("-")  #
            self.ui.lEncodingValue.setToolTip("")
            self.label_list_model.message = None
            return

        container = self.table_model.protocol
        message = container.messages[min_row]
        self.label_list_model.message = message
        decoder_name = message.decoder.name
        metrics = QFontMetrics(self.ui.lEncodingValue.font())
        elidedName = metrics.elidedText(decoder_name, Qt.ElideRight, self.ui.lEncodingValue.width())
        self.ui.lEncodingValue.setText(elidedName)
        self.ui.lEncodingValue.setToolTip(decoder_name)
        self.ui.cBoxModulations.blockSignals(True)
        self.ui.cBoxModulations.setCurrentIndex(message.modulator_index)
        self.show_modulation_info()
        self.ui.cBoxModulations.blockSignals(False)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def clipText(self, text: str, painter: QPainter) -> str:
        metrics = painter.fontMetrics()
        return metrics.elidedText(text, Qt.ElideRight, (self.parent.width() - 100 - 10))
项目:BiocImageBuilder    作者:Bioconductor-notebooks    | 项目源码 | 文件源码
def _set_building_text(self, labelCtrl, text):
        metrics = QtGui.QFontMetrics(labelCtrl.font())
        elidedText = metrics.elidedText(text, Qt.ElideRight, labelCtrl.width())
        labelCtrl.setText(elidedText)
项目:defconQt    作者:trufont    | 项目源码 | 文件源码
def drawCellHeaderText(self, painter, rect):
        xMin, yMin, width, height = rect
        metrics = QFontMetrics(headerFont)
        minOffset = painter.pen().width()

        painter.setFont(headerFont)
        painter.setPen(cellMetricsTextColor)
        name = metrics.elidedText(
            self.glyph.name, Qt.ElideRight, width - 2)
        painter.drawText(
            1, 0, width - 2, height - minOffset,
            Qt.TextSingleLine | Qt.AlignCenter | Qt.AlignBottom, name)