<commit_before>#ifndef DIAGRAMTEXTITEM_H
#define DIAGRAMTEXTITEM_H

#include <QGraphicsTextItem>
#include <QLinearGradient>
#include <QPen>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include "declarationdatatypes.h"

QT_BEGIN_NAMESPACE
class QPainter;
class QFocusEvent;
class QGraphicsItem;
class QGraphicsScene;
class QGraphicsSceneMouseEvent;
QT_END_NAMESPACE

//! [0]
class DiagramTextItem : public QGraphicsTextItem
{
    Q_OBJECT

public:
    enum { Type = UserType + 3 };

    DiagramTextItem(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);

    int type() const
        { return Type; }
	int typeElement() {return this->typeElementData;}

signals:
    void lostFocus(DiagramTextItem *item);
    void selectedChange(QGraphicsItem *item);

protected:
    QVariant itemChange(GraphicsItemChange change, const QVariant &value);
	QRecrtF boudinRect() const
	{
		qreal penW = 1;
		QRectF oldR = QGraphicsTextItem::boundingRect();
		QRectF newR = QRectF(-2-penW/2,-2-penW/2,50+penW,20+penW);
		if(oldR.width() < newR.width())
			return newR;
		else
			return oldR;
	}
    void focusOutEvent(QFocusEvent *event);
    void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
	void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget )
	{
		QRectF rectf = boundingRect();
		// отрисовка по линиям пока думаем как сделать скошенный угол и нужен он вообще
		QPointF newPointTopRight = QPointF((rectf.topRight().x()- rectf.topLeft().x())*9.0/10.0,
			rectf.topLeft().y());
		QPointF newPointBottomRight  = QPointF(rectf.topRight().x(),
			(rectf.bottomRight().y() - rectf.topRight().y())*1.0/10.0);
		QLinearGradient linearGrad(newPointBottomRight, rectf.bottomLeft());
		linearGrad.setColorAt(0, Qt::white);
		linearGrad.setColorAt(1, QColor(255,130,80));
		painter->fillRect(rectf,QBrush(linearGrad));
		painter->drawLine(rectf.topLeft(),newPointTopRight);
		painter->drawLine(rectf.topLeft(),rectf.bottomLeft());
		painter->drawLine(rectf.bottomLeft(),rectf.bottomRight());
		// отрисовка половины линии <commit_msg>маленькое исправление<commit_after>#ifndef DIAGRAMTEXTITEM_H
#define DIAGRAMTEXTITEM_H

#include <QGraphicsTextItem>
#include <QLinearGradient>
#include <QPen>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include "declarationdatatypes.h"

QT_BEGIN_NAMESPACE
class QPainter;
class QFocusEvent;
class QGraphicsItem;
class QGraphicsScene;
class QGraphicsSceneMouseEvent;
QT_END_NAMESPACE

//! [0]
class DiagramTextItem : public QGraphicsTextItem
{
    Q_OBJECT

public:
    enum { Type = UserType + 3 };

    DiagramTextItem(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);

    int type() const
        { return Type; }
	int typeElement() {return this->typeElementData;}

signals:
    void lostFocus(DiagramTextItem *item);
    void selectedChange(QGraphicsItem *item);

protected:
    QVariant itemChange(GraphicsItemChange change, const QVariant &value);
	QRectF boudinRect() const
	{
		qreal penW = 1;
		QRectF oldR = QGraphicsTextItem::boundingRect();
		QRectF newR = QRectF(-2-penW/2,-2-penW/2,50+penW,20+penW);
		if(oldR.width() < newR.width())
			return newR;
		else
			return oldR;
	}
    void focusOutEvent(QFocusEvent *event);
    void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
	void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget )
	{
		QRectF rectf = boundingRect();
		// отрисовка по линиям пока думаем как сделать скошенный угол и нужен он вообще
		QPointF newPointTopRight = QPointF((rectf.topRight().x()- rectf.topLeft().x())*9.0/10.0,
			rectf.topLeft().y());
		QPointF newPointBottomRight  = QPointF(rectf.topRight().x(),
			(rectf.bottomRight().y() - rectf.topRight().y())*1.0/10.0);
		QLinearGradient linearGrad(newPointBottomRight, rectf.bottomLeft());
		linearGrad.setColorAt(0, Qt::white);
		linearGrad.setColorAt(1, QColor(255,130,80));
		painter->fillRect(rectf,QBrush(linearGrad));
		painter->drawLine(rectf.topLeft(),newPointTopRight);
		painter->drawLine(rectf.topLeft(),rectf.bottomLeft());
		painter->drawLine(rectf.bottomLeft(),rectf.bottomRight());
		// отрисовка половины линии 
{'fraction_non_alphanumeric': 0.12665542980977607, 'fraction_numerical': 0.01589212617385023, 'mean_word_length': 5.390769230769231, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, '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': '3809306', 'n_tokens_mistral': 1572, 'n_tokens_neox': 1487, 'n_words': 285}