This commit is contained in:
2025-07-02 07:45:34 +03:00
parent a4135d45d8
commit 1fee25a38c
121 changed files with 16425 additions and 0 deletions

73
graphicscrossitem.cpp Normal file
View File

@@ -0,0 +1,73 @@
#include "graphicscrossitem.h"
graphicsCrossItem::graphicsCrossItem(qreal px, qreal py)
{
x = px;
y = py;
dim=3;
col = QColor(Qt::lightGray);
scIndex=1;
}
QRectF graphicsCrossItem::boundingRect() const
{
qreal d = dim*scIndex;
return QRectF(x-d, y-d, 2*d, 2*d);
}
void graphicsCrossItem::setColor(QColor c)
{
if (col!=c) {
prepareGeometryChange();
col = c;
}
}
void graphicsCrossItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
qreal d = dim*scIndex;
painter->setPen(QPen(col));
QPointF p1(x-d, y-d);
QPointF p2(x+d, y+d);
QPointF p3(x-d, y+d);
QPointF p4(x+d, y-d);
painter->drawLine(p1, p2);
painter->drawLine(p3, p4);
}
void graphicsCrossItem::setPos(QPointF p)
{
qreal px, py;
px= p.x(); py= p.y();
if ((x!=px)||(y!=py) ) {
prepareGeometryChange();
x=px; y=py;
}
}
void graphicsCrossItem::setPosPolar(qreal d, qreal a)
{
if (d>0)
{
setPos(cos((90-a)/180*M_PI)*d, -sin((90-a)/180*M_PI)*d);
}
else
{
setPos(0,0);
}
}
void graphicsCrossItem::setScaleIndex(qreal s)
{
if (scIndex!=s){
prepareGeometryChange();
scIndex=s;
}
}