16 QGraphicsItem* parent)
17 : QGraphicsItem(parent)
42 QGraphicsItem* parent)
43 : QGraphicsItem(parent)
47 _bounds = QRectF(x, y, width, height);
67 QGraphicsItem* parent)
68 : QGraphicsItem(parent)
79 QColor iColour = pen.color();
80 iColour.setAlpha(125);
105 QGraphicsItem* parent)
106 : QGraphicsItem(parent)
110 _bounds = QRectF(x, y, width, height);
117 QColor iColour = pen.color();
118 iColour.setAlpha(125);
135 QPen in(Qt::gray, 1, Qt::DotLine, Qt::SquareCap, Qt::RoundJoin);
136 QPen out(Qt::black, 1, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin);
145 const QStyleOptionGraphicsItem* option,
157 QBrush brush(Qt::NoBrush);
164 auto x =
static_cast<int>(
170 painter->drawLine(x,
static_cast<int>(
_bounds.top()), x,
171 static_cast<int>(
_bounds.bottom()));
180 painter->drawLine(x,
static_cast<int>(
_bounds.bottom()), x,
181 static_cast<int>(
_bounds.bottom()) + 5);
191 auto y =
static_cast<int>(
197 painter->drawLine(
static_cast<int>(
_bounds.left()), y,
198 static_cast<int>(
_bounds.right()), y);
207 painter->drawLine(
static_cast<int>(
_bounds.left()) - 5, y,
208 static_cast<int>(
_bounds.left()), y);
231 _bounds = QRectF(x, y, width, height);
void setRect(QRectF rect)
void setNumberOfYCells(int yCells)
Sets the number of cells in y direction.
~QGraphicsGrid() override
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
Paints the grid.
void setNumberOfXCells(int xCells)
Sets the number of cells in x direction.
void initDefaultPens()
Defines the default pens.
QRectF boundingRect() const override
Returns the bounding rectangle of the grid.
QGraphicsGrid(QRectF rect, int xCells, int yCells, QGraphicsItem *parent=nullptr)