code format

This commit is contained in:
2022-12-14 14:14:33 +03:00
parent 09e5342956
commit cdb02fc9be
278 changed files with 15371 additions and 12176 deletions

View File

@@ -1,20 +1,21 @@
#include "blockbase.h"
#include "alignedtextitem.h"
#include "qvariantedit.h"
QDataStream & operator <<(QDataStream & s, const QGraphicsItem * item) {
QDataStream & operator<<(QDataStream & s, const QGraphicsItem * item) {
if (!item) {
s << int(-1);
return s;
}
const QGraphicsRectItem * irect = qgraphicsitem_cast<const QGraphicsRectItem*>(item);
const QGraphicsEllipseItem * iell = qgraphicsitem_cast<const QGraphicsEllipseItem*>(item);
const QGraphicsSimpleTextItem * itext = qgraphicsitem_cast<const QGraphicsSimpleTextItem*>(item);
const AlignedTextItem * iatext = qgraphicsitem_cast<const AlignedTextItem*>(item);
const QGraphicsLineItem * iline = qgraphicsitem_cast<const QGraphicsLineItem*>(item);
const QGraphicsPathItem * ipath = qgraphicsitem_cast<const QGraphicsPathItem*>(item);
const QGraphicsPixmapItem * ipixmap = qgraphicsitem_cast<const QGraphicsPixmapItem*>(item);
const QGraphicsRectItem * irect = qgraphicsitem_cast<const QGraphicsRectItem *>(item);
const QGraphicsEllipseItem * iell = qgraphicsitem_cast<const QGraphicsEllipseItem *>(item);
const QGraphicsSimpleTextItem * itext = qgraphicsitem_cast<const QGraphicsSimpleTextItem *>(item);
const AlignedTextItem * iatext = qgraphicsitem_cast<const AlignedTextItem *>(item);
const QGraphicsLineItem * iline = qgraphicsitem_cast<const QGraphicsLineItem *>(item);
const QGraphicsPathItem * ipath = qgraphicsitem_cast<const QGraphicsPathItem *>(item);
const QGraphicsPixmapItem * ipixmap = qgraphicsitem_cast<const QGraphicsPixmapItem *>(item);
if (irect) {
s << int(0) << (irect->pen()) << (irect->brush()) << (irect->rect());
} else if (iell) {
@@ -38,72 +39,181 @@ QDataStream & operator <<(QDataStream & s, const QGraphicsItem * item) {
}
QDataStream & operator >>(QDataStream & s, QGraphicsItem *& item) {
int type_; s >> type_;
QDataStream & operator>>(QDataStream & s, QGraphicsItem *& item) {
int type_;
s >> type_;
if (type_ < 0) {
item = 0;
return s;
}
QGraphicsRectItem * nrect = 0;
QGraphicsEllipseItem * nell = 0;
QGraphicsRectItem * nrect = 0;
QGraphicsEllipseItem * nell = 0;
QGraphicsSimpleTextItem * ntext = 0;
AlignedTextItem * natext = 0;
QGraphicsLineItem * nline = 0;
QGraphicsPathItem * npath = 0;
QGraphicsPixmapItem * npixmap = 0;
item = 0;
AlignedTextItem * natext = 0;
QGraphicsLineItem * nline = 0;
QGraphicsPathItem * npath = 0;
QGraphicsPixmapItem * npixmap = 0;
item = 0;
switch (type_) {
case 0:
nrect = new QGraphicsRectItem(); item = nrect;
{QPen _v; s >> _v; nrect->setPen(_v);}
{QBrush _v; s >> _v; nrect->setBrush(_v);}
{QRectF _v; s >> _v; nrect->setRect(_v);}
nrect = new QGraphicsRectItem();
item = nrect;
{
QPen _v;
s >> _v;
nrect->setPen(_v);
}
{
QBrush _v;
s >> _v;
nrect->setBrush(_v);
}
{
QRectF _v;
s >> _v;
nrect->setRect(_v);
}
break;
case 1:
nell = new QGraphicsEllipseItem(); item = nell;
{QPen _v; s >> _v; nell->setPen(_v);}
{QBrush _v; s >> _v; nell->setBrush(_v);}
{QRectF _v; s >> _v; nell->setRect(_v);}
nell = new QGraphicsEllipseItem();
item = nell;
{
QPen _v;
s >> _v;
nell->setPen(_v);
}
{
QBrush _v;
s >> _v;
nell->setBrush(_v);
}
{
QRectF _v;
s >> _v;
nell->setRect(_v);
}
break;
case 2:
ntext = new QGraphicsSimpleTextItem(); item = ntext;
{QPen _v; s >> _v; ntext->setPen(_v);}
{QBrush _v; s >> _v; ntext->setBrush(_v);}
{QFont _v; s >> _v; ntext->setFont(_v);}
{QString _v; s >> _v; ntext->setText(_v);}
ntext = new QGraphicsSimpleTextItem();
item = ntext;
{
QPen _v;
s >> _v;
ntext->setPen(_v);
}
{
QBrush _v;
s >> _v;
ntext->setBrush(_v);
}
{
QFont _v;
s >> _v;
ntext->setFont(_v);
}
{
QString _v;
s >> _v;
ntext->setText(_v);
}
break;
case 6:
natext = new AlignedTextItem(); item = natext;
{QPen _v; s >> _v; natext->setPen(_v);}
{QBrush _v; s >> _v; natext->setBrush(_v);}
{QFont _v; s >> _v; natext->setFont(_v);}
{QString _v; s >> _v; natext->setText(_v);}
{int _v; s >> _v; natext->setAlignment((Qt::AlignmentFlag)_v);}
natext = new AlignedTextItem();
item = natext;
{
QPen _v;
s >> _v;
natext->setPen(_v);
}
{
QBrush _v;
s >> _v;
natext->setBrush(_v);
}
{
QFont _v;
s >> _v;
natext->setFont(_v);
}
{
QString _v;
s >> _v;
natext->setText(_v);
}
{
int _v;
s >> _v;
natext->setAlignment((Qt::AlignmentFlag)_v);
}
break;
case 3:
nline = new QGraphicsLineItem(); item = nline;
{QPen _v; s >> _v; nline->setPen(_v);}
{QLineF _v; s >> _v; nline->setLine(_v);}
nline = new QGraphicsLineItem();
item = nline;
{
QPen _v;
s >> _v;
nline->setPen(_v);
}
{
QLineF _v;
s >> _v;
nline->setLine(_v);
}
break;
case 4:
npath = new QGraphicsPathItem(); item = npath;
{QPen _v; s >> _v; npath->setPen(_v);}
{QPainterPath _v; s >> _v; npath->setPath(_v);}
npath = new QGraphicsPathItem();
item = npath;
{
QPen _v;
s >> _v;
npath->setPen(_v);
}
{
QPainterPath _v;
s >> _v;
npath->setPath(_v);
}
break;
case 5:
npixmap = new QGraphicsPixmapItem(); item = npixmap;
{QPixmap _v; s >> _v; npixmap->setPixmap(_v);}
npixmap = new QGraphicsPixmapItem();
item = npixmap;
{
QPixmap _v;
s >> _v;
npixmap->setPixmap(_v);
}
break;
case 7:
npixmap = new QGraphicsPixmapItem(); item = npixmap;
{QPixmap _v; s >> _v; npixmap->setPixmap(_v);}
{QTransform _t; s >> _t; npixmap->setTransform(_t);}
npixmap = new QGraphicsPixmapItem();
item = npixmap;
{
QPixmap _v;
s >> _v;
npixmap->setPixmap(_v);
}
{
QTransform _t;
s >> _t;
npixmap->setTransform(_t);
}
break;
}
if (item) {
{QPointF _v; s >> _v; item->setPos(_v);}
{qreal _v; s >> _v; item->setRotation(_v);}
{int _v; s >> _v; item->setFlags((QGraphicsItem::GraphicsItemFlags)_v);}
{
QPointF _v;
s >> _v;
item->setPos(_v);
}
{
qreal _v;
s >> _v;
item->setRotation(_v);
}
{
int _v;
s >> _v;
item->setFlags((QGraphicsItem::GraphicsItemFlags)_v);
}
}
return s;
}