本文整理汇总了Python中AnyQt.QtGui.QFontMetrics.lineSpacing方法的典型用法代码示例。如果您正苦于以下问题:Python QFontMetrics.lineSpacing方法的具体用法?Python QFontMetrics.lineSpacing怎么用?Python QFontMetrics.lineSpacing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtGui.QFontMetrics
的用法示例。
在下文中一共展示了QFontMetrics.lineSpacing方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_contents
# 需要导入模块: from AnyQt.QtGui import QFontMetrics [as 别名]
# 或者: from AnyQt.QtGui.QFontMetrics import lineSpacing [as 别名]
def update_contents(self):
self.prepareGeometryChange()
self.setTextWidth(-1)
self.setTextWidth(self.document().idealWidth())
self.droplet.setPos(self.rect().center().x(), self.rect().height())
self.droplet.setVisible(bool(self.branches))
fm = QFontMetrics(self.document().defaultFont())
attr = self.node_inst.attr
self.attr_text_w = fm.width(attr.name if attr else "")
self.attr_text_h = fm.lineSpacing()
self.line_descent = fm.descent()
if self.pie is not None:
self.pie.setPos(self.rect().right(), self.rect().center().y())
示例2: defaultTextGeometry
# 需要导入模块: from AnyQt.QtGui import QFontMetrics [as 别名]
# 或者: from AnyQt.QtGui.QFontMetrics import lineSpacing [as 别名]
def defaultTextGeometry(self, point):
"""
Return the default text geometry. Used in case the user single
clicked in the scene.
"""
font = self.annotation_item.font()
metrics = QFontMetrics(font)
spacing = metrics.lineSpacing()
margin = self.annotation_item.document().documentMargin()
rect = QRectF(QPointF(point.x(), point.y() - spacing - margin),
QSizeF(150, spacing + 2 * margin))
return rect
示例3: __init__
# 需要导入模块: from AnyQt.QtGui import QFontMetrics [as 别名]
# 或者: from AnyQt.QtGui.QFontMetrics import lineSpacing [as 别名]
def __init__(self, model, node_inst, parent=None):
super().__init__(parent)
self.model = model
self.node_inst = node_inst
fm = QFontMetrics(self.document().defaultFont())
attr = node_inst.attr
self.attr_text_w = fm.width(attr.name if attr else "")
self.attr_text_h = fm.lineSpacing()
self.line_descent = fm.descent()
self._rect = None
if model.domain.class_var.is_discrete:
self.pie = PieChart(node_inst.value, 8, self)
else:
self.pie = None
示例4: __init__
# 需要导入模块: from AnyQt.QtGui import QFontMetrics [as 别名]
# 或者: from AnyQt.QtGui.QFontMetrics import lineSpacing [as 别名]
def __init__(self, tree_adapter, node_inst, parent=None):
super().__init__(parent)
self.tree_adapter = tree_adapter
self.model = self.tree_adapter.model
self.node_inst = node_inst
fm = QFontMetrics(self.document().defaultFont())
attr = self.tree_adapter.attribute(node_inst)
self.attr_text_w = fm.width(attr.name if attr else "")
self.attr_text_h = fm.lineSpacing()
self.line_descent = fm.descent()
self._rect = None
if self.model.domain.class_var.is_discrete:
self.pie = PieChart(self.tree_adapter.get_distribution(node_inst)[0], 8, self)
else:
self.pie = None