def __init__(self, parent): super(VAT_QGraphicsView, self).__init__(parent) self._zoom = 0 self._empty = True self._scene = QtWidgets.QGraphicsScene(self) self._photo = QtWidgets.QGraphicsPixmapItem() self._scene.addItem(self._photo) self.setScene(self._scene) self.setTransformationAnchor(QtWidgets.QGraphicsView.AnchorUnderMouse) self.setResizeAnchor(QtWidgets.QGraphicsView.AnchorUnderMouse) self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.setBackgroundBrush(QtGui.QBrush(QtGui.QColor(255, 255, 255)))
def __init__(self, parent=None): super().__init__(parent) self.engine = None self.standard = False self.ui = Ui_Dialog() self.ui.setupUi(self) self.list = self.ui.listwidget # 设置标题 self.setWindowTitle("着法") self.font = QtGui.QFont() self.font.setFamilies([u"DengXian"]) self.font.setPointSize(14) self.red_style = QtGui.QBrush(QtGui.QColor(255, 0, 0, 255)) self.black_style = QtGui.QBrush(QtGui.QColor(0, 0, 0, 255)) self.signal = Signal(self) self.signal.refresh.connect(self.update)
def __init__(self, parent=None): super(SlideshowGraphicsView, self).__init__(parent) self.setFrameShape(QtWidgets.QFrame.NoFrame) self.setLineWidth(0) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) self.setBackgroundBrush(brush) self.setInteractive(False) self.setObjectName("gfx_slide") self.setInteractive(True) self.setMouseTracking(True) self.setAttribute(QtCore.Qt.WA_Hover)
def setText(self, txt, highlight=False): if txt: self.show() self.frameNumber.setText("%s" % txt) rect = self.frameNumber.boundingRect() self.setRect(self.frameNumber.boundingRect()) if highlight: # paint with a different color when on # the first frame of a clip self.setBrush(QtGui.QBrush(QtGui.QColor(55, 5, 0, 120))) self.frameNumber.setBrush( QtGui.QBrush(QtGui.QColor(255, 250, 250, 255))) else: self.frameNumber.setBrush( QtGui.QBrush(QtGui.QColor(25, 255, 10, 255))) self.setBrush(QtGui.QBrush(QtGui.QColor(5, 55, 0, 120))) if self.position < 0: self.setX(-rect.width() - 2) else: self.setX(2) else: self.hide()
def paint(self, painter, option, index): dynamic_node = self._model.data(index, QtCore.Qt.UserRole) left = option.rect.center().x() - 7 top = option.rect.center().y() - 7 rect = QtCore.QRect(left, top, 14, 14) pen = QtGui.QPen(QtGui.QColor("black")) pen.setWidth(2) color = dynamic_node.color or (0, 0, 0) color = QtGui.QColor(*[c * 255 for c in color]) brush = QtGui.QBrush(color) painter.setPen(pen) painter.setBrush(brush) painter.drawRect(rect)
def paint(self, painter, option, widget): bl = self.bloqueCirculo pen = QtGui.QPen() pen.setColor(QtGui.QColor(bl.color)) pen.setWidth(bl.grosor) pen.setStyle(bl.tipoqt()) painter.setPen(pen) if bl.colorRelleno != -1: painter.setBrush(QtGui.QBrush(QtGui.QColor(bl.colorRelleno))) if bl.grados in [360, 0]: painter.drawEllipse(self.rect) else: painter.drawPie(self.rect, 0 * 16, bl.grados * 16)
def __init__(self, item, timeline_range, rect, *args, **kwargs): rect.setHeight(TRANSITION_HEIGHT) super(TransitionItem, self).__init__(item, timeline_range, rect, *args, **kwargs) self.setBrush(QtGui.QBrush(QtGui.QColor(237, 228, 148, 255))) self.setY(TRACK_HEIGHT - TRANSITION_HEIGHT) self.setZValue(2) # add extra bit of shading shading_poly_f = QtGui.QPolygonF() shading_poly_f.append(QtCore.QPointF(0, 0)) shading_poly_f.append(QtCore.QPointF(rect.width(), 0)) shading_poly_f.append(QtCore.QPointF(0, rect.height())) shading_poly = QtWidgets.QGraphicsPolygonItem(shading_poly_f, parent=self) shading_poly.setBrush(QtGui.QBrush(QtGui.QColor(0, 0, 0, 30))) try: shading_poly.setPen(QtCore.Qt.NoPen) except TypeError: shading_poly.setPen(QtCore.Qt.transparent)
def paint(self, painter, option, widget): pen = QtGui.QPen() if self.bloqueTexto.colorFondo != -1: painter.setBrush(QtGui.QBrush(QtGui.QColor(self.bloqueTexto.colorFondo))) nColor = self.bloqueTexto.colorTexto if self.bloqueTexto.colorTexto != -1 else 0 if self.bloqueTexto.colorFondo != -1: painter.setBrush(QtGui.QBrush()) pen.setColor(QTUtil.qtColor(nColor)) painter.setPen(pen) painter.setFont(self.font) painter.drawText(self.rect, self.bloqueTexto.valor, self.textOption) if self.siRecuadro: pen = QtGui.QPen() pen.setColor(QtGui.QColor("blue")) pen.setWidth(1) pen.setStyle(QtCore.Qt.DashLine) painter.setPen(pen) painter.drawRect(self.rect)
def __init__(self, marker, *args, **kwargs): self.item = marker poly = QtGui.QPolygonF() poly.append(QtCore.QPointF(0.5 * MARKER_SIZE, -0.5 * MARKER_SIZE)) poly.append(QtCore.QPointF(0.5 * MARKER_SIZE, 0.5 * MARKER_SIZE)) poly.append(QtCore.QPointF(0, MARKER_SIZE)) poly.append(QtCore.QPointF(-0.5 * MARKER_SIZE, 0.5 * MARKER_SIZE)) poly.append(QtCore.QPointF(-0.5 * MARKER_SIZE, -0.5 * MARKER_SIZE)) super(Marker, self).__init__(poly, *args, **kwargs) self.setFlags(QtWidgets.QGraphicsItem.ItemIsSelectable) self.setBrush(QtGui.QBrush(QtGui.QColor(121, 212, 177, 255)))
def populate(self): """ Populate the TreeQ Widget """ self.playRoots = [ QtWidgets.QTreeWidgetItem(self.playTree, [str(item)]) for item in self.roots ] [root.setExpanded(True) for root in self.playRoots] [ root.setForeground(0, QtGui.QBrush(QtGui.QColor('#00cdff'))) for root in self.playRoots ] playbDic = {} for video in self.roots: playbDic.update( {video: [x for x in self.playblastFiles if video in x]}) # populate children under the right Root for index in range(len(self.roots)): for value in playbDic[self.roots[index]]: child = QtWidgets.QTreeWidgetItem(self.playRoots[index], [value]) child.setForeground(0, QtGui.QBrush(QtGui.QColor('#84939B')))
def __init__(self, parent=None): super(PlyViewportToolPanel, self).__init__(parent) self.colorBackground = QtGui.QColor(89, 89, 89) self.qBrush = QtGui.QBrush(self.colorBackground) self.setFixedWidth(82) self.setContentsMargins(0, 4, 0, 4) self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True) self.setWindowFlag(QtCore.Qt.FramelessWindowHint) self.__initUI()
def backgroundButtonGroupClicked(self, button): buttons = self.backgroundButtonGroup.buttons() for myButton in buttons: if myButton != button: button.setChecked(False) text = button.text() if text == "Blue Grid": self.scene.setBackgroundBrush( QtGui.QBrush(QtGui.QPixmap(':/images/background1.png'))) elif text == "White Grid": self.scene.setBackgroundBrush( QtGui.QBrush(QtGui.QPixmap(':/images/background2.png'))) elif text == "Gray Grid": self.scene.setBackgroundBrush( QtGui.QBrush(QtGui.QPixmap(':/images/background3.png'))) else: self.scene.setBackgroundBrush( QtGui.QBrush(QtGui.QPixmap(':/images/background4.png'))) self.scene.update() self.view.update()
def drawLines(self, painter, QPointsList): pen = QtGui.QPen(QtCore.Qt.black, self.width, QtCore.Qt.SolidLine) brush = QtGui.QBrush(QtCore.Qt.lightGray) brush.setColor(QtGui.QColor(13, 13, 13)) pen.setBrush(brush) painter.setPen(pen) # draw static lines if len(QPointsList) > 1: for i in range(len(QPointsList) - 1): painter.drawLine(QtCore.QPointF(QPointsList[i]), QtCore.QPointF(QPointsList[i + 1])) # draw mouse line window_width = 500 * self.UISCALE fade_dist = 250.0 * self.UISCALE a = QtCore.QPointF(self.cursor - QtCore.QPointF(QPointsList[-1])) dist = sqrt(a.x() * a.x() + a.y() * a.y()) norm_a = a / dist startP = QtCore.QPointF(QPointsList[-1]) + (norm_a) * fade_dist limitP = startP if dist > fade_dist: a = window_width - 380 * self.UISCALE step = 5.0 startval = 13 endval = 50 - startval count = a / step for i in range(int(count)): val = startval + ((endval / count) * i) endP = startP + norm_a * step x = endP - QtCore.QPointF(QPointsList[-1]) dist2 = sqrt(x.x() * x.x() + x.y() * x.y()) if dist2 <= dist: brush.setColor(QtGui.QColor(val, val, val)) pen.setBrush(brush) painter.setPen(pen) painter.drawLine(startP, endP) startP = endP brush.setColor(QtGui.QColor(13, 13, 13)) pen.setBrush(brush) painter.setPen(pen) painter.drawLine(QtCore.QPointF(QPointsList[-1]), QtCore.QPoint(limitP.x(), limitP.y())) else: painter.drawLine(QtCore.QPointF(QPointsList[-1]), self.cursor)
def deleteSelectedPlayblast(self): sel_playb = self.playTree.selectedItems() sel_playb_text = [playb.text(0) for playb in sel_playb] print('Deleting...') for video in sel_playb_text: toDelete = '{}/{}'.format(self.playbast_path, video) print(' ' + str(toDelete)) os.remove(toDelete) # Update Playblast QList #################################### self.playTree.clear() update_data = self.getOsDatas() update_root = self.getRootsData() update_playRoots = [ QtWidgets.QTreeWidgetItem(self.playTree, [str(item)]) for item in update_root ] [ root.setForeground(0, QtGui.QBrush(QtGui.QColor('#00cdff'))) for root in update_playRoots ] playbDic = {} for video in update_root: playbDic.update( {video: [x for x in self.playblastFiles if video in x]}) # populate children under the right Root for index in range(len(update_root)): for value in playbDic[update_root[index]]: child = QtWidgets.QTreeWidgetItem(update_playRoots[index], [value]) child.setForeground(0, QtGui.QBrush(QtGui.QColor('#84939B'))) self.expandAll()
def defineFont(self): self.fontLevelOne = QtGui.QFont() self.fontLevelOne.setPointSize(13) self.fontLevelOne.setWeight(75) self.fontLevelOne.setBold(True) self.fontLevelOne.setUnderline(True) self.brushLevelOne = QtGui.QBrush(QtGui.QColor(247, 126, 128)) self.brushLevelOne.setStyle(QtCore.Qt.NoBrush) self.fontLevelTwo = QtGui.QFont() self.fontLevelTwo.setPointSize(11) self.fontLevelTwo.setWeight(75) self.fontLevelTwo.setBold(0) #self.fontLevelTwo.setItalic(True) self.brushLevelTwo = QtGui.QBrush(QtGui.QColor(170, 170, 255)) self.brushLevelTwo.setStyle(QtCore.Qt.NoBrush) self.fontLevelThree = QtGui.QFont() self.fontLevelThree.setPointSize(9) self.fontLevelThree.setWeight(75) self.fontLevelThree.setBold(True) self.fontLevelThree.setItalic(True) self.brushLevelThree = QtGui.QBrush(QtGui.QColor(100, 200, 100)) self.brushLevelThree.setStyle(QtCore.Qt.NoBrush) # item_0.setForeground(0, brush) self.fontLevelFour = QtGui.QFont() self.fontLevelFour.setPointSize(9) self.fontLevelFour.setWeight(75) self.fontLevelFour.setBold(0) self.fontLevelFour.setItalic(True) self.brushLevelFour = QtGui.QBrush(QtGui.QColor(200, 200, 200)) self.brushLevelFour.setStyle(QtCore.Qt.NoBrush)
def paint( self, painter: QtGui.QPainter, option: QtWidgets.QStyleOptionGraphicsItem, widget: QtWidgets.QWidget = None, ): fm = QtGui.QFontMetrics(self.font, painter.device()) path = QtGui.QPainterPath() path.addText(0, fm.ascent(), self.font, self.text()) painter.strokePath(path, QtGui.QPen(QtCore.Qt.black, 2.0)) painter.fillPath(path, QtGui.QBrush(self.color, QtCore.Qt.SolidPattern))
def add_tRowData(self): """ # 영상검출 내역 테이블에 데이터를 추가한다. :return: """ dModel = self.table.model() rowCnt = self.table.model().rowCount() # 데이터 생성 #1.1 # 첫번째 컬럼 - 체크박스 (QStandardItem) # chkItem = QtGui.QStandardItem() # chkItem.setCheckable(True) # chkItem.setEditable(False) # chkItem.setTextAlignment(QtCore.Qt.AlignCenter) # dModel.setItem(rowCnt, 0, chkItem) # 데이터 생성 #1.2 # 첫번째 컬럼 - 체크박스 (QTableWidgetItem) chkItem = QtGui.QStandardItem() chkItem.setFlags(QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled) chkItem.setCheckState(QtCore.Qt.Unchecked) dModel.setItem(rowCnt, 0, chkItem) # 썸네일 이미지 추출 thumnailImg = self.cm.createThumnail_filePath( "pixmap", "D:/sampleImg/image2.jpg", 50, 50, 50) # 브러시를 이용하여 썸네일 입력 # 추후 학습 결과를 QImage imgBrush = QtGui.QBrush() imgBrush.setTexture(thumnailImg) imgBrush.setStyle(QtCore.Qt.BrushStyle.RadialGradientPattern) imgItem = QtGui.QStandardItem() imgItem.setBackground(imgBrush) imgItem.setTextAlignment(QtCore.Qt.AlignCenter) imgItem.setEditable(False) dModel.setItem(rowCnt, 1, imgItem) # 데이터 생성 #3 # 세번째~나머지 컬럼 - 텍스트 데이터 입력 처리 루프 for colCnt in range(2, 6): inputTextSample = "Input Result Value : {}".format(rowCnt) item = QtGui.QStandardItem(inputTextSample) item.setTextAlignment(QtCore.Qt.AlignCenter) item.setEditable(False) dModel.setItem(rowCnt, colCnt, item) self.table.setRowHeight(rowCnt, 50)
def __paintSelection(self, painter): if self.__selectionRange is None: return selection = (min(self.__selectionRange[0], self.__selectionRange[1]), max(self.__selectionRange[0], self.__selectionRange[1])) leftExtent = self.__getTickArea(selection[0]) rightExtent = self.__getTickArea(selection[1] - 1) selectionExtent = QtCore.QRect( leftExtent.left(), leftExtent.top(), rightExtent.right() - leftExtent.left() + 2, leftExtent.height() // 2) painter.fillRect(selectionExtent, QtGui.QBrush(QtGui.QColor(75, 75, 75)))
def drawBackground(self, painter, rect): background_brush = QtGui.QBrush(QtGui.QColor(255, 255, 255), QtCore.Qt.SolidPattern) painter.fillRect(rect, background_brush) lines = [] for y in range(self.size + 1): lines.append( QtCore.QLineF(0, y * self.scale, self.size * self.scale, y * self.scale)) for x in range(self.size + 1): lines.append( QtCore.QLineF(x * self.scale, 0, x * self.scale, self.size * self.scale)) painter.drawLines(lines)
def addAxis( self, axis: QtCharts.QAbstractAxis, alignment: QtCore.Qt.Alignment ) -> None: axis.setMinorGridLineVisible(True) axis.setTitleBrush(QtGui.QBrush(self.theme["title"])) axis.setGridLinePen(QtGui.QPen(self.theme["grid"], 1.0)) axis.setMinorGridLinePen(QtGui.QPen(self.theme["grid"], 0.5)) axis.setLinePen(QtGui.QPen(self.theme["axis"], 1.0)) axis.setLabelsColor(self.theme["text"]) axis.setShadesColor(self.theme["title"]) if isinstance(axis, QtCharts.QValueAxis): axis.setTickCount(6) self.chart().addAxis(axis, alignment)
def _create_colorwheel_image(self): """QImage is created once to speed up repaint Image is regenerate when window is resized""" image = QtGui.QImage(self.width(), self.height(), QtGui.QImage.Format_ARGB32) image.fill(QtCore.Qt.transparent) brush = QtGui.QBrush() brush.setColor(QtCore.Qt.red) painter = QtGui.QPainter(image) painter.setBrush(brush) painter.setRenderHint(QtGui.QPainter.Antialiasing, True) self._paint_colorwheel(painter) painter.end() return image
def paintEvent(self, ev: QtGui.QPaintEvent): super(QQChatItem, self).paintEvent(ev) pos = self.label2.pos() painter = QtGui.QPainter(self) painter.setPen(QtGui.QPen(QtGui.QColor("#cacaca"))) painter.setBrush(QtGui.QBrush(QtGui.QColor("#cacaca"))) path = QtGui.QPainterPath() path.addRect(pos.x() + 5, pos.y() + 20, self.width() - (pos.x() + 5 + 8), pos.y() + 20 + 10) path.moveTo(pos.x() + 5, pos.y() + 20 + 6) path.lineTo(pos.x() - 3, pos.y() + 20 + 10) path.lineTo(pos.x() + 5, pos.y() + 20 + 14) painter.drawPath(path) painter.setPen(QtGui.QPen("black")) painter.drawText(QtCore.QPoint(pos.x() + 12, pos.y() + 20 + 20), self.text)
def add_treewidget_item(parent, label, icon=None, foreground=None): item = QtWidgets.QTreeWidgetItem (parent) item.setText (0, label) if icon: icon_path = os.path.join(resource.getIconPath(), '{}.png'.format(icon)) icon = QtGui.QIcon () icon.addPixmap(QtGui.QPixmap(icon_path), QtGui.QIcon.Normal, QtGui.QIcon.Off) item.setIcon (0, icon) if foreground: r, g, b = foreground brush = QtGui.QBrush(QtGui.QColor(r, g, b)) brush.setStyle(QtCore.Qt.NoBrush) item.setForeground(0, brush) return item
def populate_scanline(self): import nuke if len(nuke.allNodes('ScanlineRender')) == 0: self.append_to_log('INFO: No ScanlineRender nodes found', 'orange') for node in nuke.allNodes('ScanlineRender'): row = self.ui.scanline_table.rowCount() self.ui.scanline_table.insertRow(self.ui.scanline_table.rowCount()) scanline_name = QtWidgets.QTableWidgetItem() scanline_name.setTextAlignment(QtCore.Qt.AlignCenter) scanline_name.setText(node.name()) scanline_name.setFlags(QtCore.Qt.ItemIsEditable) scanline_name.setForeground( QtGui.QBrush(QtGui.QColor(QtCore.Qt.white))) self.ui.scanline_table.setItem(row, 0, scanline_name) aa_filter = QtWidgets.QComboBox() aa_filter.addItems([ 'Impulse', 'Cubic', 'Keys', 'Simon', 'Rifman', 'Mitchell', 'Parzen', 'Notch', 'Lanczos4', 'Lanczos6', 'Sinc4', 'Nearest', 'Bilinear', 'Trilinear', 'Anisotropic' ]) aa_filter.setCurrentIndex(node['filter'].getValue()) self.ui.scanline_table.setCellWidget(row, 1, aa_filter) aa_options = QtWidgets.QComboBox() aa_options.addItems(['None', 'Low', 'Medium', 'High']) aa_options.setCurrentIndex(node['antialiasing'].getValue()) self.ui.scanline_table.setCellWidget(row, 2, aa_options) aa_samples = QtWidgets.QSpinBox() aa_samples.setMinimum(0) aa_samples.setMaximum(50) aa_samples.setValue(node['samples'].getValue()) self.ui.scanline_table.setCellWidget(row, 3, aa_samples) aa_shutter = QtWidgets.QDoubleSpinBox() aa_shutter.setMinimum(-10) aa_shutter.setMaximum(10) aa_shutter.setSingleStep(0.25) aa_shutter.setValue(node['shutter'].getValue()) self.ui.scanline_table.setCellWidget(row, 4, aa_shutter) self.append_to_log( 'Found ScanlineRender node {}, added to list'.format( node.name()), 'lime')
def __init__(self): super().__init__() self.setReadOnly(True) self.document().setDefaultStyleSheet( QtWidgets.QApplication.instance().styleSheet()) self.clean() palette = self.palette() palette.setBrush(QtGui.QPalette.Highlight, QtGui.QColor(0xd0, 0xd0, 0xff, 40)) palette.setBrush(QtGui.QPalette.HighlightedText, QtGui.QBrush(QtCore.Qt.NoBrush)) self.setPalette(palette)
def paint(self, painter, option, widget): painter.fillRect( widget.rect(), QtGui.QBrush(QtGui.QColor(0, 0, 0, 0), QtCore.Qt.SolidPattern)) lines = [] for y in range(self.size + 1): lines.append( QtCore.QLine(0, y * self.scale, self.size * self.scale, y * self.scale)) for x in range(self.size + 1): lines.append( QtCore.QLine(x * self.scale, 0, x * self.scale, self.size * self.scale)) painter.drawLines(lines)
def apply(self, cursor, line_num): for i in range(line_num + 1): if i == line_num: break cursor.movePosition(QtGui.QTextCursor.NextBlock) cursor.movePosition(QtGui.QTextCursor.EndOfBlock, QtGui.QTextCursor.KeepAnchor) doc = cursor.document() block = doc.findBlockByNumber(line_num) fmt = block.blockFormat() brush = QtGui.QBrush(QtGui.QColor(*self.color)) fmt.setBackground(brush) cursor.setBlockFormat(fmt)
def loadExtensionList(self): i = 0 for ext in instance.extensionList(): item = QtWidgets.QListWidgetItem(self) if not ext in instance.extensionList(True): item.setText(ext + " [did not load]") item.setIcon(QtGui.QIcon.fromTheme("dialog-error")) else: item.setText(ext) item.setIcon(QtGui.QIcon.fromTheme("applications-development")) if i % 2 == 1: item.setBackground( QtGui.QBrush(QtGui.QColor.fromRgb(240, 240, 240))) i += 1
def paintEvent(self, event): # кисти и карандаши для рисования redpen = QtGui.QPen(QtCore.Qt.red, 0) blackpen = QtGui.QPen(QtCore.Qt.black, 0) nopen = QtCore.Qt.NoPen redbrush = QtGui.QBrush(QtCore.Qt.red) blackbrush = QtGui.QBrush(QtCore.Qt.black) nobrush = QtCore.Qt.NoBrush # установка координат и отрисовка абсолюта painter = QtGui.QPainter(self) painter.translate(self.center) painter.scale(self.radius, self.radius) painter.setPen(blackpen) painter.drawEllipse(QtCore.QRectF(-1, -1, 2, 2)) for obj in self.objects: if isinstance(obj, HypPoint): painter.setPen(nopen) painter.setBrush(blackbrush) self._drawPoint(painter, obj) elif isinstance(obj, HypLine): painter.setPen(blackpen) painter.setBrush(nobrush) self._drawLine(painter, obj) for obj in self.selected: if isinstance(obj, HypPoint): painter.setPen(nopen) painter.setBrush(redbrush) self._drawPoint(painter, obj) elif isinstance(obj, HypLine): painter.setPen(redpen) painter.setBrush(nobrush) self._drawLine(painter, obj) painter.end()
def paint(self, painter, option, widget): adjust_y = -2 pen_width = 0 if option.state & QtWidgets.QStyle.State_Sunken: pen_width = 2 y = self.label_h + 2 * self.text_padding + adjust_y rect = self.selection_polygon.boundingRect() painter.setPen(QtCore.Qt.NoPen) painter.setBrush(QtGui.QBrush(QtCore.Qt.white)) painter.drawPath(self.selection_shape) painter.setPen(QtCore.Qt.NoPen) if option.state & QtWidgets.QStyle.State_Selected: painter.setBrush(QtGui.QBrush(QtCore.Qt.darkGray)) else: painter.setBrush(QtGui.QBrush(QtCore.Qt.lightGray)) painter.drawRect(0, 0, rect.width(), y) painter.setPen(QtGui.QPen(QtCore.Qt.black, pen_width)) painter.setBrush(QtCore.Qt.NoBrush) painter.drawLine(0, y, rect.width(), y) painter.drawPath(self.selection_shape) painter.setFont(self.font) if self.label != "": painter.drawText(self.text_padding, self.label_h + adjust_y, self.label) for n, text in enumerate(self.descriptors): painter.drawText( self.text_padding, y + (n + 1) * (self.descriptor_h + self.text_padding) + adjust_y, text)