27 QGraphicsItem* parent)
28 : QGraphicsItem(parent)
53 QGraphicsItem* parent)
54 : QGraphicsItem(parent)
58 _bounds = QRectF(x, y, width, height);
78 QGraphicsItem* parent)
79 : QGraphicsItem(parent)
90 QColor iColour = pen.color();
91 iColour.setAlpha(125);
116 QGraphicsItem* parent)
117 : QGraphicsItem(parent)
121 _bounds = QRectF(x, y, width, height);
128 QColor iColour = pen.color();
129 iColour.setAlpha(125);
146 QPen in(Qt::gray, 1, Qt::DotLine, Qt::SquareCap, Qt::RoundJoin);
147 QPen out(Qt::black, 1, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin);
156 const QStyleOptionGraphicsItem* option,
168 QBrush brush(Qt::NoBrush);
175 auto x =
static_cast<int>(
181 painter->drawLine(x,
static_cast<int>(
_bounds.top()), x,
182 static_cast<int>(
_bounds.bottom()));
191 painter->drawLine(x,
static_cast<int>(
_bounds.bottom()), x,
192 static_cast<int>(
_bounds.bottom()) + 5);
202 auto y =
static_cast<int>(
208 painter->drawLine(
static_cast<int>(
_bounds.left()), y,
209 static_cast<int>(
_bounds.right()), y);
218 painter->drawLine(
static_cast<int>(
_bounds.left()) - 5, y,
219 static_cast<int>(
_bounds.left()), y);
242 _bounds = QRectF(x, y, width, height);
Definition of the QGraphicsGrid class.
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)