我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用PyQt5.QtCore.Qt.darkRed()。
def __init__(self, parent=None): self.keywordFormat = self._text_format(Qt.blue) self.stringFormat = self._text_format(Qt.darkRed) self.commentFormat = self._text_format(Qt.darkGreen) self.decoratorFormat = self._text_format(Qt.darkGray) self.keywords = list(keyword_list) self.rules = [(QRegExp(r"\b%s\b" % kwd), self.keywordFormat) for kwd in self.keywords] + \ [(QRegExp(r"'.*'"), self.stringFormat), (QRegExp(r'".*"'), self.stringFormat), (QRegExp(r"#.*"), self.commentFormat), (QRegExp(r"@[A-Za-z_]+[A-Za-z0-9_]+"), self.decoratorFormat)] self.multilineStart = QRegExp(r"(''')|" + r'(""")') self.multilineEnd = QRegExp(r"(''')|" + r'(""")') super().__init__(parent)
def paint_drop_indicator(self, painter): if self.drag_active: opt = QStyleOption() opt.initFrom(self) opt.rect = self.drop_indicator_rect rect = opt.rect brush = QBrush(QColor(Qt.darkRed)) if rect.height() == 0: pen = QPen(brush, 2, Qt.SolidLine) painter.setPen(pen) painter.drawLine(rect.topLeft(), rect.topRight()) else: pen = QPen(brush, 2, Qt.SolidLine) painter.setPen(pen) painter.drawRect(rect)
def _add_latest_input_line(self, angle): """Adds a line to the graphic scene that visualizes a scanned angle""" mx, my = self._get_middle() angle_rad = deg2rad(angle) angle_1_rad = deg2rad(angle - self.measurement_angle/2.0) angle_2_rad = deg2rad(angle + self.measurement_angle/2.0) length = max(self.width(), self.height()) start_point = (mx, my) p1 = (mx + length * math.cos(angle_1_rad), my + length * math.sin(angle_1_rad)) p2 = (mx + length * math.cos(angle_2_rad), my + length * math.sin(angle_2_rad)) gradient_start_point, gradient_end_point = (mx, my), (mx + length * math.cos(angle_rad), my + length * math.sin(angle_rad)) gradient = QLinearGradient(*gradient_start_point, *gradient_end_point) gradient.setColorAt(0, Qt.transparent) gradient.setColorAt(0.8, Qt.red) gradient.setColorAt(1, Qt.darkRed) triangle = QPolygonF() triangle.append(QPointF(*start_point)) triangle.append(QPointF(*p1)) triangle.append(QPointF(*p2)) triangle.append(QPointF(*start_point)) self.scene.addPolygon(triangle, pen=QPen(Qt.transparent), brush=QBrush(gradient))
def setStatusColor(self, rowIndex): """????????""" item = self.tableWidget.item(rowIndex, 6) if item.text() == "normal": item.setForeground(Qt.darkGreen) elif item.text() == "update": item.setForeground(Qt.darkRed) elif item.text() == "error": item.setForeground(Qt.darkYellow) elif item.text() == "none": item.setForeground(Qt.gray)