<commit_before>#include "canvas.hh"

CanvasBlock::CanvasBlock(Block *b) : block(b) {
	setFlag(ItemIsMovable, true);

	setPos(b->extraInfo.position.get(0), b->extraInfo.position.get(1));
	text = new QGraphicsTextItem(QString::fromStdString(b->fname));
	rect = new QGraphicsRectItem();
	ret = new QGraphicsRectItem();
	for (unsigned int i = 0; i < b->arguments.size(); i++) {
		auto ar = new QGraphicsRectItem();
		args.push_back(ar);
	}

	rect->setRect(text->boundingRect());
}

CanvasBlock::~CanvasBlock() {
	delete rect;
	delete text;
	delete ret;
	for (auto i : args)
		delete i;
}

QRectF CanvasBlock::boundingRect() const {
	return text->boundingRect();
}

void CanvasBlock::paint(QPainter *p, const QStyleOptionGraphicsItem *sogi, QWidget *w) {
	rect->paint(p, sogi, w);
	text->paint(p, sogi, w);
}
<commit_msg>Improving boundingRect to include return and arguments<commit_after>#include "canvas.hh"

CanvasBlock::CanvasBlock(Block *b) : block(b) {
	setFlag(ItemIsMovable, true);

	setPos(b->extraInfo.position.get(0), b->extraInfo.position.get(1));
	text = new QGraphicsTextItem(QString::fromStdString(b->fname));
	rect = new QGraphicsRectItem();
	ret = new QGraphicsRectItem();
	for (unsigned int i = 0; i < b->arguments.size(); i++) {
		auto ar = new QGraphicsRectItem();
		args.push_back(ar);
	}

	rect->setRect(text->boundingRect());
}

CanvasBlock::~CanvasBlock() {
	delete rect;
	delete text;
	delete ret;
	for (auto i : args)
		delete i;
}

QRectF CanvasBlock::boundingRect() const {
	QRectF br = rect->boundingRect();
	if (args.size() > 0) br |= args[0]->boundingRect();
	br |= ret->boundingRect();
	return br;
}

void CanvasBlock::paint(QPainter *p, const QStyleOptionGraphicsItem *sogi, QWidget *w) {
	rect->paint(p, sogi, w);
	text->paint(p, sogi, w);
}

{'fraction_non_alphanumeric': 0.16826651609260304, 'fraction_numerical': 0.004517221908526256, 'mean_word_length': 5.397111913357401, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4581286', 'n_tokens_mistral': 676, 'n_tokens_neox': 656, 'n_words': 144}