Python qtpy.QtGui.QBrush() Examples
The following are 7
code examples of qtpy.QtGui.QBrush().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
qtpy.QtGui
, or try the search function
.
Example #1
Source File: logger_tab.py From cutelog with MIT License | 6 votes |
def data_internal(self, index, record, role): result = None if role == Qt.DisplayRole: if index.column() == self.columnCount(INVALID_INDEX) - 1: result = record._cutelog else: column = self.table_header[index.column()] if column.name == 'asctime': result = record.asctime elif role == Qt.SizeHintRole: result = QSize(1, CONFIG.logger_row_height) elif role == Qt.FontRole: result = QFont(CONFIG.logger_table_font, CONFIG.logger_table_font_size) elif role == Qt.ForegroundRole: if not self.dark_theme: result = QColor(Qt.black) else: result = QColor(Qt.white) elif role == Qt.BackgroundRole: if not self.dark_theme: color = QColor(Qt.lightGray) else: color = QColor(Qt.darkGray) result = QBrush(color, Qt.BDiagPattern) return result
Example #2
Source File: levels_preset_dialog.py From cutelog with MIT License | 6 votes |
def get_preview_items(self, level): previewItem = QTableWidgetItem("Log message") previewItem.setBackground(QBrush(level.bg, Qt.SolidPattern)) previewItem.setForeground(QBrush(level.fg, Qt.SolidPattern)) previewItemDark = QTableWidgetItem("Log message") previewItemDark.setBackground(QBrush(level.bgDark, Qt.SolidPattern)) previewItemDark.setForeground(QBrush(level.fgDark, Qt.SolidPattern)) font = QFont(CONFIG.logger_table_font, CONFIG.logger_table_font_size) fontDark = QFont(font) if 'bold' in level.styles: font.setBold(True) if 'italic' in level.styles: font.setItalic(True) if 'underline' in level.styles: font.setUnderline(True) if 'bold' in level.stylesDark: fontDark.setBold(True) if 'italic' in level.stylesDark: fontDark.setItalic(True) if 'underline' in level.stylesDark: fontDark.setUnderline(True) previewItem.setFont(font) previewItemDark.setFont(fontDark) return previewItem, previewItemDark
Example #3
Source File: port.py From pyflowgraph with BSD 3-Clause "New" or "Revised" License | 5 votes |
def setColor(self, color): self._color = color self._ellipseItem.setBrush(QtGui.QBrush(self._color))
Example #4
Source File: port.py From pyflowgraph with BSD 3-Clause "New" or "Revised" License | 5 votes |
def highlight(self): self._ellipseItem.setBrush(QtGui.QBrush(self._color.lighter())) # make the port bigger to highlight it can accept the connection. self._ellipseItem.setRect( -self.__radius * 1.3, -self.__radius * 1.3, self.__diameter * 1.3, self.__diameter * 1.3, )
Example #5
Source File: port.py From pyflowgraph with BSD 3-Clause "New" or "Revised" License | 5 votes |
def unhighlight(self): self._ellipseItem.setBrush(QtGui.QBrush(self._color)) self._ellipseItem.setRect( -self.__radius, -self.__radius, self.__diameter, self.__diameter, ) # =================== # Connection Methods # ===================
Example #6
Source File: pygments_highlighter.py From qtconsole with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _get_brush(self, color): """ Returns a brush for the color. """ result = self._brushes.get(color) if result is None: qcolor = self._get_color(color) result = QtGui.QBrush(qcolor) self._brushes[color] = result return result
Example #7
Source File: schematics.py From pyrpl with GNU General Public License v3.0 | 5 votes |
def __init__(self, widget1, widget2, h_first, parent, show_arrow=True): self.parent = parent self.widget_start = widget1 self.widget_stop = widget2 self.h_first = h_first self.show_arrow = show_arrow self.brush = QtGui.QBrush(QtCore.Qt.black) self.arrow = QtWidgets.QGraphicsPolygonItem() self.arrow.setBrush(self.brush) self.pen = QtGui.QPen(QtCore.Qt.black, 3, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin) self.line1 = QtWidgets.QGraphicsLineItem() self.line1.setPen(self.pen) self.line2 = QtWidgets.QGraphicsLineItem() self.line2.setPen(self.pen) self.line1.setZValue(1) self.line2.setZValue(1) self.parent.scene.addItem(self.line1) self.parent.scene.addItem(self.line2) self.parent.scene.addItem(self.arrow) self.adjust()