Skip to content
Snippets Groups Projects
Commit 421ba3dc authored by ucart's avatar ucart
Browse files

I'm dumb

parent 36ae2569
No related branches found
No related tags found
No related merge requests found
#include "quaditem.h"
#include <QPixmap>
#include <QLabel>
QuadItem::QuadItem()
{
setFlag(ItemIsMovable);
}
QRectF QuadItem::boundingRect() const
{
return QRectF(0,0,50,50);
}
void QuadItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QRectF rec = boundingRect();
painter->drawImage(rec,QImage(":/images/quad/quad.png"));
}
void QuadItem::updateQuad(float longitudinal, float lateral, float height, float pitch, float roll, float yaw)
{
this->setPos(longitudinal*10, lateral*10);
QPointF center = boundingRect().center();
QTransform trans = this->transform();
trans.translate(center.x(), center.y());
trans.rotate(yaw);
trans.translate(-center.x(), -center.y());
this->setTransform(trans);
update();
}
#ifndef QUADITEM_H
#define QUADITEM_H
#include <QPainter>
#include <QGraphicsItem>
#include <QPixmap>
#include <QLabel>
#include <QtCore>
#include <QtGui>
#include <QTransform>
class QuadItem : public QGraphicsItem
{
public:
QuadItem();
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private slots:
void updateQuad(float longitudinal, float lateral, float height, float pitch, float roll, float yaw);
};
#endif // QUADITEM_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment