当前位置: 首页>>代码示例>>Python>>正文


Python Qt.ElideRight方法代码示例

本文整理汇总了Python中PyQt5.QtCore.Qt.ElideRight方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.ElideRight方法的具体用法?Python Qt.ElideRight怎么用?Python Qt.ElideRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore.Qt的用法示例。


在下文中一共展示了Qt.ElideRight方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: paint

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ElideRight [as 别名]
def paint(self, painter, option, index):
        # Add 4px of left an right padding
        option.rect.adjust(4, 0, 4, 0)

        text = self._text(painter, option, index)
        text = option.fontMetrics.elidedText(text, Qt.ElideRight,
                                             option.rect.width())

        painter.save()

        if option.state & QStyle.State_Selected:
            painter.setBrush(option.palette.highlight())

            pen = painter.pen()
            pen.setBrush(option.palette.highlightedText())
            painter.setPen(pen)

        painter.drawText(option.rect, option.displayAlignment, text)

        painter.restore() 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:22,代码来源:qdelegates.py

示例2: on_player_song_changed

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ElideRight [as 别名]
def on_player_song_changed(self, song):
        if song is None:
            self.song_source_label.setText('歌曲来源')
            self.song_title_label.setText('No song is playing.')
            return
        source_name_map = {p.identifier: p.name
                           for p in self._app.library.list()}
        font_metrics = QFontMetrics(QApplication.font())
        text = '{} - {}'.format(song.title_display, song.artists_name_display)
        # width -> three button + source label + text <= progress slider
        # three button: 63, source label: 150
        elided_text = font_metrics.elidedText(
            text, Qt.ElideRight, self.progress_slider.width() - 200)
        self.song_source_label.setText(source_name_map[song.source])
        self.song_title_label.setText(elided_text)
        loop = asyncio.get_event_loop()
        loop.create_task(self.update_mv_btn_status(song)) 
开发者ID:feeluown,项目名称:FeelUOwn,代码行数:19,代码来源:player_control_panel.py

示例3: on_table_selection_changed

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ElideRight [as 别名]
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) 
开发者ID:jopohl,项目名称:urh,代码行数:23,代码来源:GeneratorTabController.py

示例4: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ElideRight [as 别名]
def __init__(self, parent=None, elidemode=Qt.ElideRight):
        super().__init__(parent)
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum)
        self._elidemode = elidemode
        self._elided_text = '' 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:7,代码来源:textbase.py

示例5: clipText

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ElideRight [as 别名]
def clipText(self, text: str, painter: QPainter, chapter: bool=False) -> str:
        metrics = painter.fontMetrics()
        return metrics.elidedText(text, Qt.ElideRight, (self.parent.width() - 10 if chapter else 100 - 10)) 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:5,代码来源:videolist.py

示例6: __set_elided_text

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ElideRight [as 别名]
def __set_elided_text(self):
        fm = QFontMetrics(self.font())
        super().setText(fm.elidedText(self.full_text, Qt.ElideRight, self.width()))

        self.setToolTip(self.full_text) 
开发者ID:jopohl,项目名称:urh,代码行数:7,代码来源:ElidedLabel.py


注:本文中的PyQt5.QtCore.Qt.ElideRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。