grid_renderer.*¶
Provides
- func
painter_save: Context manager saving and restoring painter state
- func
painter_zoom: Context manager scaling and restoring the painter
- func
painter_rotate: Context manager rotating and restoring the painter
GridCellNavigator: Find neighbors of a cell
EdgeBorders: Dataclass for edge properties
CellEdgeRenderer: Paints cell edges
QColorCache: QColor cache
CellRenderer: Paints cells
-
class
grid_renderer.CellEdgeRenderer(painter, center, borders)[source]¶ Bases:
objectPaints cell edges
Borders are provided by EdgeBorders in order: left, right, top, bottom
- Parameters
painter (
QPainter) – Painter with which edge is drawncenter (
QPointF) – Edge centerborders (
EdgeBorders) – Border widths and colors
-
class
grid_renderer.CellRenderer(grid, painter, option, index)[source]¶ Bases:
objectPaints cells
Cell rendering governs the area of a cell inside its borders. It is done in a vector oriented way. Therefore, the following conventions shall apply:
Cell borders of width 1 shall be painted so that they appear only in the bottom and right edge of the cell.
Cell borders of all widths have the same center line.
Cell borders that are thicker than 1 are painted on all borders.
- At the edges, borders are painted in the following order:
Thin borders are painted first
If border width is equal, lighter colors are painted first
- Parameters
grid (
QTableView) – The main grid widgetpainter (
QPainter) – Painter with which borders are drawnoption (
QStyleOptionViewItem) – Style option for renderingindex (
QModelIndex) – Index of cell to be rendered
-
inner_rect(rect)[source]¶ Returns inner rect that is shrunk by border widths
For merged cells, minimum top/left border widths are taken into account
- Parameters
rect (
QRectF) – Cell rect to be shrunk- Return type
QRectF
-
paint_above_borders(rect)[source]¶ Paint lower borders of all above cells
- Parameters
rect (
QRectF) – Cell rect of below cell, in which the borders are painted
-
paint_bottom_border(rect)[source]¶ Paint bottom border of cell
- Parameters
rect (
QRectF) – Cell rect of the cell to be painted
-
paint_bottom_left_edge(rect)[source]¶ Paints bottom left edge of the cell
- Parameters
rect (
QRectF) –Cell rect of cell, for which the edge is painted
top
L | C
- left ———— right
- BL | B
bottom
-
paint_bottom_right_edge(rect)[source]¶ Paints bottom right edge of the cell
- Parameters
rect (
QRectF) –Cell rect of cell, for which the edge is painted
top
C | R
- left ———– right
- B | BR
bottom
-
paint_left_borders(rect)[source]¶ Paint right borders of all left cells
- Parameters
rect (
QRectF) – Cell rect of right cell, in which the borders are painted
-
paint_right_border(rect)[source]¶ Paint right border of cell
- Parameters
rect (
QRectF) – Cell rect of the cell to be painted
-
class
grid_renderer.EdgeBorders(left_width, right_width, top_width, bottom_width, left_color, right_color, top_color, bottom_color, left_x, right_x, top_y, bottom_y)[source]¶ Bases:
objectHolds border data for an edge
-
bottom_color: PyQt5.QtGui.QColor¶
-
property
colors¶ Tuple of border colors in order left, right, top, bottom
- Return type
Tuple[QColor,QColor,QColor,QColor]
-
left_color: PyQt5.QtGui.QColor¶
-
right_color: PyQt5.QtGui.QColor¶
-
top_color: PyQt5.QtGui.QColor¶
-
Bases:
objectFind neighbors of a cell
- Parameters
Merging cell if cell is merged else cell key
Color of bottom border line
- Return type
QColor
Color of right border line
- Return type
QColor
Width of bottom border line
- Return type
Width of right border line
- Return type
-
class
grid_renderer.QColorCache(grid, *args, **kwargs)[source]¶ Bases:
dictQColor cache that returns default color for None
-
grid_renderer.painter_rotate(painter, rect, angle=0)[source]¶ Context manager rotating and restoring the painter
- Parameters
painter (
QPainter) – Painter, which is rotatedrect (
QRectF) – Rect to be painted inangle (
int) – Rotataion angle must be in (0, 90, 180, 270)
- Return type
QRectF
-
grid_renderer.painter_save(painter)[source]¶ Context manager saving and restoring painter state
- Parameters
painter (
QPainter) – Painter, for which the state is preserved
-
grid_renderer.painter_zoom(painter, zoom, rect)[source]¶ Context manager scaling and restoring the painter
(rect.x(), rect.y()) is invariant
- Parameters
painter (
QPainter) – Painter, for which the state is preservedzoom (
float) – Zoom factorrect (
QRectF) – Rect for setting zoom invariant point (rect.x(), rect.y())
- Return type
QRectF
pyspread