Init
This commit is contained in:
100
groundobj.cpp_old
Normal file
100
groundobj.cpp_old
Normal file
@@ -0,0 +1,100 @@
|
||||
#include "groundobj.h"
|
||||
|
||||
groundObj::groundObj(QObject *parent)
|
||||
|
||||
{
|
||||
x=y=type=0;
|
||||
exist=true;
|
||||
|
||||
|
||||
QString s;
|
||||
s=":/new/pics/ground0.xpm";
|
||||
icon = QIcon(s);
|
||||
n_Ab = 0;
|
||||
|
||||
}
|
||||
|
||||
QRectF groundObj::boundingRect() const
|
||||
{
|
||||
qreal d = 150;
|
||||
return QRectF(-50+x,-50+y,d,d);
|
||||
}
|
||||
|
||||
void groundObj::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
|
||||
if (exist)
|
||||
{
|
||||
|
||||
|
||||
QImage im(50,50,QImage::Format_ARGB32);
|
||||
im.fill(Qt::transparent);
|
||||
|
||||
QPainter *p = new QPainter(&im);
|
||||
p->setBrush(Qt::SolidPattern);
|
||||
|
||||
pic = icon.pixmap(15, 15);
|
||||
|
||||
|
||||
//// êàðòèíêà
|
||||
// if ((viewSettings==0)||(viewSettings==2))
|
||||
p->drawPixmap(15, 15, pic);
|
||||
//// ýøåëîí
|
||||
// if ((viewSettings!=1)&&(viewSettings!=3))
|
||||
// p->drawPolygon(altPoly[alt]);
|
||||
//// íîìåð
|
||||
// if ((viewSettings!=1)&&(viewSettings!=2))
|
||||
// {
|
||||
// QFont f = p->font();
|
||||
// f.setPointSizeF(7);
|
||||
// p->setFont(f);
|
||||
// p->drawText(32, 33, QString::number(numb));
|
||||
// }
|
||||
|
||||
p->end();
|
||||
|
||||
// if ((an>45)&&(an<210))
|
||||
painter->drawImage(x, y, im);
|
||||
// else
|
||||
// painter->drawImage(lX/scIndex-35, lY/scIndex-45, im);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->drawPoint(0,0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void groundObj::setType(int t)
|
||||
{
|
||||
if (type!=t)
|
||||
{
|
||||
prepareGeometryChange();
|
||||
type=t;
|
||||
}
|
||||
}
|
||||
|
||||
void groundObj::setPos(QPointF p)
|
||||
{
|
||||
QPointF lp(x, y);
|
||||
if (lp!=p)
|
||||
{
|
||||
prepareGeometryChange();
|
||||
x = p.x();
|
||||
y = p.y();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void groundObj::setPos(qreal x, qreal y)
|
||||
{
|
||||
setPos(QPointF(x, y));
|
||||
}
|
||||
Reference in New Issue
Block a user